File tree Expand file tree Collapse file tree 2 files changed +43
-1
lines changed Expand file tree Collapse file tree 2 files changed +43
-1
lines changed Original file line number Diff line number Diff line change @@ -249,7 +249,13 @@ struct SubtypingDiscoverer : public OverriddenVisitor<SubType> {
249249 self ()->noteSubtype (body, curr);
250250 }
251251 }
252- void visitTryTable (TryTable* curr) { self ()->noteSubtype (curr->body , curr); }
252+ void visitTryTable (TryTable* curr) {
253+ self ()->noteSubtype (curr->body , curr);
254+ for (Index i = 0 ; i < curr->catchTags .size (); i++) {
255+ self ()->noteSubtype (curr->sentTypes [i],
256+ self ()->findBreakTarget (curr->catchDests [i]));
257+ }
258+ }
253259 void visitThrow (Throw* curr) {
254260 Type params = self ()->getModule ()->getTag (curr->tag )->sig .params ;
255261 assert (params.size () == curr->operands .size ());
Original file line number Diff line number Diff line change 17791779 )
17801780 )
17811781)
1782+
1783+ ;; try_table
1784+ (module
1785+ (rec
1786+ ;; CHECK: (rec
1787+ ;; CHECK-NEXT: (type $super (sub (func)))
1788+ (type $super (sub (func )))
1789+ ;; CHECK: (type $sub (sub $super (func)))
1790+ (type $sub (sub $super (func )))
1791+ )
1792+
1793+ ;; CHECK: (type $2 (func (result (ref $super))))
1794+
1795+ ;; CHECK: (type $3 (func (param (ref $sub))))
1796+
1797+ ;; CHECK: (type $4 (func (param (ref $sub))))
1798+
1799+ ;; CHECK: (tag $tag (param (ref $sub)))
1800+ (tag $tag (param (ref $sub )))
1801+
1802+ ;; CHECK: (func $test (type $2) (result (ref $super))
1803+ ;; CHECK-NEXT: (block $label (result (ref $sub))
1804+ ;; CHECK-NEXT: (try_table (catch $tag $label)
1805+ ;; CHECK-NEXT: (unreachable)
1806+ ;; CHECK-NEXT: )
1807+ ;; CHECK-NEXT: )
1808+ ;; CHECK-NEXT: )
1809+ (func $test (result (ref $super ))
1810+ (block $label (result (ref $super ))
1811+ ;; Sending the contents of $tag to $label cause us to require $sub <: $super
1812+ (try_table (catch $tag $label )
1813+ (unreachable )
1814+ )
1815+ )
1816+ )
1817+ )
You can’t perform that action at this time.
0 commit comments