Closed caterinaurban closed 7 years ago
From @mostafa-abdullah on August 2, 2017 7:34
The reason for this is that the type of self.aexp
in AssignmentStatement
is of type Aexp
, and method eval
in Aexp
returns an int.
This will be solved after merging the covariance/contravariance PR, because in this case the return type of eval
in Aexp
will be a supertype of the return type of any overriding method.
I tried the covariance/contravariace PR and it returns unsat
...
From @mostafa-abdullah on August 2, 2017 7:49
Yes it should give unsat because the return type of eval
in Aexp
is still int
.
Changing return 0
to return 1.0
will give sat
The program is perfectly correct, I do not think we should change it. The inference should just be able to infer type float
for eval
in Aexp
. We probably have a type equality somewhere where we should have a subtyping relation instead.
From @mostafa-abdullah on August 2, 2017 7:59
Done
This is fixed now after merging #7
Can you add a test file called issue02.py?
The program in this issue is already a subset of the test file imp.py
, which contains the correct checking for the type of the dict env
.
No, this is different because of the encoded imp program at the end of the file. I would like to have this as well.
From @caterinaurban on July 28, 2017 13:35
The type inferred for
env
in the following program is wrong:The type should be
Dict[str, float]
butDict[str, int]
is inferred instead.Copied from original issue: caterinaurban/Lyra#59