mirror of
https://github.com/roc-lang/roc.git
synced 2025-07-24 15:03:46 +00:00

Even if there are no changes to alias arguments, and no new variables were introduced, we may still need to unify the "actual types" of the alias or opaque! The unification is not necessary from a types perspective (and in fact, we may want to disable it for `roc check` later on), but it is necessary for the monomorphizer, which expects identical types to be reflected in the same variable. As a concrete example, consider the unification of two opaques P := [Zero, Succ P] (@P (Succ n)) ~ (@P (Succ o)) `P` has no arguments, and unification of the surface of `P` introduces nothing new. But if we do not unify the types of `n` and `o`, which are recursion variables, they will remain disjoint! Currently, the implication of this is that they will be seen to have separate recursive memory layouts in the monomorphizer - which is no good for our compilation model. Closes #3653
106 lines
3.5 KiB
Text
106 lines
3.5 KiB
Text
procedure Encode.22 (Encode.93):
|
|
ret Encode.93;
|
|
|
|
procedure Encode.23 (Encode.94, Encode.102, Encode.96):
|
|
let Encode.106 : List U8 = CallByName Json.65 Encode.94 Encode.96 Encode.102;
|
|
ret Encode.106;
|
|
|
|
procedure Encode.25 (Encode.100, Encode.101):
|
|
let Encode.104 : List U8 = Array [];
|
|
let Encode.105 : {Str} = CallByName Json.17 Encode.100;
|
|
let Encode.103 : List U8 = CallByName Encode.23 Encode.104 Encode.105 Encode.101;
|
|
ret Encode.103;
|
|
|
|
procedure Json.1 ():
|
|
let Json.106 : {} = Struct {};
|
|
ret Json.106;
|
|
|
|
procedure Json.17 (Json.64):
|
|
let Json.108 : {Str} = Struct {Json.64};
|
|
let Json.107 : {Str} = CallByName Encode.22 Json.108;
|
|
ret Json.107;
|
|
|
|
procedure Json.65 (Json.66, Json.109, #Attr.12):
|
|
let Json.64 : Str = StructAtIndex 0 #Attr.12;
|
|
inc Json.64;
|
|
dec #Attr.12;
|
|
let Json.118 : I32 = 34i64;
|
|
let Json.117 : U8 = CallByName Num.123 Json.118;
|
|
let Json.115 : List U8 = CallByName List.4 Json.66 Json.117;
|
|
let Json.116 : List U8 = CallByName Str.12 Json.64;
|
|
let Json.112 : List U8 = CallByName List.8 Json.115 Json.116;
|
|
let Json.114 : I32 = 34i64;
|
|
let Json.113 : U8 = CallByName Num.123 Json.114;
|
|
let Json.111 : List U8 = CallByName List.4 Json.112 Json.113;
|
|
ret Json.111;
|
|
|
|
procedure List.4 (List.101, List.102):
|
|
let List.392 : U64 = 1i64;
|
|
let List.391 : List U8 = CallByName List.70 List.101 List.392;
|
|
let List.390 : List U8 = CallByName List.71 List.391 List.102;
|
|
ret List.390;
|
|
|
|
procedure List.6 (#Attr.2):
|
|
let List.385 : U64 = lowlevel ListLen #Attr.2;
|
|
ret List.385;
|
|
|
|
procedure List.70 (#Attr.2, #Attr.3):
|
|
let List.395 : List U8 = lowlevel ListReserve #Attr.2 #Attr.3;
|
|
ret List.395;
|
|
|
|
procedure List.71 (#Attr.2, #Attr.3):
|
|
let List.394 : List U8 = lowlevel ListAppendUnsafe #Attr.2 #Attr.3;
|
|
ret List.394;
|
|
|
|
procedure List.8 (#Attr.2, #Attr.3):
|
|
let List.393 : List U8 = lowlevel ListConcat #Attr.2 #Attr.3;
|
|
ret List.393;
|
|
|
|
procedure Num.123 (#Attr.2):
|
|
let Num.258 : U8 = lowlevel NumIntCast #Attr.2;
|
|
ret Num.258;
|
|
|
|
procedure Str.12 (#Attr.2):
|
|
let Str.209 : List U8 = lowlevel StrToUtf8 #Attr.2;
|
|
ret Str.209;
|
|
|
|
procedure Str.48 (#Attr.2, #Attr.3, #Attr.4):
|
|
let Str.204 : {U64, Str, Int1, U8} = lowlevel StrFromUtf8Range #Attr.2 #Attr.3 #Attr.4;
|
|
ret Str.204;
|
|
|
|
procedure Str.9 (Str.69):
|
|
let Str.202 : U64 = 0i64;
|
|
let Str.203 : U64 = CallByName List.6 Str.69;
|
|
let Str.70 : {U64, Str, Int1, U8} = CallByName Str.48 Str.69 Str.202 Str.203;
|
|
let Str.199 : Int1 = StructAtIndex 2 Str.70;
|
|
if Str.199 then
|
|
let Str.201 : Str = StructAtIndex 1 Str.70;
|
|
inc Str.201;
|
|
dec Str.70;
|
|
let Str.200 : [C {U64, U8}, C Str] = TagId(1) Str.201;
|
|
ret Str.200;
|
|
else
|
|
let Str.197 : U8 = StructAtIndex 3 Str.70;
|
|
let Str.198 : U64 = StructAtIndex 0 Str.70;
|
|
dec Str.70;
|
|
let Str.196 : {U64, U8} = Struct {Str.198, Str.197};
|
|
let Str.195 : [C {U64, U8}, C Str] = TagId(0) Str.196;
|
|
ret Str.195;
|
|
|
|
procedure Test.0 ():
|
|
let Test.9 : Str = "abc";
|
|
let Test.10 : {} = CallByName Json.1;
|
|
let Test.8 : List U8 = CallByName Encode.25 Test.9 Test.10;
|
|
let Test.1 : [C {U64, U8}, C Str] = CallByName Str.9 Test.8;
|
|
let Test.5 : U8 = 1i64;
|
|
let Test.6 : U8 = GetTagId Test.1;
|
|
let Test.7 : Int1 = lowlevel Eq Test.5 Test.6;
|
|
if Test.7 then
|
|
let Test.2 : Str = UnionAtIndex (Id 1) (Index 0) Test.1;
|
|
inc Test.2;
|
|
dec Test.1;
|
|
ret Test.2;
|
|
else
|
|
dec Test.1;
|
|
let Test.4 : Str = "<bad>";
|
|
ret Test.4;
|