File tree Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -223,8 +223,15 @@ struct SubtypingDiscoverer : public OverriddenVisitor<SubType> {
223223 void visitRefIsNull (RefIsNull* curr) {}
224224 void visitRefFunc (RefFunc* curr) {}
225225 void visitRefEq (RefEq* curr) {
226- self ()->noteNonFlowSubtype (curr->left , Type (HeapType::eq, Nullable));
227- self ()->noteNonFlowSubtype (curr->right , Type (HeapType::eq, Nullable));
226+ // Match the shareability of the current content (if it exists).
227+ // TODO: This could also allow both sides to flip.
228+ HeapType eq = HeapType::eq;
229+ if (curr->type != Type::unreachable) {
230+ eq = eq.getBasic (curr->left ->type .getHeapType ().getShared ());
231+ }
232+ auto type = Type (eq, Nullable);
233+ self ()->noteNonFlowSubtype (curr->left , type);
234+ self ()->noteNonFlowSubtype (curr->right , type);
228235 }
229236 void visitTableGet (TableGet* curr) {}
230237 void visitTableSet (TableSet* curr) {
You can’t perform that action at this time.
0 commit comments