Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vector to_text fails if the Vector contains types that have overridden to_text #6273

Closed
radeusgd opened this issue Apr 13, 2023 · 1 comment
Labels
-compiler -libs Libraries: New libraries to be implemented

Comments

@radeusgd
Copy link
Member

This is related to #5961 - and I guess we may get many more issues like this.
All in all the fundamental problem is discussed in #6216.

Noting this particular instance, as we may want to fix it before #6216 is resolved, and to also ensure that any resolution takes this particular problem into account.

Repro

Run the following script:

from Standard.Base import all

type My_Type_1
    Value x

type My_Type_2
    Value x

    to_text self = "My_Type_2{" + self.x.to_text + "}"

main =
    v1 = [1, 2, 3]
    v2 = [My_Type_1.Value 1, My_Type_1.Value 2]
    v3 = [My_Type_2.Value 1, My_Type_2.Value 2]
    v4 = [My_Type_1, Integer]
    v5 = [My_Type_2, Integer]

    IO.println v1.to_text
    IO.println v2.to_text
    IO.println v3.to_text
    IO.println v4.to_text
    IO.println v5.to_text

Actual output

[1, 2, 3]
[(My_Type_1.Value 1), (My_Type_1.Value 2)]
[My_Type_2{1}, My_Type_2{2}]
[My_Type_1, Integer]
Execution finished with an error: Type error: expected `str` to be Text, but got Function.
        at <enso> Text.+(Internal)
        at <enso> Vector.join<arg-0>(C:\NBO\enso\built-distribution\enso-engine-0.0.0-dev-windows-amd64\enso-0.0.0-dev\lib\Standard\Base\0.0.0-dev\src\Data\Vector.enso:709:17-34)
        at <enso> Vector.join<arg-0>(C:\NBO\enso\built-distribution\enso-engine-0.0.0-dev-windows-amd64\enso-0.0.0-dev\lib\Standard\Base\0.0.0-dev\src\Data\Vector.enso:709:17-106)
        at <enso> Vector.join<arg-2>(C:\NBO\enso\built-distribution\enso-engine-0.0.0-dev-windows-amd64\enso-0.0.0-dev\lib\Standard\Base\0.0.0-dev\src\Data\Vector.enso:709:17-115)
        at <enso> Boolean.if_then_else(Internal)
        at <enso> Vector.join<arg-2>(C:\NBO\enso\built-distribution\enso-engine-0.0.0-dev-windows-amd64\enso-0.0.0-dev\lib\Standard\Base\0.0.0-dev\src\Data\Vector.enso:708-709)
        at <enso> Boolean.if_then_else(Internal)
        at <enso> Vector.join(C:\NBO\enso\built-distribution\enso-engine-0.0.0-dev-windows-amd64\enso-0.0.0-dev\lib\Standard\Base\0.0.0-dev\src\Data\Vector.enso:707-709)
        at <enso> Vector.to_text(C:\NBO\enso\built-distribution\enso-engine-0.0.0-dev-windows-amd64\enso-0.0.0-dev\lib\Standard\Base\0.0.0-dev\src\Data\Vector.enso:600:20-56)
        at <enso> vector-totext.main<arg-1>(vector-totext.enso:22:16-25)
        at <enso> vector-totext.main(vector-totext.enso:22:5-25)

Expected output

[1, 2, 3]
[(My_Type_1.Value 1), (My_Type_1.Value 2)]
[My_Type_2{1}, My_Type_2{2}]
[My_Type_1, Integer]
[My_Type_2, Integer]
@JaroslavTulach JaroslavTulach added -compiler -libs Libraries: New libraries to be implemented labels Apr 13, 2023
@jdunkerley jdunkerley assigned jdunkerley and unassigned jdunkerley Apr 18, 2023
@jdunkerley
Copy link
Member

This will be addressed by #6300 - so closing this issue.

@jdunkerley jdunkerley closed this as not planned Won't fix, can't repro, duplicate, stale Apr 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
-compiler -libs Libraries: New libraries to be implemented
Projects
Archived in project
Development

No branches or pull requests

3 participants