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
When a node is replaced by a different node during type inference, and the replacement node is then involved in an error condition (such as a type error), the erroneous node is kept in the tree, rather than being replaced by an invalid node, as it should.
For example, consider this program (with set literals enabled):
List<int> top = {};
main() {
List<int> local = {};
top = {};
local = {};
print(top);
print(local);
}
The initializer of the local variable gets correctly replaced by an invalid node, but all of the other three assignments keep the set literal.
This issue causes the front-end test strong/inference/infer_from_complex_expressions_if_outer_most_value_is_precise to fail, as it is expecting the invalid node.
The text was updated successfully, but these errors were encountered:
This is a basic flaw in the Kernel shadow nodes. They have apparent "children" that are not really children of the shadow node in the sense the the child's parent pointer is the shadow node. Once we begin doing parent-based rewriting of the tree during type inference, we cannot safely use these shadow node "children" because they are stale.
// Do not use rhs after this point because it may be a Shadow node// that has been replaced in the tree with its desugaring.
There should be an identical comment just before this line:
// Do not use rhs after this point because it may be a Shadow node// that has been replaced in the tree with its desugaring.var replacedRhs = inferrer.ensureAssignable(
writeContext, rhsType, rhs, writeOffset,
isVoidAllowed: writeContext isVoidType);
_storeLetType(inferrer, replacedRhs ?? rhs, rhsType);
where the problem is that there are two occurrences of rhs after that.
When a node is replaced by a different node during type inference, and the replacement node is then involved in an error condition (such as a type error), the erroneous node is kept in the tree, rather than being replaced by an invalid node, as it should.
For example, consider this program (with set literals enabled):
The initializer of the local variable gets correctly replaced by an invalid node, but all of the other three assignments keep the set literal.
This issue causes the front-end test
strong/inference/infer_from_complex_expressions_if_outer_most_value_is_precise
to fail, as it is expecting the invalid node.The text was updated successfully, but these errors were encountered: