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

ambiguous call matches both Int8 and Int16 #6601

Closed
straight-shoota opened this issue Aug 24, 2018 · 0 comments · Fixed by #6618
Closed

ambiguous call matches both Int8 and Int16 #6601

straight-shoota opened this issue Aug 24, 2018 · 0 comments · Fixed by #6618
Labels
kind:bug A bug in the code. Does not apply to documentation, specs, etc. topic:compiler

Comments

@straight-shoota
Copy link
Member

The following code errors:

a = 1 || "foo"
a + 2 # instantiating '(Int32 | String)#+(Int32)':  ambiguous call matches both Int8 and Int16

It's odd that this mentions Int8 and Int16 which are not even used explicitly in this example. I guess it's because when the literal type is expanded it first notices that these could be ambiguous. It should definitely not compile because String#+ doesn't accept any integer, but the error message is wrong.

Even if the integer literals are typed explicitly, the error is similar:

a = 1_i32 || "foo"
a + 2_i32 # instantiating '(Int32 | String)#+(Int32)': ambiguous call matches both Int8 and Int16

The expected error should be something like no overload matches '(Int32 | String)#+' with type Int32.

Extracted from #6593

Introduced by #6074

@asterite asterite added kind:bug A bug in the code. Does not apply to documentation, specs, etc. topic:compiler labels Aug 25, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind:bug A bug in the code. Does not apply to documentation, specs, etc. topic:compiler
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants