|
591 | 591 | ) |
592 | 592 | ) |
593 | 593 |
|
| 594 | +(module |
| 595 | + ;; CHECK: (rec |
| 596 | + ;; CHECK-NEXT: (type $super (sub (func))) |
| 597 | + (type $super (sub (func))) |
| 598 | + ;; CHECK: (type $sub (sub $super (func))) |
| 599 | + (type $sub (sub $super (func))) |
| 600 | + ;; CHECK: (type $cont-super (sub (cont $super))) |
| 601 | + (type $cont-super (sub (cont $super))) |
| 602 | + ;; CHECK: (type $cont-sub (sub $cont-super (cont $sub))) |
| 603 | + (type $cont-sub (sub $cont-super (cont $sub))) |
| 604 | + |
| 605 | + ;; CHECK: (type $4 (func (param (ref $cont-sub)) (result (ref $cont-super)))) |
| 606 | + |
| 607 | + ;; CHECK: (func $cont-new (type $4) (param $sub (ref $cont-sub)) (result (ref $cont-super)) |
| 608 | + ;; CHECK-NEXT: (local.get $sub) |
| 609 | + ;; CHECK-NEXT: ) |
| 610 | + (func $cont-new (param $sub (ref $cont-sub)) (result (ref $cont-super)) |
| 611 | + ;; This requires $cont-sub <: $cont-super and $sub <: $super. |
| 612 | + (local.get $sub) |
| 613 | + ) |
| 614 | +) |
| 615 | + |
| 616 | +(module |
| 617 | + ;; CHECK: (rec |
| 618 | + ;; CHECK-NEXT: (type $super (sub (func))) |
| 619 | + (type $super (sub (func))) |
| 620 | + ;; CHECK: (type $sub (sub (func))) |
| 621 | + (type $sub (sub $super (func))) |
| 622 | + ;; CHECK: (type $cont-super (sub (cont $super))) |
| 623 | + (type $cont-super (sub (cont $super))) |
| 624 | + ;; CHECK: (type $cont-sub (sub (cont $sub))) |
| 625 | + (type $cont-sub (sub $cont-super (cont $sub))) |
| 626 | + |
| 627 | + ;; CHECK: (type $4 (func (param (ref $cont-sub)) (result (ref $cont-sub)))) |
| 628 | + |
| 629 | + ;; CHECK: (func $cont-new (type $4) (param $sub (ref $cont-sub)) (result (ref $cont-sub)) |
| 630 | + ;; CHECK-NEXT: (local $keepalive (ref $cont-super)) |
| 631 | + ;; CHECK-NEXT: (local.get $sub) |
| 632 | + ;; CHECK-NEXT: ) |
| 633 | + (func $cont-new (param $sub (ref $cont-sub)) (result (ref $cont-sub)) |
| 634 | + (local $keepalive (ref $cont-super)) |
| 635 | + ;; As above, but now we return the subtype, so there is no constraint. We |
| 636 | + ;; can unsubtype both the continuations and the funcs. |
| 637 | + (local.get $sub) |
| 638 | + ) |
| 639 | +) |
| 640 | + |
0 commit comments