-
Notifications
You must be signed in to change notification settings - Fork 35
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
Types are pushed into operators incorrectly #72
Comments
A problem is that inferring the type using |
More type inference can be done using |
Thanks for the thorough analysis. I suspect that there are a few similar problems lurking in the code. The solution might be to compute the greatest lower bound of the result type and
Note that the glb-operator would be a partial operation and if it doesn't find a lower bound it would result in a type error. Your thoughts on this solution, @UlfNorell? EDIT: The glb-operator would technically not be partial, as it can always return |
I think this makes sense, although you can construct examples where one could argue that the "right" thing to do is not failing on -spec much_type_very_code(none()) -> none().
much_type_very_code(X) -> X + X. |
Yes, there would have to be a special case for when the result is expected to be |
First step for josefs#72. Currently handles numeric types and not much else.
See josefs#72 Changes the typing rules for 'andalso' and 'orelse' to: ``` A : boolean() B : Ty --- A andalso B : boolean() | Ty ``` Whether this is the right choice can be discussed.
First step for josefs#72. Currently handles numeric types and not much else.
See josefs#72 Changes the typing rules for 'andalso' and 'orelse' to: ``` A : boolean() B : Ty --- A andalso B : boolean() | Ty ``` Whether this is the right choice can be discussed.
First step for #72. Currently handles numeric types and not much else.
See #72 Changes the typing rules for 'andalso' and 'orelse' to: ``` A : boolean() B : Ty --- A andalso B : boolean() | Ty ``` Whether this is the right choice can be discussed.
Forgot to tag any of the commits with a "fix" message. |
First step for josefs#72. Currently handles numeric types and not much else.
See josefs#72 Changes the typing rules for 'andalso' and 'orelse' to: ``` A : boolean() B : Ty --- A andalso B : boolean() | Ty ``` Whether this is the right choice can be discussed.
Currently the rules for pushing types into arithmetic operator applications in
type_check_arith_op_in
says (the other operator rules are similar):This subtype constraint goes the wrong way, as shown in this example:
The error message is a bit strange as well, since it's the
subtype(R, number)
constraint that fails and not anything to do with the arguments.The reason for having the subtyping this way around (I suspect) is to make this fail:
I believe the correct rule is
The text was updated successfully, but these errors were encountered: