Correct pattern matching of nullable wrapped tag unions

The nullable ID always has zero tags. For everything else, we should
just match with the arity of the number of arguments, which doesn't
include the tag ID.
This commit is contained in:
Ayaz Hafiz 2022-12-29 12:22:05 -06:00
parent d59b137f45
commit 3aab378bab
No known key found for this signature in database
GPG key ID: 0E2A37416A25EF58
3 changed files with 70 additions and 23 deletions

View file

@ -0,0 +1,36 @@
procedure Str.3 (#Attr.2, #Attr.3):
let Str.266 : Str = lowlevel StrConcat #Attr.2 #Attr.3;
ret Str.266;
procedure Test.2 (Test.4):
let Test.16 : U8 = GetTagId Test.4;
switch Test.16:
case 0:
let Test.13 : Str = "A";
ret Test.13;
case 1:
let Test.14 : Str = "B";
ret Test.14;
default:
let Test.15 : Str = "C";
ret Test.15;
procedure Test.0 ():
let Test.21 : [<rnw>C *self, <null>, C ] = TagId(1) ;
let Test.20 : [<rnw>C *self, <null>, C ] = TagId(0) Test.21;
let Test.17 : Str = CallByName Test.2 Test.20;
dec Test.20;
let Test.19 : [<rnw>C *self, <null>, C ] = TagId(1) ;
let Test.18 : Str = CallByName Test.2 Test.19;
dec Test.19;
let Test.10 : Str = CallByName Str.3 Test.17 Test.18;
dec Test.18;
let Test.12 : [<rnw>C *self, <null>, C ] = TagId(2) ;
let Test.11 : Str = CallByName Test.2 Test.12;
dec Test.12;
let Test.9 : Str = CallByName Str.3 Test.10 Test.11;
dec Test.11;
ret Test.9;