Skip to content

Commit 7e6d093

Browse files
committed
missing super call
1 parent 2dde94d commit 7e6d093

2 files changed

Lines changed: 30 additions & 0 deletions

File tree

src/passes/Unsubtyping.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -636,6 +636,7 @@ struct Unsubtyping : Pass {
636636
info.descriptors.insert({*desc, type});
637637
}
638638
void visitRefGetDesc(RefGetDesc* curr) {
639+
Super::visitRefGetDesc(curr);
639640
if (!curr->ref->type.isStruct()) {
640641
return;
641642
}
@@ -656,6 +657,7 @@ struct Unsubtyping : Pass {
656657
noteDescriptor(curr->desc->type.getHeapType());
657658
}
658659
void visitStructNew(StructNew* curr) {
660+
Super::visitStructNew(curr);
659661
if (curr->type == Type::unreachable || !curr->desc) {
660662
return;
661663
}

test/lit/passes/unsubtyping.wast

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1892,3 +1892,31 @@
18921892
)
18931893
)
18941894
)
1895+
1896+
;; Even though our analysis has its own visitor for StructNew, it should still
1897+
;; be able to collect subtype constraints from StructNews.
1898+
(module
1899+
;; CHECK: (rec
1900+
;; CHECK-NEXT: (type $A (sub (struct (field (ref null $A)))))
1901+
(type $A (sub (struct (field (ref null $A)))))
1902+
;; CHECK: (type $B (sub $A (struct (field (ref null $A)))))
1903+
(type $B (sub $A (struct (field (ref null $A)))))
1904+
1905+
;; CHECK: (type $2 (func (param (ref null $B))))
1906+
1907+
;; CHECK: (func $test (type $2) (param $B (ref null $B))
1908+
;; CHECK-NEXT: (drop
1909+
;; CHECK-NEXT: (struct.new $A
1910+
;; CHECK-NEXT: (local.get $B)
1911+
;; CHECK-NEXT: )
1912+
;; CHECK-NEXT: )
1913+
;; CHECK-NEXT: )
1914+
(func $test (param $B (ref null $B))
1915+
(drop
1916+
;; This requires B <: A.
1917+
(struct.new $A
1918+
(local.get $B)
1919+
)
1920+
)
1921+
)
1922+
)

0 commit comments

Comments
 (0)