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

Reassigning Fn #355

Open
yhara opened this issue Jun 9, 2022 · 0 comments
Open

Reassigning Fn #355

yhara opened this issue Jun 9, 2022 · 0 comments
Labels
error check Missing error checks (invalid codes that won't be warned during compilation)

Comments

@yhara
Copy link
Collaborator

yhara commented Jun 9, 2022

Example

var x = fn(){ 1 }
p x() + 1
x = fn(){ "a" }
p x() + "b"

Result

Error: the argument other' of Int#+' should be Int but got String

Expected

  1. Type of x is inferred as Fn0<Object> which is the nearest common supertype of Fn0<Int> and Fn0<String>
  2. Therefore x() + 1 is typeerror
@yhara yhara added the error check Missing error checks (invalid codes that won't be warned during compilation) label Jun 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
error check Missing error checks (invalid codes that won't be warned during compilation)
Projects
None yet
Development

No branches or pull requests

1 participant