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

Improve type error for invalid varargs argument #263

Open
kengorab opened this issue Jan 11, 2021 · 0 comments
Open

Improve type error for invalid varargs argument #263

kengorab opened this issue Jan 11, 2021 · 0 comments
Labels
enhancement New feature or request

Comments

@kengorab
Copy link
Owner

Right now, varargs are typechecked as an Array, so the following code produces the following type error:

val arr = [1, 2, 3]
arr.push(4, 5, "6")
Type mismatch: (4:13)
  |  arr.push(4, 5, "6")
                 ^
Expected Int[], got String | Int[]

However, I'd expect the error that's raised to not have anything to do with arrays, since the user hasn't done anything with arrays. The error I'd expect to see is more like this:

Type mismatch: (4:13)
  |  arr.push(4, 5, "6")
                    ^^^
Expected Int, got String
@kengorab kengorab added the enhancement New feature or request label Jan 11, 2021
@kengorab kengorab added this to To Do: Core in Language Core Jan 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Language Core
To Do: Core
Development

No branches or pull requests

1 participant