You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
While looking at #11391 I noticed that there's some chaos in operators.ml with regards to with_type. In particular, type_binop2 currently receives only one expected type, but it should really be two: one for the typing of the rhs and one for the typing of the resulting binop.
Will try to construct a failing example.
The text was updated successfully, but these errors were encountered:
I don't think there's a failing example here because with_type isn't actually used beyond that point.
Another problem is that we type the lhs of assignments with the expected type of the whole binop. This isn't always correct which can easily be seen at block-level:
functionmain() {
vara:Int;
$type(a, _) =0;
}
This prints Warning : Int (expected: NoValue), which is wrong because we clearly want a value to assign to.
source/Main.hx:4: characters 8-9 : Warning : Int (expected: NoValue)
source/Main.hx:4: characters 22-23 : Warning : Int (expected: WithType(Int, None))
While it's true that the result of b = 0 can be expected to be of type Int, that doesn't necessarily mean that b itself can be expected to be of type Int. This is more obvious when we look at it as a = (b = 0).
While looking at #11391 I noticed that there's some chaos in operators.ml with regards to
with_type
. In particular,type_binop2
currently receives only one expected type, but it should really be two: one for the typing of the rhs and one for the typing of the resulting binop.Will try to construct a failing example.
The text was updated successfully, but these errors were encountered: