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

Tuple(Enum, Enum) is inferred as Tuple(Symbol, Symbol) #8333

Closed
wooster0 opened this issue Oct 15, 2019 · 1 comment
Closed

Tuple(Enum, Enum) is inferred as Tuple(Symbol, Symbol) #8333

wooster0 opened this issue Oct 15, 2019 · 1 comment

Comments

@wooster0
Copy link
Contributor

enum E
  A
  B
  C
end

[:a,
 :b,
 :c] of E

Compiles.

enum E
  A
  B
  C
end

[{:a, :a},
 {:b, :b},
 {:c, :c}] of Tuple(E, E)
Showing last frame. Use --error-trace for full trace.

error in line 7
Error: no overload matches 'Pointer(Tuple(E, E))#[]=' with types Int32, Tuple(Symbol, Symbol)

Overloads are:
 - Pointer(T)#[]=(offset, value : T)

Doesn't compile. But it should, I think.
They're inferred to be Symbols but they're actually Es. The Pointer thing in the error message is weird too.

Extracted from #7690 (comment).

@asterite
Copy link
Member

No, sorry. It works for Array because arrays are expanded to []= calls and the symbol is autocasted to Enum. But autocasting isn't applied to things inside other things, in this case things inside a tuple.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants