Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/passes/Unsubtyping.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -582,7 +582,10 @@ struct Unsubtyping : Pass {
}
if (auto desc = sub.getDescribedType()) {
if (auto superDesc = super.getDescribedType()) {
noteSubtype(*desc, *superDesc);
// We will be able to assume this once we fix the validation rules.
if (HeapType::isSubType(*desc, *superDesc)) {
noteSubtype(*desc, *superDesc);
}
}
}
}
Expand Down
19 changes: 19 additions & 0 deletions test/lit/passes/unsubtyping-desc.wast
Original file line number Diff line number Diff line change
Expand Up @@ -206,3 +206,22 @@
;; CHECK-NEXT: ))
(global $bot-mid (ref null $mid) (struct.new $bot (ref.null none)))
)

;; This will be invalid soon, but in the meantime we should not be confused when
;; the types described by two related descriptors are unrelated.
(module
(rec
;; CHECK: (rec
;; CHECK-NEXT: (type $A (descriptor $super (struct)))
(type $A (descriptor $super (struct)))
;; CHECK: (type $B (descriptor $sub (struct)))
(type $B (descriptor $sub (struct)))
;; CHECK: (type $super (sub (describes $A (struct))))
(type $super (sub (describes $A (struct))))
;; CHECK: (type $sub (sub $super (describes $B (struct))))
(type $sub (sub $super (describes $B (struct))))
)
;; CHECK: (global $public (ref null $B) (ref.null none))
(global $public (export "public") (ref null $B) (ref.null none))
)
;; CHECK: (export "public" (global $public))
Loading