-
Notifications
You must be signed in to change notification settings - Fork 138
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
Find join of types, improve inference #61
Comments
Sorry if this is not related but something I observed and curious if this fixes that:
Currently, this gives a conflicting error and warning: Error: Warning: |
These errors are actually for two places. The first error The second warning is for the cast: So both the error and the warning are valid in this case. Here they have overlapped at the same place. If you break the second statement into two, the error/warning would look much more clear/sensible:. e.g: var temp = myDictionary as! {Int:AnyStruct} // warning goes here
myDictionary = temp; // error goes here The supertype calculation wouldn't change this behavior either. Supertype inferring only happens at the expression level. It wouldn't consider multiple statements for type infering. The least common supertype for |
Thanks @SupunS, actually it makes sense when separating into two. |
Context
Implement a function to return the least common supertype.
This improves type checking for:
See "Types and Programming Languages, 16.3 Joins and Meets"
In the following example
y
should be inferred toString?
:Definition of Done
The text was updated successfully, but these errors were encountered: