diff --git a/compiler/shared/test/diff/LambLift.mls b/compiler/shared/test/diff/LambLift.mls index b345cbf0a..bbfea08e3 100644 --- a/compiler/shared/test/diff/LambLift.mls +++ b/compiler/shared/test/diff/LambLift.mls @@ -10,7 +10,7 @@ fun foo() = local(1) foo() //│ Parsed: -//│ TypingUnit(NuFunDef(None, foo, N, Nil, L(Lam(Tup(), Blk(NuFunDef(Some(false), local, N, Nil, L(Lam(Tup((N, Var("x"))), Blk(NuTypeDef(Cls, TypeName("Foo"), Ls(), N, N, N, Ls(), N, N, TypingUnit(NuFunDef(None, bar, N, Nil, L(App(Var("+"), Tup((N, Var("x")), (N, App(Var("foo"), Tup())))))))), Sel(Bra(rcd = false, App(NuNew(Var("Foo")), Tup())), bar))))), App(Var("local"), Tup((N, IntLit(1)))))))), App(Var("foo"), Tup())) +//│ TypingUnit(List(NuFunDef(None,Var(foo),None,List(),Left(Lam(Tup(List()),Blk(List(NuFunDef(Some(false),Var(local),None,List(),Left(Lam(Tup(List((None,Fld(FldFlags(false,false,false),Var(x))))),Blk(List(NuTypeDef(Cls,TypeName(Foo),List(),None,None,None,List(),None,None,TypingUnit(List(NuFunDef(None,Var(bar),None,List(),Left(App(Var(+),Tup(List((None,Fld(FldFlags(false,false,false),Var(x))), (None,Fld(FldFlags(false,false,false),App(Var(foo),Tup(List())))))))))))), Sel(Bra(false,App(NuNew(Var(Foo)),Tup(List()))),Var(bar))))))), App(Var(local),Tup(List((None,Fld(FldFlags(false,false,false),IntLit(1))))))))))), App(Var(foo),Tup(List())))) //│ Lifted: //│ TypingUnit { //│ class Foo$1([x,]) {fun bar = () => +((this).x, foo$1(),)} @@ -28,7 +28,7 @@ fun foo(f) = f(1) foo(x => x+1) //│ Parsed: -//│ TypingUnit(NuFunDef(None, foo, N, Nil, L(Lam(Tup((N, Var("f"))), Blk(App(Var("f"), Tup((N, IntLit(1)))))))), App(Var("foo"), Tup((N, Lam(Tup((N, Var("x"))), App(Var("+"), Tup((N, Var("x")), (N, IntLit(1))))))))) +//│ TypingUnit(List(NuFunDef(None,Var(foo),None,List(),Left(Lam(Tup(List((None,Fld(FldFlags(false,false,false),Var(f))))),Blk(List(App(Var(f),Tup(List((None,Fld(FldFlags(false,false,false),IntLit(1))))))))))), App(Var(foo),Tup(List((None,Fld(FldFlags(false,false,false),Lam(Tup(List((None,Fld(FldFlags(false,false,false),Var(x))))),App(Var(+),Tup(List((None,Fld(FldFlags(false,false,false),Var(x))), (None,Fld(FldFlags(false,false,false),IntLit(1)))))))))))))) //│ Lifted: //│ TypingUnit { //│ class Lambda1$2$1([]) {fun apply = (x,) => +(x, 1,)} @@ -46,7 +46,7 @@ fun foo(x) = bar(y => y+x) foo(1) //│ Parsed: -//│ TypingUnit(NuFunDef(None, foo, N, Nil, L(Lam(Tup((N, Var("x"))), Blk(NuFunDef(Some(false), bar, N, Nil, L(Lam(Tup((N, Var("f"))), Blk(App(Var("f"), Tup((N, Var("x")))))))), App(Var("bar"), Tup((N, Lam(Tup((N, Var("y"))), App(Var("+"), Tup((N, Var("y")), (N, Var("x")))))))))))), App(Var("foo"), Tup((N, IntLit(1))))) +//│ TypingUnit(List(NuFunDef(None,Var(foo),None,List(),Left(Lam(Tup(List((None,Fld(FldFlags(false,false,false),Var(x))))),Blk(List(NuFunDef(Some(false),Var(bar),None,List(),Left(Lam(Tup(List((None,Fld(FldFlags(false,false,false),Var(f))))),Blk(List(App(Var(f),Tup(List((None,Fld(FldFlags(false,false,false),Var(x))))))))))), App(Var(bar),Tup(List((None,Fld(FldFlags(false,false,false),Lam(Tup(List((None,Fld(FldFlags(false,false,false),Var(y))))),App(Var(+),Tup(List((None,Fld(FldFlags(false,false,false),Var(y))), (None,Fld(FldFlags(false,false,false),Var(x))))))))))))))))), App(Var(foo),Tup(List((None,Fld(FldFlags(false,false,false),IntLit(1)))))))) //│ Lifted: //│ TypingUnit { //│ class Lambda1$3$1([x,]) {fun apply = (y,) => +(y, (this).x,)} @@ -68,7 +68,7 @@ fun app(a) = foo(z => a.bar(z)) app(new A(1)) //│ Parsed: -//│ TypingUnit(NuFunDef(None, foo, N, Nil, L(Lam(Tup((N, Var("f"))), Blk(App(Var("f"), Tup((N, IntLit(1)))))))), NuTypeDef(Cls, TypeName("A"), Ls(), S(Tup((S(Var("y")), Var("Int")))), N, N, Ls(), N, N, TypingUnit(NuFunDef(None, bar, N, Nil, L(Lam(Tup((N, Var("z"))), App(Var("+"), Tup((N, Var("y")), (N, Var("z"))))))))), NuFunDef(None, app, N, Nil, L(Lam(Tup((N, Var("a"))), Blk(App(Var("foo"), Tup((N, Lam(Tup((N, Var("z"))), App(Sel(Var("a"), bar), Tup((N, Var("z")))))))))))), App(Var("app"), Tup((N, App(NuNew(Var("A")), Tup((N, IntLit(1)))))))) +//│ TypingUnit(List(NuFunDef(None,Var(foo),None,List(),Left(Lam(Tup(List((None,Fld(FldFlags(false,false,false),Var(f))))),Blk(List(App(Var(f),Tup(List((None,Fld(FldFlags(false,false,false),IntLit(1))))))))))), NuTypeDef(Cls,TypeName(A),List(),Some(Tup(List((Some(Var(y)),Fld(FldFlags(false,false,false),Var(Int)))))),None,None,List(),None,None,TypingUnit(List(NuFunDef(None,Var(bar),None,List(),Left(Lam(Tup(List((None,Fld(FldFlags(false,false,false),Var(z))))),App(Var(+),Tup(List((None,Fld(FldFlags(false,false,false),Var(y))), (None,Fld(FldFlags(false,false,false),Var(z)))))))))))), NuFunDef(None,Var(app),None,List(),Left(Lam(Tup(List((None,Fld(FldFlags(false,false,false),Var(a))))),Blk(List(App(Var(foo),Tup(List((None,Fld(FldFlags(false,false,false),Lam(Tup(List((None,Fld(FldFlags(false,false,false),Var(z))))),App(Sel(Var(a),Var(bar)),Tup(List((None,Fld(FldFlags(false,false,false),Var(z))))))))))))))))), App(Var(app),Tup(List((None,Fld(FldFlags(false,false,false),App(NuNew(Var(A)),Tup(List((None,Fld(FldFlags(false,false,false),IntLit(1))))))))))))) //│ Lifted: //│ TypingUnit { //│ class A$1([y: Int,]) {fun bar = (z,) => +((this).y, z,)} diff --git a/compiler/shared/test/diff/LiftType.mls b/compiler/shared/test/diff/LiftType.mls index 183dc1a6b..0d8ea8eaf 100644 --- a/compiler/shared/test/diff/LiftType.mls +++ b/compiler/shared/test/diff/LiftType.mls @@ -8,7 +8,7 @@ class CTX{ //│ |#class| |CTX|{|→|#class| |A| |{||}|↵|#fun| |foo|(|f|#:| |A| |#=>| |A|)|#:| |(|A| |#=>| |A|)| |#=>| |A| |#=| |f|(|#new| |A|)|←|↵|}| //│ Parsed: {class CTX {class A {}; fun foo = (f: (A,) => A,) => f(new A,) : (A -> A) -> A}} //│ Parsed: -//│ TypingUnit(NuTypeDef(Cls, TypeName("CTX"), Ls(), N, N, N, Ls(), N, N, TypingUnit(NuTypeDef(Cls, TypeName("A"), Ls(), N, N, N, Ls(), N, N, TypingUnit()), NuFunDef(None, foo, N, Nil, L(Lam(Tup((S(Var("f")), Lam(Tup((N, Var("A"))), Var("A")))), Asc(App(Var("f"), Tup((N, NuNew(Var("A"))))), Function(Tuple(N -> Fld(N, Function(Tuple(N -> Fld(N, TypeName("A"))), TypeName("A")))), TypeName("A"))))))))) +//│ TypingUnit(List(NuTypeDef(Cls,TypeName(CTX),List(),None,None,None,List(),None,None,TypingUnit(List(NuTypeDef(Cls,TypeName(A),List(),None,None,None,List(),None,None,TypingUnit(List())), NuFunDef(None,Var(foo),None,List(),Left(Lam(Tup(List((Some(Var(f)),Fld(FldFlags(false,false,false),Lam(Tup(List((None,Fld(FldFlags(false,false,false),Var(A))))),Var(A)))))),Asc(App(Var(f),Tup(List((None,Fld(FldFlags(false,false,false),NuNew(Var(A))))))),Function(Tuple(List((None,Field(None,Function(Tuple(List((None,Field(None,TypeName(A))))),TypeName(A)))))),TypeName(A))))))))))) //│ Lifted: //│ TypingUnit { //│ class CTX$1_A$2([par$CTX$1,]) {} @@ -26,7 +26,7 @@ class CTX(x, y){ //│ |#class| |CTX|(|x|,| |y|)|{|→|#class| |A|{| |#fun| |foo| |#=| |x|}|↵|#class| |B|#:| |A| |{| |#fun| |foo| |#=| |y|}|↵|#fun| |foo|(|any|#:| |[|A|,| |B|]|)|#:| |[|B|,| |A|]| |#=| |[|any|._2|,| |any|._1|]|←|↵|}| //│ Parsed: {class CTX(x, y,) {class A {fun foo = x}; class B: A {fun foo = y}; fun foo = (any: [A, B,],) => [(any)._2, (any)._1,] : [B, A]}} //│ Parsed: -//│ TypingUnit(NuTypeDef(Cls, TypeName("CTX"), Ls(), S(Tup((N, Var("x")), (N, Var("y")))), N, N, Ls(), N, N, TypingUnit(NuTypeDef(Cls, TypeName("A"), Ls(), N, N, N, Ls(), N, N, TypingUnit(NuFunDef(None, foo, N, Nil, L(Var("x"))))), NuTypeDef(Cls, TypeName("B"), Ls(), N, N, S(TypeName("A")), Ls(), N, N, TypingUnit(NuFunDef(None, foo, N, Nil, L(Var("y"))))), NuFunDef(None, foo, N, Nil, L(Lam(Tup((S(Var("any")), Tup((N, Var("A")), (N, Var("B"))))), Asc(Tup((N, Sel(Var("any"), _2)), (N, Sel(Var("any"), _1))), Tuple(N -> Fld(N, TypeName("B")), N -> Fld(N, TypeName("A")))))))))) +//│ TypingUnit(List(NuTypeDef(Cls,TypeName(CTX),List(),Some(Tup(List((None,Fld(FldFlags(false,false,false),Var(x))), (None,Fld(FldFlags(false,false,false),Var(y)))))),None,None,List(),None,None,TypingUnit(List(NuTypeDef(Cls,TypeName(A),List(),None,None,None,List(),None,None,TypingUnit(List(NuFunDef(None,Var(foo),None,List(),Left(Var(x)))))), NuTypeDef(Cls,TypeName(B),List(),None,None,Some(TypeName(A)),List(),None,None,TypingUnit(List(NuFunDef(None,Var(foo),None,List(),Left(Var(y)))))), NuFunDef(None,Var(foo),None,List(),Left(Lam(Tup(List((Some(Var(any)),Fld(FldFlags(false,false,false),Tup(List((None,Fld(FldFlags(false,false,false),Var(A))), (None,Fld(FldFlags(false,false,false),Var(B))))))))),Asc(Tup(List((None,Fld(FldFlags(false,false,false),Sel(Var(any),Var(_2)))), (None,Fld(FldFlags(false,false,false),Sel(Var(any),Var(_1)))))),Tuple(List((None,Field(None,TypeName(B))), (None,Field(None,TypeName(A)))))))))))))) //│ Lifted: //│ TypingUnit { //│ class CTX$1_A$2([par$CTX$1,]) {fun foo = () => ((this).par$CTX$1).x} @@ -45,7 +45,7 @@ class CTX(x, y){ //│ |#class| |CTX|(|x|,| |y|)|{|→|#class| |A|{| |#fun| |foo| |#=| |x|}|↵|#class| |B|#:| |A| |{| |#fun| |foo| |#=| |y|}|↵|#fun| |foo|(|any|#:| |{|p1|#:| |A|,| |p2|#:| |B|}|)|#:| |[|B|,| |A|]| |#=| |[|any|.p2|,| |any|.p1|]|←|↵|}| //│ Parsed: {class CTX(x, y,) {class A {fun foo = x}; class B: A {fun foo = y}; fun foo = (any: '{' {p1: A, p2: B} '}',) => [(any).p2, (any).p1,] : [B, A]}} //│ Parsed: -//│ TypingUnit(NuTypeDef(Cls, TypeName("CTX"), Ls(), S(Tup((N, Var("x")), (N, Var("y")))), N, N, Ls(), N, N, TypingUnit(NuTypeDef(Cls, TypeName("A"), Ls(), N, N, N, Ls(), N, N, TypingUnit(NuFunDef(None, foo, N, Nil, L(Var("x"))))), NuTypeDef(Cls, TypeName("B"), Ls(), N, N, S(TypeName("A")), Ls(), N, N, TypingUnit(NuFunDef(None, foo, N, Nil, L(Var("y"))))), NuFunDef(None, foo, N, Nil, L(Lam(Tup((S(Var("any")), Bra(rcd = true, Rcd(Var("p1") = Var("A"), Var("p2") = Var("B"))))), Asc(Tup((N, Sel(Var("any"), p2)), (N, Sel(Var("any"), p1))), Tuple(N -> Fld(N, TypeName("B")), N -> Fld(N, TypeName("A")))))))))) +//│ TypingUnit(List(NuTypeDef(Cls,TypeName(CTX),List(),Some(Tup(List((None,Fld(FldFlags(false,false,false),Var(x))), (None,Fld(FldFlags(false,false,false),Var(y)))))),None,None,List(),None,None,TypingUnit(List(NuTypeDef(Cls,TypeName(A),List(),None,None,None,List(),None,None,TypingUnit(List(NuFunDef(None,Var(foo),None,List(),Left(Var(x)))))), NuTypeDef(Cls,TypeName(B),List(),None,None,Some(TypeName(A)),List(),None,None,TypingUnit(List(NuFunDef(None,Var(foo),None,List(),Left(Var(y)))))), NuFunDef(None,Var(foo),None,List(),Left(Lam(Tup(List((Some(Var(any)),Fld(FldFlags(false,false,false),Bra(true,Rcd(List((Var(p1),Fld(FldFlags(false,false,false),Var(A))), (Var(p2),Fld(FldFlags(false,false,false),Var(B)))))))))),Asc(Tup(List((None,Fld(FldFlags(false,false,false),Sel(Var(any),Var(p2)))), (None,Fld(FldFlags(false,false,false),Sel(Var(any),Var(p1)))))),Tuple(List((None,Field(None,TypeName(B))), (None,Field(None,TypeName(A)))))))))))))) //│ Lifted: //│ TypingUnit { //│ class CTX$1_A$2([par$CTX$1,]) {fun foo = () => ((this).par$CTX$1).x} @@ -64,7 +64,7 @@ class CTX(x, y){ //│ |#class| |CTX|(|x|,| |y|)|{|→|#class| |A|{| |#fun| |foo| |#=| |x|}|↵|#class| |B|‹|T|›| |{| |#fun| |foo| |#=| |y|}|↵|#fun| |foo|(|any|#:| |[|A|,| |B|‹|A|›|]|)|#:| |[|[|B|‹|A|›|,| |A|]|,| |A|]| |#=| |[|any|,| |any|._1|]|←|↵|}| //│ Parsed: {class CTX(x, y,) {class A {fun foo = x}; class B‹T› {fun foo = y}; fun foo = (any: [A, B‹A›,],) => [any, (any)._1,] : [[B[A], A], A]}} //│ Parsed: -//│ TypingUnit(NuTypeDef(Cls, TypeName("CTX"), Ls(), S(Tup((N, Var("x")), (N, Var("y")))), N, N, Ls(), N, N, TypingUnit(NuTypeDef(Cls, TypeName("A"), Ls(), N, N, N, Ls(), N, N, TypingUnit(NuFunDef(None, foo, N, Nil, L(Var("x"))))), NuTypeDef(Cls, TypeName("B"), Ls(N -> TypeName("T")), N, N, N, Ls(), N, N, TypingUnit(NuFunDef(None, foo, N, Nil, L(Var("y"))))), NuFunDef(None, foo, N, Nil, L(Lam(Tup((S(Var("any")), Tup((N, Var("A")), (N, TyApp(Var("B"), List(TypeName(A))))))), Asc(Tup((N, Var("any")), (N, Sel(Var("any"), _1))), Tuple(N -> Fld(N, Tuple(N -> Fld(N, AppliedType(TypeName("B"), TypeName("A") :: Nil)), N -> Fld(N, TypeName("A")))), N -> Fld(N, TypeName("A")))))))))) +//│ TypingUnit(List(NuTypeDef(Cls,TypeName(CTX),List(),Some(Tup(List((None,Fld(FldFlags(false,false,false),Var(x))), (None,Fld(FldFlags(false,false,false),Var(y)))))),None,None,List(),None,None,TypingUnit(List(NuTypeDef(Cls,TypeName(A),List(),None,None,None,List(),None,None,TypingUnit(List(NuFunDef(None,Var(foo),None,List(),Left(Var(x)))))), NuTypeDef(Cls,TypeName(B),List((None,TypeName(T))),None,None,None,List(),None,None,TypingUnit(List(NuFunDef(None,Var(foo),None,List(),Left(Var(y)))))), NuFunDef(None,Var(foo),None,List(),Left(Lam(Tup(List((Some(Var(any)),Fld(FldFlags(false,false,false),Tup(List((None,Fld(FldFlags(false,false,false),Var(A))), (None,Fld(FldFlags(false,false,false),TyApp(Var(B),List(TypeName(A))))))))))),Asc(Tup(List((None,Fld(FldFlags(false,false,false),Var(any))), (None,Fld(FldFlags(false,false,false),Sel(Var(any),Var(_1)))))),Tuple(List((None,Field(None,Tuple(List((None,Field(None,AppliedType(TypeName(B),List(TypeName(A))))), (None,Field(None,TypeName(A))))))), (None,Field(None,TypeName(A)))))))))))))) //│ Lifted: //│ TypingUnit { //│ class CTX$1_A$2([par$CTX$1,]) {fun foo = () => ((this).par$CTX$1).x} @@ -86,7 +86,7 @@ class CTX{ //│ |#class| |CTX|{|→|#fun| |ctx|(|x|,|y|)| |#=| |→|#class| |A|{| |#fun| |foo| |#=| |x| |}|↵|#fun| |bar|‹|T|›|(|any|#:| |T|)|#:| |A| |#=| |→|#let| |x| |#=| |#new| |T|↵|#new| |A|←|↵|(|#new| |CTX|)|.bar|‹|CTX|›|←|←|↵|}| //│ Parsed: {class CTX {fun ctx = (x, y,) => {class A {fun foo = x}; fun bar = (any: T,) => {let x = new T; new A} : A; ('(' new CTX ')').bar‹CTX›}}} //│ Parsed: -//│ TypingUnit(NuTypeDef(Cls, TypeName("CTX"), Ls(), N, N, N, Ls(), N, N, TypingUnit(NuFunDef(None, ctx, N, Nil, L(Lam(Tup((N, Var("x")), (N, Var("y"))), Blk(NuTypeDef(Cls, TypeName("A"), Ls(), N, N, N, Ls(), N, N, TypingUnit(NuFunDef(None, foo, N, Nil, L(Var("x"))))), NuFunDef(None, bar, N, TypeName("T") :: Nil, L(Lam(Tup((S(Var("any")), Var("T"))), Asc(Blk(NuFunDef(Some(false), x, N, Nil, L(NuNew(Var("T")))), NuNew(Var("A"))), TypeName("A"))))), TyApp(Sel(Bra(rcd = false, NuNew(Var("CTX"))), bar), List(TypeName(CTX)))))))))) +//│ TypingUnit(List(NuTypeDef(Cls,TypeName(CTX),List(),None,None,None,List(),None,None,TypingUnit(List(NuFunDef(None,Var(ctx),None,List(),Left(Lam(Tup(List((None,Fld(FldFlags(false,false,false),Var(x))), (None,Fld(FldFlags(false,false,false),Var(y))))),Blk(List(NuTypeDef(Cls,TypeName(A),List(),None,None,None,List(),None,None,TypingUnit(List(NuFunDef(None,Var(foo),None,List(),Left(Var(x)))))), NuFunDef(None,Var(bar),None,List(TypeName(T)),Left(Lam(Tup(List((Some(Var(any)),Fld(FldFlags(false,false,false),Var(T))))),Asc(Blk(List(NuFunDef(Some(false),Var(x),None,List(),Left(NuNew(Var(T)))), NuNew(Var(A)))),TypeName(A))))), TyApp(Sel(Bra(false,NuNew(Var(CTX))),Var(bar)),List(TypeName(CTX))))))))))))) //│ Lifted: //│ Lifting failed: mlscript.codegen.CodeGenError: Cannot find type T. Class values are not supported in lifter. //│ diff --git a/compiler/shared/test/diff/Lifter.mls b/compiler/shared/test/diff/Lifter.mls index f074c30a5..d55d43034 100644 --- a/compiler/shared/test/diff/Lifter.mls +++ b/compiler/shared/test/diff/Lifter.mls @@ -28,7 +28,7 @@ class A(x) { //│ |#class| |A|(|x|)| |{|→|#class| |B|(|y|)| |{|→|#fun| |getX| |#=| |x|↵|#fun| |getB1| |#=| |B1|(|y|)|↵|#class| |C|(|z|)| |{|→|#fun| |inc|(||)| |#=| |x| |+| |1|↵|#fun| |getY| |#=| |y|↵|#fun| |getA| |#=| |A|(|z|)|↵|#fun| |getB|(|w|)| |#=| |B|(|w|)|↵|#fun| |getC| |#=| |#new| |C|(|inc|(||)|)|↵|#fun| |getSelf| |#=| |this|←|↵|}|←|↵|}|↵|#class| |B1|(|y|)| |{|→|#fun| |getX| |#=| |x|↵|#fun| |getY| |#=| |y|↵|#fun| |getB| |#=| |#new| |B|(|y|)|↵|#fun| |getB1| |#=| |#new| |B1|(|y|)|←|↵|}|↵|#fun| |getB| |#=| |#new| |B|(|x|)|↵|#fun| |getB2|(|y|)| |#=| |B1|(|y|)|↵|#fun| |getB3|(|z|)| |#=| |getB2|(|z|)|↵|#fun| |getA| |#=| |A|(|x|)|←|↵|}| //│ Parsed: {class A(x,) {class B(y,) {fun getX = x; fun getB1 = B1(y,); class C(z,) {fun inc = () => +(x, 1,); fun getY = y; fun getA = A(z,); fun getB = (w,) => B(w,); fun getC = (new C)(inc(),); fun getSelf = this}}; class B1(y,) {fun getX = x; fun getY = y; fun getB = (new B)(y,); fun getB1 = (new B1)(y,)}; fun getB = (new B)(x,); fun getB2 = (y,) => B1(y,); fun getB3 = (z,) => getB2(z,); fun getA = A(x,)}} //│ Parsed: -//│ TypingUnit(NuTypeDef(Cls, TypeName("A"), Ls(), S(Tup((N, Var("x")))), N, N, Ls(), N, N, TypingUnit(NuTypeDef(Cls, TypeName("B"), Ls(), S(Tup((N, Var("y")))), N, N, Ls(), N, N, TypingUnit(NuFunDef(None, getX, N, Nil, L(Var("x"))), NuFunDef(None, getB1, N, Nil, L(App(Var("B1"), Tup((N, Var("y")))))), NuTypeDef(Cls, TypeName("C"), Ls(), S(Tup((N, Var("z")))), N, N, Ls(), N, N, TypingUnit(NuFunDef(None, inc, N, Nil, L(Lam(Tup(), App(Var("+"), Tup((N, Var("x")), (N, IntLit(1))))))), NuFunDef(None, getY, N, Nil, L(Var("y"))), NuFunDef(None, getA, N, Nil, L(App(Var("A"), Tup((N, Var("z")))))), NuFunDef(None, getB, N, Nil, L(Lam(Tup((N, Var("w"))), App(Var("B"), Tup((N, Var("w"))))))), NuFunDef(None, getC, N, Nil, L(App(NuNew(Var("C")), Tup((N, App(Var("inc"), Tup())))))), NuFunDef(None, getSelf, N, Nil, L(Var("this"))))))), NuTypeDef(Cls, TypeName("B1"), Ls(), S(Tup((N, Var("y")))), N, N, Ls(), N, N, TypingUnit(NuFunDef(None, getX, N, Nil, L(Var("x"))), NuFunDef(None, getY, N, Nil, L(Var("y"))), NuFunDef(None, getB, N, Nil, L(App(NuNew(Var("B")), Tup((N, Var("y")))))), NuFunDef(None, getB1, N, Nil, L(App(NuNew(Var("B1")), Tup((N, Var("y")))))))), NuFunDef(None, getB, N, Nil, L(App(NuNew(Var("B")), Tup((N, Var("x")))))), NuFunDef(None, getB2, N, Nil, L(Lam(Tup((N, Var("y"))), App(Var("B1"), Tup((N, Var("y"))))))), NuFunDef(None, getB3, N, Nil, L(Lam(Tup((N, Var("z"))), App(Var("getB2"), Tup((N, Var("z"))))))), NuFunDef(None, getA, N, Nil, L(App(Var("A"), Tup((N, Var("x"))))))))) +//│ TypingUnit(List(NuTypeDef(Cls,TypeName(A),List(),Some(Tup(List((None,Fld(FldFlags(false,false,false),Var(x)))))),None,None,List(),None,None,TypingUnit(List(NuTypeDef(Cls,TypeName(B),List(),Some(Tup(List((None,Fld(FldFlags(false,false,false),Var(y)))))),None,None,List(),None,None,TypingUnit(List(NuFunDef(None,Var(getX),None,List(),Left(Var(x))), NuFunDef(None,Var(getB1),None,List(),Left(App(Var(B1),Tup(List((None,Fld(FldFlags(false,false,false),Var(y)))))))), NuTypeDef(Cls,TypeName(C),List(),Some(Tup(List((None,Fld(FldFlags(false,false,false),Var(z)))))),None,None,List(),None,None,TypingUnit(List(NuFunDef(None,Var(inc),None,List(),Left(Lam(Tup(List()),App(Var(+),Tup(List((None,Fld(FldFlags(false,false,false),Var(x))), (None,Fld(FldFlags(false,false,false),IntLit(1))))))))), NuFunDef(None,Var(getY),None,List(),Left(Var(y))), NuFunDef(None,Var(getA),None,List(),Left(App(Var(A),Tup(List((None,Fld(FldFlags(false,false,false),Var(z)))))))), NuFunDef(None,Var(getB),None,List(),Left(Lam(Tup(List((None,Fld(FldFlags(false,false,false),Var(w))))),App(Var(B),Tup(List((None,Fld(FldFlags(false,false,false),Var(w))))))))), NuFunDef(None,Var(getC),None,List(),Left(App(NuNew(Var(C)),Tup(List((None,Fld(FldFlags(false,false,false),App(Var(inc),Tup(List()))))))))), NuFunDef(None,Var(getSelf),None,List(),Left(Var(this))))))))), NuTypeDef(Cls,TypeName(B1),List(),Some(Tup(List((None,Fld(FldFlags(false,false,false),Var(y)))))),None,None,List(),None,None,TypingUnit(List(NuFunDef(None,Var(getX),None,List(),Left(Var(x))), NuFunDef(None,Var(getY),None,List(),Left(Var(y))), NuFunDef(None,Var(getB),None,List(),Left(App(NuNew(Var(B)),Tup(List((None,Fld(FldFlags(false,false,false),Var(y)))))))), NuFunDef(None,Var(getB1),None,List(),Left(App(NuNew(Var(B1)),Tup(List((None,Fld(FldFlags(false,false,false),Var(y))))))))))), NuFunDef(None,Var(getB),None,List(),Left(App(NuNew(Var(B)),Tup(List((None,Fld(FldFlags(false,false,false),Var(x)))))))), NuFunDef(None,Var(getB2),None,List(),Left(Lam(Tup(List((None,Fld(FldFlags(false,false,false),Var(y))))),App(Var(B1),Tup(List((None,Fld(FldFlags(false,false,false),Var(y))))))))), NuFunDef(None,Var(getB3),None,List(),Left(Lam(Tup(List((None,Fld(FldFlags(false,false,false),Var(z))))),App(Var(getB2),Tup(List((None,Fld(FldFlags(false,false,false),Var(z))))))))), NuFunDef(None,Var(getA),None,List(),Left(App(Var(A),Tup(List((None,Fld(FldFlags(false,false,false),Var(x))))))))))))) //│ Lifted: //│ TypingUnit { //│ class A$1_B$2_C$4([par$A$1_B$2, z, x,]) { @@ -68,7 +68,7 @@ class A(x) { //│ |#class| |A|(|x|)| |{|→|#class| |B|(|y|)| |{|→|#class| |C|(|z|)| |{|→|#fun| |sum| |#=| |x| |+| |y| |+| |z|←|↵|}|←|↵|}|←|↵|}| //│ Parsed: {class A(x,) {class B(y,) {class C(z,) {fun sum = +(+(x, y,), z,)}}}} //│ Parsed: -//│ TypingUnit(NuTypeDef(Cls, TypeName("A"), Ls(), S(Tup((N, Var("x")))), N, N, Ls(), N, N, TypingUnit(NuTypeDef(Cls, TypeName("B"), Ls(), S(Tup((N, Var("y")))), N, N, Ls(), N, N, TypingUnit(NuTypeDef(Cls, TypeName("C"), Ls(), S(Tup((N, Var("z")))), N, N, Ls(), N, N, TypingUnit(NuFunDef(None, sum, N, Nil, L(App(Var("+"), Tup((N, App(Var("+"), Tup((N, Var("x")), (N, Var("y"))))), (N, Var("z"))))))))))))) +//│ TypingUnit(List(NuTypeDef(Cls,TypeName(A),List(),Some(Tup(List((None,Fld(FldFlags(false,false,false),Var(x)))))),None,None,List(),None,None,TypingUnit(List(NuTypeDef(Cls,TypeName(B),List(),Some(Tup(List((None,Fld(FldFlags(false,false,false),Var(y)))))),None,None,List(),None,None,TypingUnit(List(NuTypeDef(Cls,TypeName(C),List(),Some(Tup(List((None,Fld(FldFlags(false,false,false),Var(z)))))),None,None,List(),None,None,TypingUnit(List(NuFunDef(None,Var(sum),None,List(),Left(App(Var(+),Tup(List((None,Fld(FldFlags(false,false,false),App(Var(+),Tup(List((None,Fld(FldFlags(false,false,false),Var(x))), (None,Fld(FldFlags(false,false,false),Var(y)))))))), (None,Fld(FldFlags(false,false,false),Var(z))))))))))))))))))) //│ Lifted: //│ TypingUnit { //│ class A$1_B$2_C$3([par$A$1_B$2, z, x,]) { @@ -108,7 +108,7 @@ new C{ //│ |#class| |A|(|x|)| |{|→|#class| |B|{|→|#fun| |foo| |#=| |1|↵|#fun| |bar| |#=| |11|←|↵|}|↵|#fun| |getB| |#=| |#new| |B|{|→|#fun| |foo| |#=| |2|↵|#fun| |bar| |#=| |12|←|↵|}|↵|#fun| |bar| |#=| |13|←|↵|}|↵|#class| |C|#:| |A|{|→|#fun| |getB| |#=| |#new| |B|{|→|#fun| |foo| |#=| |3|↵|#fun| |bar| |#=| |14|←|↵|}|↵|#fun| |bar| |#=| |15|←|↵|}|↵|#new| |C|{|→|#fun| |getB| |#=| |#new| |B|{|→|#fun| |foo| |#=| |4|↵|#fun| |bar| |#=| |16|←|↵|}|↵|#fun| |bar| |#=| |17|←|↵|}| //│ Parsed: {class A(x,) {class B {fun foo = 1; fun bar = 11}; fun getB = new B { ‹fun foo = 2; fun bar = 12› }; fun bar = 13}; class C: A {fun getB = new B { ‹fun foo = 3; fun bar = 14› }; fun bar = 15}; new C { ‹fun getB = new B { ‹fun foo = 4; fun bar = 16› }; fun bar = 17› }} //│ Parsed: -//│ TypingUnit(NuTypeDef(Cls, TypeName("A"), Ls(), S(Tup((N, Var("x")))), N, N, Ls(), N, N, TypingUnit(NuTypeDef(Cls, TypeName("B"), Ls(), N, N, N, Ls(), N, N, TypingUnit(NuFunDef(None, foo, N, Nil, L(IntLit(1))), NuFunDef(None, bar, N, Nil, L(IntLit(11))))), NuFunDef(None, getB, N, Nil, L(Rft(NuNew(Var("B")), TypingUnit(NuFunDef(None, foo, N, Nil, L(IntLit(2))), NuFunDef(None, bar, N, Nil, L(IntLit(12))))))), NuFunDef(None, bar, N, Nil, L(IntLit(13))))), NuTypeDef(Cls, TypeName("C"), Ls(), N, N, S(TypeName("A")), Ls(), N, N, TypingUnit(NuFunDef(None, getB, N, Nil, L(Rft(NuNew(Var("B")), TypingUnit(NuFunDef(None, foo, N, Nil, L(IntLit(3))), NuFunDef(None, bar, N, Nil, L(IntLit(14))))))), NuFunDef(None, bar, N, Nil, L(IntLit(15))))), Rft(NuNew(Var("C")), TypingUnit(NuFunDef(None, getB, N, Nil, L(Rft(NuNew(Var("B")), TypingUnit(NuFunDef(None, foo, N, Nil, L(IntLit(4))), NuFunDef(None, bar, N, Nil, L(IntLit(16))))))), NuFunDef(None, bar, N, Nil, L(IntLit(17)))))) +//│ TypingUnit(List(NuTypeDef(Cls,TypeName(A),List(),Some(Tup(List((None,Fld(FldFlags(false,false,false),Var(x)))))),None,None,List(),None,None,TypingUnit(List(NuTypeDef(Cls,TypeName(B),List(),None,None,None,List(),None,None,TypingUnit(List(NuFunDef(None,Var(foo),None,List(),Left(IntLit(1))), NuFunDef(None,Var(bar),None,List(),Left(IntLit(11)))))), NuFunDef(None,Var(getB),None,List(),Left(Rft(NuNew(Var(B)),TypingUnit(List(NuFunDef(None,Var(foo),None,List(),Left(IntLit(2))), NuFunDef(None,Var(bar),None,List(),Left(IntLit(12)))))))), NuFunDef(None,Var(bar),None,List(),Left(IntLit(13)))))), NuTypeDef(Cls,TypeName(C),List(),None,None,Some(TypeName(A)),List(),None,None,TypingUnit(List(NuFunDef(None,Var(getB),None,List(),Left(Rft(NuNew(Var(B)),TypingUnit(List(NuFunDef(None,Var(foo),None,List(),Left(IntLit(3))), NuFunDef(None,Var(bar),None,List(),Left(IntLit(14)))))))), NuFunDef(None,Var(bar),None,List(),Left(IntLit(15)))))), Rft(NuNew(Var(C)),TypingUnit(List(NuFunDef(None,Var(getB),None,List(),Left(Rft(NuNew(Var(B)),TypingUnit(List(NuFunDef(None,Var(foo),None,List(),Left(IntLit(4))), NuFunDef(None,Var(bar),None,List(),Left(IntLit(16)))))))), NuFunDef(None,Var(bar),None,List(),Left(IntLit(17)))))))) //│ Lifted: //│ Lifting failed: mlscript.codegen.CodeGenError: Cannot find type B. Class values are not supported in lifter. //│ @@ -125,7 +125,7 @@ class Parent(x) { //│ |#class| |Parent|‹|T|,| |U|,| |V|›|(|x|)| |{| |→|#fun| |foo|(|x|#:| |Int|)|#:| |T| |#=| |x|+|1|↵|#class| |Inner|‹|W|›|(|y|#:| |Int|)|{|→|#fun| |bar|(|z|#:| |U|)| |#=| |foo|(|y|)|↵|#fun| |boo|(|z|#:| |W|)| |#=| |z|←|↵|}|←|↵|}| //│ Parsed: {class Parent‹T, U, V›(x,) {fun foo = (x: Int,) => +(x, 1,) : T; class Inner‹W›(y: Int,) {fun bar = (z: U,) => foo(y,); fun boo = (z: W,) => z}}} //│ Parsed: -//│ TypingUnit(NuTypeDef(Cls, TypeName("Parent"), Ls(N -> TypeName("T"), N -> TypeName("U"), N -> TypeName("V")), S(Tup((N, Var("x")))), N, N, Ls(), N, N, TypingUnit(NuFunDef(None, foo, N, Nil, L(Lam(Tup((S(Var("x")), Var("Int"))), Asc(App(Var("+"), Tup((N, Var("x")), (N, IntLit(1)))), TypeName("T"))))), NuTypeDef(Cls, TypeName("Inner"), Ls(N -> TypeName("W")), S(Tup((S(Var("y")), Var("Int")))), N, N, Ls(), N, N, TypingUnit(NuFunDef(None, bar, N, Nil, L(Lam(Tup((S(Var("z")), Var("U"))), App(Var("foo"), Tup((N, Var("y"))))))), NuFunDef(None, boo, N, Nil, L(Lam(Tup((S(Var("z")), Var("W"))), Var("z"))))))))) +//│ TypingUnit(List(NuTypeDef(Cls,TypeName(Parent),List((None,TypeName(T)), (None,TypeName(U)), (None,TypeName(V))),Some(Tup(List((None,Fld(FldFlags(false,false,false),Var(x)))))),None,None,List(),None,None,TypingUnit(List(NuFunDef(None,Var(foo),None,List(),Left(Lam(Tup(List((Some(Var(x)),Fld(FldFlags(false,false,false),Var(Int))))),Asc(App(Var(+),Tup(List((None,Fld(FldFlags(false,false,false),Var(x))), (None,Fld(FldFlags(false,false,false),IntLit(1)))))),TypeName(T))))), NuTypeDef(Cls,TypeName(Inner),List((None,TypeName(W))),Some(Tup(List((Some(Var(y)),Fld(FldFlags(false,false,false),Var(Int)))))),None,None,List(),None,None,TypingUnit(List(NuFunDef(None,Var(bar),None,List(),Left(Lam(Tup(List((Some(Var(z)),Fld(FldFlags(false,false,false),Var(U))))),App(Var(foo),Tup(List((None,Fld(FldFlags(false,false,false),Var(y))))))))), NuFunDef(None,Var(boo),None,List(),Left(Lam(Tup(List((Some(Var(z)),Fld(FldFlags(false,false,false),Var(W))))),Var(z)))))))))))) //│ Lifted: //│ TypingUnit { //│ class Parent$1_Inner$2[W,U]([par$Parent$1, y: Int,]) { @@ -148,7 +148,7 @@ class A(x: Int): ({a1: Int} & B & D(x)) { //│ |#class| |B|‹|T|›| |{||}|↵|#class| |C| |{||}|↵|#class| |D|(|y|#:| |Int|)| |{||}|↵|#class| |A|‹|T|,| |U|›|(|x|#:| |Int|)|#:| |(|{|a1|#:| |Int|}| |&| |B|‹|T|›| |&| |D|(|x|)|)| |{|→|#fun| |getA|(||)| |#=| |#new| |C|{|→|#fun| |foo|(|x|#:| |T|)| |#=| |x|←|↵|}|←|↵|}| //│ Parsed: {class B‹T› {}; class C {}; class D(y: Int,) {}; class A‹T, U›(x: Int,): {a1: Int} & B[T] & D[x] {fun getA = () => new C { ‹fun foo = (x: T,) => x› }}} //│ Parsed: -//│ TypingUnit(NuTypeDef(Cls, TypeName("B"), Ls(N -> TypeName("T")), N, N, N, Ls(), N, N, TypingUnit()), NuTypeDef(Cls, TypeName("C"), Ls(), N, N, N, Ls(), N, N, TypingUnit()), NuTypeDef(Cls, TypeName("D"), Ls(), S(Tup((S(Var("y")), Var("Int")))), N, N, Ls(), N, N, TypingUnit()), NuTypeDef(Cls, TypeName("A"), Ls(N -> TypeName("T"), N -> TypeName("U")), S(Tup((S(Var("x")), Var("Int")))), N, S(Inter(Inter(Record(a1: Fld(N, TypeName("Int"))), AppliedType(TypeName("B"), TypeName("T") :: Nil)), AppliedType(TypeName("D"), TypeName("x") :: Nil))), Ls(), N, N, TypingUnit(NuFunDef(None, getA, N, Nil, L(Lam(Tup(), Rft(NuNew(Var("C")), TypingUnit(NuFunDef(None, foo, N, Nil, L(Lam(Tup((S(Var("x")), Var("T"))), Var("x")))))))))))) +//│ TypingUnit(List(NuTypeDef(Cls,TypeName(B),List((None,TypeName(T))),None,None,None,List(),None,None,TypingUnit(List())), NuTypeDef(Cls,TypeName(C),List(),None,None,None,List(),None,None,TypingUnit(List())), NuTypeDef(Cls,TypeName(D),List(),Some(Tup(List((Some(Var(y)),Fld(FldFlags(false,false,false),Var(Int)))))),None,None,List(),None,None,TypingUnit(List())), NuTypeDef(Cls,TypeName(A),List((None,TypeName(T)), (None,TypeName(U))),Some(Tup(List((Some(Var(x)),Fld(FldFlags(false,false,false),Var(Int)))))),None,Some(Inter(Inter(Record(List((Var(a1),Field(None,TypeName(Int))))),AppliedType(TypeName(B),List(TypeName(T)))),AppliedType(TypeName(D),List(TypeName(x))))),List(),None,None,TypingUnit(List(NuFunDef(None,Var(getA),None,List(),Left(Lam(Tup(List()),Rft(NuNew(Var(C)),TypingUnit(List(NuFunDef(None,Var(foo),None,List(),Left(Lam(Tup(List((Some(Var(x)),Fld(FldFlags(false,false,false),Var(T))))),Var(x))))))))))))))) //│ Lifted: //│ TypingUnit { //│ class B$1[T]([]) {} @@ -170,7 +170,7 @@ class A(x: Int) extends {a1: Int}, B, D(x){ //│ |#class| |B|‹|T|›| |{||}|↵|#class| |C| |{||}|↵|#class| |D|(|y|#:| |Int|)| |{||}|↵|#class| |A|‹|T|,| |U|›|(|x|#:| |Int|)| |#extends| |{|a1|#:| |Int|}|,| |B|‹|T|›|,| |D|(|x|)|{|→|#fun| |getA|(||)| |#=| |#new| |C|{|→|#fun| |foo|(|x|)| |#=| |x|←|↵|}|←|↵|}| //│ Parsed: {class B‹T› {}; class C {}; class D(y: Int,) {}; class A‹T, U›(x: Int,): '{' {a1: Int} '}', B‹T›, D(x,) {fun getA = () => new C { ‹fun foo = (x,) => x› }}} //│ Parsed: -//│ TypingUnit(NuTypeDef(Cls, TypeName("B"), Ls(N -> TypeName("T")), N, N, N, Ls(), N, N, TypingUnit()), NuTypeDef(Cls, TypeName("C"), Ls(), N, N, N, Ls(), N, N, TypingUnit()), NuTypeDef(Cls, TypeName("D"), Ls(), S(Tup((S(Var("y")), Var("Int")))), N, N, Ls(), N, N, TypingUnit()), NuTypeDef(Cls, TypeName("A"), Ls(N -> TypeName("T"), N -> TypeName("U")), S(Tup((S(Var("x")), Var("Int")))), N, N, Ls(Bra(rcd = true, Rcd(Var("a1") = Var("Int"))), TyApp(Var("B"), List(TypeName(T))), App(Var("D"), Tup((N, Var("x"))))), N, N, TypingUnit(NuFunDef(None, getA, N, Nil, L(Lam(Tup(), Rft(NuNew(Var("C")), TypingUnit(NuFunDef(None, foo, N, Nil, L(Lam(Tup((N, Var("x"))), Var("x")))))))))))) +//│ TypingUnit(List(NuTypeDef(Cls,TypeName(B),List((None,TypeName(T))),None,None,None,List(),None,None,TypingUnit(List())), NuTypeDef(Cls,TypeName(C),List(),None,None,None,List(),None,None,TypingUnit(List())), NuTypeDef(Cls,TypeName(D),List(),Some(Tup(List((Some(Var(y)),Fld(FldFlags(false,false,false),Var(Int)))))),None,None,List(),None,None,TypingUnit(List())), NuTypeDef(Cls,TypeName(A),List((None,TypeName(T)), (None,TypeName(U))),Some(Tup(List((Some(Var(x)),Fld(FldFlags(false,false,false),Var(Int)))))),None,None,List(Bra(true,Rcd(List((Var(a1),Fld(FldFlags(false,false,false),Var(Int)))))), TyApp(Var(B),List(TypeName(T))), App(Var(D),Tup(List((None,Fld(FldFlags(false,false,false),Var(x))))))),None,None,TypingUnit(List(NuFunDef(None,Var(getA),None,List(),Left(Lam(Tup(List()),Rft(NuNew(Var(C)),TypingUnit(List(NuFunDef(None,Var(foo),None,List(),Left(Lam(Tup(List((None,Fld(FldFlags(false,false,false),Var(x))))),Var(x))))))))))))))) //│ Lifted: //│ TypingUnit { //│ class B$1[T]([]) {} @@ -190,7 +190,7 @@ class Child(x): ({ age: T } & { name: String}) { //│ |#class| |Child|‹|T|,| |U|›|(|x|)|#:| |(|{| |age|#:| |T| |}| |&| |{| |name|#:| |String|}|)| |{|→|#class| |Inner|{|→|#fun| |foo| |#=| |age|←|↵|}|↵|#fun| |bar| |#=| |age|↵|#fun| |boo| |#=| |#new| |Inner|←|↵|}| //│ Parsed: {class Child‹T, U›(x,): {age: T} & {name: String} {class Inner {fun foo = age}; fun bar = age; fun boo = new Inner}} //│ Parsed: -//│ TypingUnit(NuTypeDef(Cls, TypeName("Child"), Ls(N -> TypeName("T"), N -> TypeName("U")), S(Tup((N, Var("x")))), N, S(Inter(Record(age: Fld(N, TypeName("T"))), Record(name: Fld(N, TypeName("String"))))), Ls(), N, N, TypingUnit(NuTypeDef(Cls, TypeName("Inner"), Ls(), N, N, N, Ls(), N, N, TypingUnit(NuFunDef(None, foo, N, Nil, L(Var("age"))))), NuFunDef(None, bar, N, Nil, L(Var("age"))), NuFunDef(None, boo, N, Nil, L(NuNew(Var("Inner"))))))) +//│ TypingUnit(List(NuTypeDef(Cls,TypeName(Child),List((None,TypeName(T)), (None,TypeName(U))),Some(Tup(List((None,Fld(FldFlags(false,false,false),Var(x)))))),None,Some(Inter(Record(List((Var(age),Field(None,TypeName(T))))),Record(List((Var(name),Field(None,TypeName(String))))))),List(),None,None,TypingUnit(List(NuTypeDef(Cls,TypeName(Inner),List(),None,None,None,List(),None,None,TypingUnit(List(NuFunDef(None,Var(foo),None,List(),Left(Var(age)))))), NuFunDef(None,Var(bar),None,List(),Left(Var(age))), NuFunDef(None,Var(boo),None,List(),Left(NuNew(Var(Inner))))))))) //│ Lifted: //│ TypingUnit { //│ class Child$1_Inner$2([par$Child$1, age,]) {fun foo = () => (this).age} @@ -213,7 +213,7 @@ new A(0) { //│ |#class| |A|(|x|#:| |Int|)| |{|→|#fun| |getA|#:| |Int| |#=| |0|↵|#fun| |getA1| |#=| |1|←|↵|}|↵|#new| |A|(|0|)| |{|→|#fun| |getA| |#=| |3|↵|#fun| |getA2| |#=| |2|←|↵|}| //│ Parsed: {class A(x: Int,) {fun getA = 0 : Int; fun getA1 = 1}; (new A)(0,) { ‹fun getA = 3; fun getA2 = 2› }} //│ Parsed: -//│ TypingUnit(NuTypeDef(Cls, TypeName("A"), Ls(), S(Tup((S(Var("x")), Var("Int")))), N, N, Ls(), N, N, TypingUnit(NuFunDef(None, getA, N, Nil, L(Asc(IntLit(0), TypeName("Int")))), NuFunDef(None, getA1, N, Nil, L(IntLit(1))))), Rft(App(NuNew(Var("A")), Tup((N, IntLit(0)))), TypingUnit(NuFunDef(None, getA, N, Nil, L(IntLit(3))), NuFunDef(None, getA2, N, Nil, L(IntLit(2)))))) +//│ TypingUnit(List(NuTypeDef(Cls,TypeName(A),List(),Some(Tup(List((Some(Var(x)),Fld(FldFlags(false,false,false),Var(Int)))))),None,None,List(),None,None,TypingUnit(List(NuFunDef(None,Var(getA),None,List(),Left(Asc(IntLit(0),TypeName(Int)))), NuFunDef(None,Var(getA1),None,List(),Left(IntLit(1)))))), Rft(App(NuNew(Var(A)),Tup(List((None,Fld(FldFlags(false,false,false),IntLit(0)))))),TypingUnit(List(NuFunDef(None,Var(getA),None,List(),Left(IntLit(3))), NuFunDef(None,Var(getA2),None,List(),Left(IntLit(2)))))))) //│ Lifted: //│ TypingUnit { //│ class A$1([x: Int,]) {fun getA = () => 0 : Int; fun getA1 = () => 1} @@ -234,7 +234,7 @@ new A(1) { //│ |#class| |A|(|x|)| |{|→|#class| |B|(|y|)| |{| |}|←|↵|}|↵|#new| |A|(|1|)| |{|→|#fun| |getB| |#=| |#new| |B|(|2|)|{|→|#fun| |getB| |#=| |#new| |B|(|3|)|←|↵|}|←|↵|}| //│ Parsed: {class A(x,) {class B(y,) {}}; (new A)(1,) { ‹fun getB = (new B)(2,) { ‹fun getB = (new B)(3,)› }› }} //│ Parsed: -//│ TypingUnit(NuTypeDef(Cls, TypeName("A"), Ls(), S(Tup((N, Var("x")))), N, N, Ls(), N, N, TypingUnit(NuTypeDef(Cls, TypeName("B"), Ls(), S(Tup((N, Var("y")))), N, N, Ls(), N, N, TypingUnit()))), Rft(App(NuNew(Var("A")), Tup((N, IntLit(1)))), TypingUnit(NuFunDef(None, getB, N, Nil, L(Rft(App(NuNew(Var("B")), Tup((N, IntLit(2)))), TypingUnit(NuFunDef(None, getB, N, Nil, L(App(NuNew(Var("B")), Tup((N, IntLit(3))))))))))))) +//│ TypingUnit(List(NuTypeDef(Cls,TypeName(A),List(),Some(Tup(List((None,Fld(FldFlags(false,false,false),Var(x)))))),None,None,List(),None,None,TypingUnit(List(NuTypeDef(Cls,TypeName(B),List(),Some(Tup(List((None,Fld(FldFlags(false,false,false),Var(y)))))),None,None,List(),None,None,TypingUnit(List()))))), Rft(App(NuNew(Var(A)),Tup(List((None,Fld(FldFlags(false,false,false),IntLit(1)))))),TypingUnit(List(NuFunDef(None,Var(getB),None,List(),Left(Rft(App(NuNew(Var(B)),Tup(List((None,Fld(FldFlags(false,false,false),IntLit(2)))))),TypingUnit(List(NuFunDef(None,Var(getB),None,List(),Left(App(NuNew(Var(B)),Tup(List((None,Fld(FldFlags(false,false,false),IntLit(3)))))))))))))))))) //│ Lifted: //│ TypingUnit { //│ class A$1_B$2([par$A$1, y,]) {} @@ -267,7 +267,7 @@ new B{ //│ |#class| |A| |{|→|#fun| |getA| |#=| |0|↵|#fun| |funcA| |#=| |10|←|↵|}|↵|#class| |B|#:| |A|{|→|#fun| |getA| |#=| |1|↵|#fun| |funcB| |#=| |11|←|↵|}|↵|#new| |A|↵|#new| |B|↵|#fun| |f|(|x|)| |#=| |#if| |x| |is| |A| |#then| |0| |#else| |1|↵|f|(|#new| |A|{|→|#fun| |getA| |#=| |2|←|↵|}|)|↵|#new| |B|{|→|#fun| |getA| |#=| |funcB|←|↵|}| //│ Parsed: {class A {fun getA = 0; fun funcA = 10}; class B: A {fun getA = 1; fun funcB = 11}; new A; new B; fun f = (x,) => if (is(x, A,)) then 0 else 1; f(new A { ‹fun getA = 2› },); new B { ‹fun getA = funcB› }} //│ Parsed: -//│ TypingUnit(NuTypeDef(Cls, TypeName("A"), Ls(), N, N, N, Ls(), N, N, TypingUnit(NuFunDef(None, getA, N, Nil, L(IntLit(0))), NuFunDef(None, funcA, N, Nil, L(IntLit(10))))), NuTypeDef(Cls, TypeName("B"), Ls(), N, N, S(TypeName("A")), Ls(), N, N, TypingUnit(NuFunDef(None, getA, N, Nil, L(IntLit(1))), NuFunDef(None, funcB, N, Nil, L(IntLit(11))))), NuNew(Var("A")), NuNew(Var("B")), NuFunDef(None, f, N, Nil, L(Lam(Tup((N, Var("x"))), If(IfThen(App(Var("is"), Tup((N, Var("x")), (N, Var("A")))), IntLit(0), Some(IntLit(1)))))), App(Var("f"), Tup((N, Rft(NuNew(Var("A")), TypingUnit(NuFunDef(None, getA, N, Nil, L(IntLit(2)))))))), Rft(NuNew(Var("B")), TypingUnit(NuFunDef(None, getA, N, Nil, L(Var("funcB")))))) +//│ TypingUnit(List(NuTypeDef(Cls,TypeName(A),List(),None,None,None,List(),None,None,TypingUnit(List(NuFunDef(None,Var(getA),None,List(),Left(IntLit(0))), NuFunDef(None,Var(funcA),None,List(),Left(IntLit(10)))))), NuTypeDef(Cls,TypeName(B),List(),None,None,Some(TypeName(A)),List(),None,None,TypingUnit(List(NuFunDef(None,Var(getA),None,List(),Left(IntLit(1))), NuFunDef(None,Var(funcB),None,List(),Left(IntLit(11)))))), NuNew(Var(A)), NuNew(Var(B)), NuFunDef(None,Var(f),None,List(),Left(Lam(Tup(List((None,Fld(FldFlags(false,false,false),Var(x))))),If(IfThen(App(Var(is),Tup(List((None,Fld(FldFlags(false,false,false),Var(x))), (None,Fld(FldFlags(false,false,false),Var(A)))))),IntLit(0)),Some(IntLit(1)))))), App(Var(f),Tup(List((None,Fld(FldFlags(false,false,false),Rft(NuNew(Var(A)),TypingUnit(List(NuFunDef(None,Var(getA),None,List(),Left(IntLit(2))))))))))), Rft(NuNew(Var(B)),TypingUnit(List(NuFunDef(None,Var(getA),None,List(),Left(Var(funcB)))))))) //│ Lifted: //│ TypingUnit { //│ class A$1([]) {fun getA = () => 0; fun funcA = () => 10} @@ -306,7 +306,7 @@ class A{ //│ |#class| |A|{|→|#class| |B|{|→|#fun| |funB| |#=| |1|↵|#fun| |foo| |#=| |100|←|↵|}|↵|#class| |C|#:| |B|{|→|#fun| |funC| |#=| |2|↵|#fun| |foo| |#=| |1000|←|↵|}|↵|#class| |D|{|→|#fun| |funD| |#=| |3|↵|#fun| |foo| |#=| |10000| |↵|#class| |E|#:| |C|{|→|#fun| |funE| |#=| |4|↵|#fun| |foo| |#=| |100000|←|↵|}|↵|#class| |F|#:| |E|{|→|#fun| |funF| |#=| |5|↵|#fun| |foo| |#=| |1000000|←|↵|}|←|↵|}|←|↵|}| //│ Parsed: {class A {class B {fun funB = 1; fun foo = 100}; class C: B {fun funC = 2; fun foo = 1000}; class D {fun funD = 3; fun foo = 10000; class E: C {fun funE = 4; fun foo = 100000}; class F: E {fun funF = 5; fun foo = 1000000}}}} //│ Parsed: -//│ TypingUnit(NuTypeDef(Cls, TypeName("A"), Ls(), N, N, N, Ls(), N, N, TypingUnit(NuTypeDef(Cls, TypeName("B"), Ls(), N, N, N, Ls(), N, N, TypingUnit(NuFunDef(None, funB, N, Nil, L(IntLit(1))), NuFunDef(None, foo, N, Nil, L(IntLit(100))))), NuTypeDef(Cls, TypeName("C"), Ls(), N, N, S(TypeName("B")), Ls(), N, N, TypingUnit(NuFunDef(None, funC, N, Nil, L(IntLit(2))), NuFunDef(None, foo, N, Nil, L(IntLit(1000))))), NuTypeDef(Cls, TypeName("D"), Ls(), N, N, N, Ls(), N, N, TypingUnit(NuFunDef(None, funD, N, Nil, L(IntLit(3))), NuFunDef(None, foo, N, Nil, L(IntLit(10000))), NuTypeDef(Cls, TypeName("E"), Ls(), N, N, S(TypeName("C")), Ls(), N, N, TypingUnit(NuFunDef(None, funE, N, Nil, L(IntLit(4))), NuFunDef(None, foo, N, Nil, L(IntLit(100000))))), NuTypeDef(Cls, TypeName("F"), Ls(), N, N, S(TypeName("E")), Ls(), N, N, TypingUnit(NuFunDef(None, funF, N, Nil, L(IntLit(5))), NuFunDef(None, foo, N, Nil, L(IntLit(1000000)))))))))) +//│ TypingUnit(List(NuTypeDef(Cls,TypeName(A),List(),None,None,None,List(),None,None,TypingUnit(List(NuTypeDef(Cls,TypeName(B),List(),None,None,None,List(),None,None,TypingUnit(List(NuFunDef(None,Var(funB),None,List(),Left(IntLit(1))), NuFunDef(None,Var(foo),None,List(),Left(IntLit(100)))))), NuTypeDef(Cls,TypeName(C),List(),None,None,Some(TypeName(B)),List(),None,None,TypingUnit(List(NuFunDef(None,Var(funC),None,List(),Left(IntLit(2))), NuFunDef(None,Var(foo),None,List(),Left(IntLit(1000)))))), NuTypeDef(Cls,TypeName(D),List(),None,None,None,List(),None,None,TypingUnit(List(NuFunDef(None,Var(funD),None,List(),Left(IntLit(3))), NuFunDef(None,Var(foo),None,List(),Left(IntLit(10000))), NuTypeDef(Cls,TypeName(E),List(),None,None,Some(TypeName(C)),List(),None,None,TypingUnit(List(NuFunDef(None,Var(funE),None,List(),Left(IntLit(4))), NuFunDef(None,Var(foo),None,List(),Left(IntLit(100000)))))), NuTypeDef(Cls,TypeName(F),List(),None,None,Some(TypeName(E)),List(),None,None,TypingUnit(List(NuFunDef(None,Var(funF),None,List(),Left(IntLit(5))), NuFunDef(None,Var(foo),None,List(),Left(IntLit(1000000)))))))))))))) //│ Lifted: //│ TypingUnit { //│ class A$1_B$2([par$A$1,]) {fun funB = () => 1; fun foo = () => 100} @@ -349,7 +349,7 @@ class A{ //│ |#class| |A|{|→|#class| |B|{|→|#fun| |funB| |#=| |1|↵|#fun| |foo| |#=| |100|←|↵|}|↵|#class| |C|#:| |B|{|→|#fun| |funC| |#=| |2|↵|#fun| |foo| |#=| |1000|↵|#fun| |getB| |#=| |#new| |B|←|↵|}|↵|#class| |D|{|→|#fun| |funD| |#=| |3|↵|#fun| |foo| |#=| |10000| |↵|#class| |E|#:| |C|{|→|#fun| |funE| |#=| |4|↵|#fun| |foo| |#=| |100000|↵|#fun| |getD| |#=| |#new| |D|←|↵|}|↵|#class| |F|#:| |E|{|→|#fun| |funF| |#=| |5|↵|#fun| |foo| |#=| |1000000|↵|#fun| |getE| |#=| |#new| |E|{|→|#fun| |foo| |#=| |0|←|↵|}|←|↵|}|←|↵|}|←|↵|}| //│ Parsed: {class A {class B {fun funB = 1; fun foo = 100}; class C: B {fun funC = 2; fun foo = 1000; fun getB = new B}; class D {fun funD = 3; fun foo = 10000; class E: C {fun funE = 4; fun foo = 100000; fun getD = new D}; class F: E {fun funF = 5; fun foo = 1000000; fun getE = new E { ‹fun foo = 0› }}}}} //│ Parsed: -//│ TypingUnit(NuTypeDef(Cls, TypeName("A"), Ls(), N, N, N, Ls(), N, N, TypingUnit(NuTypeDef(Cls, TypeName("B"), Ls(), N, N, N, Ls(), N, N, TypingUnit(NuFunDef(None, funB, N, Nil, L(IntLit(1))), NuFunDef(None, foo, N, Nil, L(IntLit(100))))), NuTypeDef(Cls, TypeName("C"), Ls(), N, N, S(TypeName("B")), Ls(), N, N, TypingUnit(NuFunDef(None, funC, N, Nil, L(IntLit(2))), NuFunDef(None, foo, N, Nil, L(IntLit(1000))), NuFunDef(None, getB, N, Nil, L(NuNew(Var("B")))))), NuTypeDef(Cls, TypeName("D"), Ls(), N, N, N, Ls(), N, N, TypingUnit(NuFunDef(None, funD, N, Nil, L(IntLit(3))), NuFunDef(None, foo, N, Nil, L(IntLit(10000))), NuTypeDef(Cls, TypeName("E"), Ls(), N, N, S(TypeName("C")), Ls(), N, N, TypingUnit(NuFunDef(None, funE, N, Nil, L(IntLit(4))), NuFunDef(None, foo, N, Nil, L(IntLit(100000))), NuFunDef(None, getD, N, Nil, L(NuNew(Var("D")))))), NuTypeDef(Cls, TypeName("F"), Ls(), N, N, S(TypeName("E")), Ls(), N, N, TypingUnit(NuFunDef(None, funF, N, Nil, L(IntLit(5))), NuFunDef(None, foo, N, Nil, L(IntLit(1000000))), NuFunDef(None, getE, N, Nil, L(Rft(NuNew(Var("E")), TypingUnit(NuFunDef(None, foo, N, Nil, L(IntLit(0)))))))))))))) +//│ TypingUnit(List(NuTypeDef(Cls,TypeName(A),List(),None,None,None,List(),None,None,TypingUnit(List(NuTypeDef(Cls,TypeName(B),List(),None,None,None,List(),None,None,TypingUnit(List(NuFunDef(None,Var(funB),None,List(),Left(IntLit(1))), NuFunDef(None,Var(foo),None,List(),Left(IntLit(100)))))), NuTypeDef(Cls,TypeName(C),List(),None,None,Some(TypeName(B)),List(),None,None,TypingUnit(List(NuFunDef(None,Var(funC),None,List(),Left(IntLit(2))), NuFunDef(None,Var(foo),None,List(),Left(IntLit(1000))), NuFunDef(None,Var(getB),None,List(),Left(NuNew(Var(B))))))), NuTypeDef(Cls,TypeName(D),List(),None,None,None,List(),None,None,TypingUnit(List(NuFunDef(None,Var(funD),None,List(),Left(IntLit(3))), NuFunDef(None,Var(foo),None,List(),Left(IntLit(10000))), NuTypeDef(Cls,TypeName(E),List(),None,None,Some(TypeName(C)),List(),None,None,TypingUnit(List(NuFunDef(None,Var(funE),None,List(),Left(IntLit(4))), NuFunDef(None,Var(foo),None,List(),Left(IntLit(100000))), NuFunDef(None,Var(getD),None,List(),Left(NuNew(Var(D))))))), NuTypeDef(Cls,TypeName(F),List(),None,None,Some(TypeName(E)),List(),None,None,TypingUnit(List(NuFunDef(None,Var(funF),None,List(),Left(IntLit(5))), NuFunDef(None,Var(foo),None,List(),Left(IntLit(1000000))), NuFunDef(None,Var(getE),None,List(),Left(Rft(NuNew(Var(E)),TypingUnit(List(NuFunDef(None,Var(foo),None,List(),Left(IntLit(0))))))))))))))))))) //│ Lifted: //│ TypingUnit { //│ class A$1_B$2([par$A$1,]) {fun funB = () => 1; fun foo = () => 100} @@ -384,7 +384,7 @@ new A //│ |#class| |A|{|→|#class| |B|{|→|#fun| |foo| |#=| |1|←|↵|}|↵|#fun| |bar| |#=| |#new| |B|←|↵|}|↵|#new| |A| //│ Parsed: {class A {class B {fun foo = 1}; fun bar = new B}; new A} //│ Parsed: -//│ TypingUnit(NuTypeDef(Cls, TypeName("A"), Ls(), N, N, N, Ls(), N, N, TypingUnit(NuTypeDef(Cls, TypeName("B"), Ls(), N, N, N, Ls(), N, N, TypingUnit(NuFunDef(None, foo, N, Nil, L(IntLit(1))))), NuFunDef(None, bar, N, Nil, L(NuNew(Var("B")))))), NuNew(Var("A"))) +//│ TypingUnit(List(NuTypeDef(Cls,TypeName(A),List(),None,None,None,List(),None,None,TypingUnit(List(NuTypeDef(Cls,TypeName(B),List(),None,None,None,List(),None,None,TypingUnit(List(NuFunDef(None,Var(foo),None,List(),Left(IntLit(1)))))), NuFunDef(None,Var(bar),None,List(),Left(NuNew(Var(B))))))), NuNew(Var(A)))) //│ Lifted: //│ TypingUnit { //│ class A$1_B$2([par$A$1,]) {fun foo = () => 1} @@ -409,7 +409,7 @@ let x = new A{ //│ |#class| |A|(|x|)| |{|→|#fun| |foo| |#=| |0|↵|#fun| |bar| |#=| |x|←|↵|}|↵|#let| |x| |#=| |#new| |A|{|→|#fun| |foo| |#=| |1|↵|#fun| |newFun| |#=| |2|↵|#fun| |bar| |#=| |#new| |A|(|foo|)|{|→|#fun| |foo| |#=| |bar| |+| |1|↵|#fun| |bar2| |#=| |newFun| |+| |1|←|↵|}|←|↵|}| //│ Parsed: {class A(x,) {fun foo = 0; fun bar = x}; let x = new A { ‹fun foo = 1; fun newFun = 2; fun bar = (new A)(foo,) { ‹fun foo = +(bar, 1,); fun bar2 = +(newFun, 1,)› }› }} //│ Parsed: -//│ TypingUnit(NuTypeDef(Cls, TypeName("A"), Ls(), S(Tup((N, Var("x")))), N, N, Ls(), N, N, TypingUnit(NuFunDef(None, foo, N, Nil, L(IntLit(0))), NuFunDef(None, bar, N, Nil, L(Var("x"))))), NuFunDef(Some(false), x, N, Nil, L(Rft(NuNew(Var("A")), TypingUnit(NuFunDef(None, foo, N, Nil, L(IntLit(1))), NuFunDef(None, newFun, N, Nil, L(IntLit(2))), NuFunDef(None, bar, N, Nil, L(Rft(App(NuNew(Var("A")), Tup((N, Var("foo")))), TypingUnit(NuFunDef(None, foo, N, Nil, L(App(Var("+"), Tup((N, Var("bar")), (N, IntLit(1)))))), NuFunDef(None, bar2, N, Nil, L(App(Var("+"), Tup((N, Var("newFun")), (N, IntLit(1))))))))))))))) +//│ TypingUnit(List(NuTypeDef(Cls,TypeName(A),List(),Some(Tup(List((None,Fld(FldFlags(false,false,false),Var(x)))))),None,None,List(),None,None,TypingUnit(List(NuFunDef(None,Var(foo),None,List(),Left(IntLit(0))), NuFunDef(None,Var(bar),None,List(),Left(Var(x)))))), NuFunDef(Some(false),Var(x),None,List(),Left(Rft(NuNew(Var(A)),TypingUnit(List(NuFunDef(None,Var(foo),None,List(),Left(IntLit(1))), NuFunDef(None,Var(newFun),None,List(),Left(IntLit(2))), NuFunDef(None,Var(bar),None,List(),Left(Rft(App(NuNew(Var(A)),Tup(List((None,Fld(FldFlags(false,false,false),Var(foo)))))),TypingUnit(List(NuFunDef(None,Var(foo),None,List(),Left(App(Var(+),Tup(List((None,Fld(FldFlags(false,false,false),Var(bar))), (None,Fld(FldFlags(false,false,false),IntLit(1)))))))), NuFunDef(None,Var(bar2),None,List(),Left(App(Var(+),Tup(List((None,Fld(FldFlags(false,false,false),Var(newFun))), (None,Fld(FldFlags(false,false,false),IntLit(1)))))))))))))))))))) //│ Lifted: //│ TypingUnit { //│ class A$1([x,]) {fun foo = () => 0; fun bar = () => (this).x} @@ -437,7 +437,7 @@ new A{ //│ |#class| |A| |{||}|↵|#new| |A|{|→|#fun| |foo| |#=| |1|↵|#fun| |bar| |#=| |#new| |A|{|→|#fun| |foo1| |#=| |foo|↵|#fun| |bar1| |#=| |#new| |A|{|→|#fun| |foo2| |#=| |foo|↵|#fun| |bar2| |#=| |#new| |A|{|→|#fun| |foo3| |#=| |foo|↵|#fun| |bar3| |#=| |#new| |A|{|→|#fun| |foo4| |#=| |foo|↵|#fun| |bar4| |#=| |0|←|↵|}|←|↵|}|←|↵|}|←|↵|}|←|↵|}| //│ Parsed: {class A {}; new A { ‹fun foo = 1; fun bar = new A { ‹fun foo1 = foo; fun bar1 = new A { ‹fun foo2 = foo; fun bar2 = new A { ‹fun foo3 = foo; fun bar3 = new A { ‹fun foo4 = foo; fun bar4 = 0› }› }› }› }› }} //│ Parsed: -//│ TypingUnit(NuTypeDef(Cls, TypeName("A"), Ls(), N, N, N, Ls(), N, N, TypingUnit()), Rft(NuNew(Var("A")), TypingUnit(NuFunDef(None, foo, N, Nil, L(IntLit(1))), NuFunDef(None, bar, N, Nil, L(Rft(NuNew(Var("A")), TypingUnit(NuFunDef(None, foo1, N, Nil, L(Var("foo"))), NuFunDef(None, bar1, N, Nil, L(Rft(NuNew(Var("A")), TypingUnit(NuFunDef(None, foo2, N, Nil, L(Var("foo"))), NuFunDef(None, bar2, N, Nil, L(Rft(NuNew(Var("A")), TypingUnit(NuFunDef(None, foo3, N, Nil, L(Var("foo"))), NuFunDef(None, bar3, N, Nil, L(Rft(NuNew(Var("A")), TypingUnit(NuFunDef(None, foo4, N, Nil, L(Var("foo"))), NuFunDef(None, bar4, N, Nil, L(IntLit(0)))))))))))))))))))))) +//│ TypingUnit(List(NuTypeDef(Cls,TypeName(A),List(),None,None,None,List(),None,None,TypingUnit(List())), Rft(NuNew(Var(A)),TypingUnit(List(NuFunDef(None,Var(foo),None,List(),Left(IntLit(1))), NuFunDef(None,Var(bar),None,List(),Left(Rft(NuNew(Var(A)),TypingUnit(List(NuFunDef(None,Var(foo1),None,List(),Left(Var(foo))), NuFunDef(None,Var(bar1),None,List(),Left(Rft(NuNew(Var(A)),TypingUnit(List(NuFunDef(None,Var(foo2),None,List(),Left(Var(foo))), NuFunDef(None,Var(bar2),None,List(),Left(Rft(NuNew(Var(A)),TypingUnit(List(NuFunDef(None,Var(foo3),None,List(),Left(Var(foo))), NuFunDef(None,Var(bar3),None,List(),Left(Rft(NuNew(Var(A)),TypingUnit(List(NuFunDef(None,Var(foo4),None,List(),Left(Var(foo))), NuFunDef(None,Var(bar4),None,List(),Left(IntLit(0)))))))))))))))))))))))))))) //│ Lifted: //│ TypingUnit {class A$1([]) {}; Code(List(new A$1([]) {}))} //│ diff --git a/compiler/shared/test/diff/LifterBlks.mls b/compiler/shared/test/diff/LifterBlks.mls index b053241fd..f5e52e146 100644 --- a/compiler/shared/test/diff/LifterBlks.mls +++ b/compiler/shared/test/diff/LifterBlks.mls @@ -7,7 +7,7 @@ fun foo = //│ |#fun| |foo| |#=|→|print|(|"ok"|)|↵|print|(|"ko"|)|←| //│ Parsed: {fun foo = {print("ok",); print("ko",)}} //│ Parsed: -//│ TypingUnit(NuFunDef(None, foo, N, Nil, L(Blk(App(Var("print"), Tup((N, StrLit(ok)))), App(Var("print"), Tup((N, StrLit(ko)))))))) +//│ TypingUnit(List(NuFunDef(None,Var(foo),None,List(),Left(Blk(List(App(Var(print),Tup(List((None,Fld(FldFlags(false,false,false),StrLit(ok)))))), App(Var(print),Tup(List((None,Fld(FldFlags(false,false,false),StrLit(ko)))))))))))) //│ Lifted: //│ TypingUnit {fun foo$1 = () => {print("ok",); print("ko",)}} //│ @@ -19,7 +19,7 @@ class A{ //│ |#class| |A|{|→|#class| |B| |{||}|↵|#fun| |foo|(|x|#:| |B|)| |#=| |(|x| |#:| |B|)|←|↵|}| //│ Parsed: {class A {class B {}; fun foo = (x: B,) => '(' x : B ')'}} //│ Parsed: -//│ TypingUnit(NuTypeDef(Cls, TypeName("A"), Ls(), N, N, N, Ls(), N, N, TypingUnit(NuTypeDef(Cls, TypeName("B"), Ls(), N, N, N, Ls(), N, N, TypingUnit()), NuFunDef(None, foo, N, Nil, L(Lam(Tup((S(Var("x")), Var("B"))), Bra(rcd = false, Asc(Var("x"), TypeName("B"))))))))) +//│ TypingUnit(List(NuTypeDef(Cls,TypeName(A),List(),None,None,None,List(),None,None,TypingUnit(List(NuTypeDef(Cls,TypeName(B),List(),None,None,None,List(),None,None,TypingUnit(List())), NuFunDef(None,Var(foo),None,List(),Left(Lam(Tup(List((Some(Var(x)),Fld(FldFlags(false,false,false),Var(B))))),Bra(false,Asc(Var(x),TypeName(B))))))))))) //│ Lifted: //│ TypingUnit { //│ class A$1_B$2([par$A$1,]) {} @@ -41,7 +41,7 @@ fun foo = //│ |#fun| |foo| |#=|→|#let| |local|(|x|)| |#=|→|#class| |Foo| |{|→|#fun| |bar| |#=| |x| |+| |1|←|↵|}|↵|Foo|(||)|.bar|←|↵|print| |#of| |local|(|0|)| |+| |local|(|1|)|↵|print| |#of| |(|local| |#of| |0|)| |+| |local| |#of| |1|↵|#fun| |tmp| |#=| |1|↵|print| |#of| |local| |#of| |0| |+| |local| |#of| |1|↵|#fun| |tmp| |#=| |2|←| //│ Parsed: {fun foo = {let local = (x,) => {class Foo {fun bar = +(x, 1,)}; (Foo()).bar}; print(+(local(0,), local(1,),),); print(+('(' local(0,) ')', local(1,),),); fun tmp = 1; print(local(+(0, local(1,),),),); fun tmp = 2}} //│ Parsed: -//│ TypingUnit(NuFunDef(None, foo, N, Nil, L(Blk(NuFunDef(Some(false), local, N, Nil, L(Lam(Tup((N, Var("x"))), Blk(NuTypeDef(Cls, TypeName("Foo"), Ls(), N, N, N, Ls(), N, N, TypingUnit(NuFunDef(None, bar, N, Nil, L(App(Var("+"), Tup((N, Var("x")), (N, IntLit(1)))))))), Sel(App(Var("Foo"), Tup()), bar))))), App(Var("print"), Tup((N, App(Var("+"), Tup((N, App(Var("local"), Tup((N, IntLit(0))))), (N, App(Var("local"), Tup((N, IntLit(1)))))))))), App(Var("print"), Tup((N, App(Var("+"), Tup((N, Bra(rcd = false, App(Var("local"), Tup((N, IntLit(0)))))), (N, App(Var("local"), Tup((N, IntLit(1)))))))))), NuFunDef(None, tmp, N, Nil, L(IntLit(1))), App(Var("print"), Tup((N, App(Var("local"), Tup((N, App(Var("+"), Tup((N, IntLit(0)), (N, App(Var("local"), Tup((N, IntLit(1))))))))))))), NuFunDef(None, tmp, N, Nil, L(IntLit(2))))))) +//│ TypingUnit(List(NuFunDef(None,Var(foo),None,List(),Left(Blk(List(NuFunDef(Some(false),Var(local),None,List(),Left(Lam(Tup(List((None,Fld(FldFlags(false,false,false),Var(x))))),Blk(List(NuTypeDef(Cls,TypeName(Foo),List(),None,None,None,List(),None,None,TypingUnit(List(NuFunDef(None,Var(bar),None,List(),Left(App(Var(+),Tup(List((None,Fld(FldFlags(false,false,false),Var(x))), (None,Fld(FldFlags(false,false,false),IntLit(1))))))))))), Sel(App(Var(Foo),Tup(List())),Var(bar))))))), App(Var(print),Tup(List((None,Fld(FldFlags(false,false,false),App(Var(+),Tup(List((None,Fld(FldFlags(false,false,false),App(Var(local),Tup(List((None,Fld(FldFlags(false,false,false),IntLit(0)))))))), (None,Fld(FldFlags(false,false,false),App(Var(local),Tup(List((None,Fld(FldFlags(false,false,false),IntLit(1)))))))))))))))), App(Var(print),Tup(List((None,Fld(FldFlags(false,false,false),App(Var(+),Tup(List((None,Fld(FldFlags(false,false,false),Bra(false,App(Var(local),Tup(List((None,Fld(FldFlags(false,false,false),IntLit(0))))))))), (None,Fld(FldFlags(false,false,false),App(Var(local),Tup(List((None,Fld(FldFlags(false,false,false),IntLit(1)))))))))))))))), NuFunDef(None,Var(tmp),None,List(),Left(IntLit(1))), App(Var(print),Tup(List((None,Fld(FldFlags(false,false,false),App(Var(local),Tup(List((None,Fld(FldFlags(false,false,false),App(Var(+),Tup(List((None,Fld(FldFlags(false,false,false),IntLit(0))), (None,Fld(FldFlags(false,false,false),App(Var(local),Tup(List((None,Fld(FldFlags(false,false,false),IntLit(1))))))))))))))))))))), NuFunDef(None,Var(tmp),None,List(),Left(IntLit(2))))))))) //│ Lifted: //│ TypingUnit { //│ class Foo$1([x,]) {fun bar = () => +((this).x, 1,)} @@ -57,7 +57,7 @@ f(0) //│ |#class| |A|(|y|)|{||}|↵|#let| |f| |#=| |x| |#=>| |#new| |A|(|0|)|{|#fun| |bar| |#=| |x|+|y|}|↵|f|(|0|)| //│ Parsed: {class A(y,) {}; let f = (x,) => (new A)(0,) { ‹fun bar = +(x, y,)› }; f(0,)} //│ Parsed: -//│ TypingUnit(NuTypeDef(Cls, TypeName("A"), Ls(), S(Tup((N, Var("y")))), N, N, Ls(), N, N, TypingUnit()), NuFunDef(Some(false), f, N, Nil, L(Lam(Tup((N, Var("x"))), Rft(App(NuNew(Var("A")), Tup((N, IntLit(0)))), TypingUnit(NuFunDef(None, bar, N, Nil, L(App(Var("+"), Tup((N, Var("x")), (N, Var("y"))))))))))), App(Var("f"), Tup((N, IntLit(0))))) +//│ TypingUnit(List(NuTypeDef(Cls,TypeName(A),List(),Some(Tup(List((None,Fld(FldFlags(false,false,false),Var(y)))))),None,None,List(),None,None,TypingUnit(List())), NuFunDef(Some(false),Var(f),None,List(),Left(Lam(Tup(List((None,Fld(FldFlags(false,false,false),Var(x))))),Rft(App(NuNew(Var(A)),Tup(List((None,Fld(FldFlags(false,false,false),IntLit(0)))))),TypingUnit(List(NuFunDef(None,Var(bar),None,List(),Left(App(Var(+),Tup(List((None,Fld(FldFlags(false,false,false),Var(x))), (None,Fld(FldFlags(false,false,false),Var(y)))))))))))))), App(Var(f),Tup(List((None,Fld(FldFlags(false,false,false),IntLit(0)))))))) //│ Lifted: //│ TypingUnit { //│ class A$1([y,]) {} @@ -80,7 +80,7 @@ class A(x){ //│ |#class| |A|(|x|)|{|→|#fun| |w| |#=| |x|↵|#fun| |foo|(|y|)| |#=| |→|#class| |B|(|z|)|{|→|#fun| |bar| |#=| |x|+|y|+|z|←|↵|}|↵|#new| |B|(|0|)|{|→|#fun| |bar| |#=| |w|+|y|+|z|←|↵|}|←|←|↵|}| //│ Parsed: {class A(x,) {fun w = x; fun foo = (y,) => {class B(z,) {fun bar = +(+(x, y,), z,)}; (new B)(0,) { ‹fun bar = +(+(w, y,), z,)› }}}} //│ Parsed: -//│ TypingUnit(NuTypeDef(Cls, TypeName("A"), Ls(), S(Tup((N, Var("x")))), N, N, Ls(), N, N, TypingUnit(NuFunDef(None, w, N, Nil, L(Var("x"))), NuFunDef(None, foo, N, Nil, L(Lam(Tup((N, Var("y"))), Blk(NuTypeDef(Cls, TypeName("B"), Ls(), S(Tup((N, Var("z")))), N, N, Ls(), N, N, TypingUnit(NuFunDef(None, bar, N, Nil, L(App(Var("+"), Tup((N, App(Var("+"), Tup((N, Var("x")), (N, Var("y"))))), (N, Var("z")))))))), Rft(App(NuNew(Var("B")), Tup((N, IntLit(0)))), TypingUnit(NuFunDef(None, bar, N, Nil, L(App(Var("+"), Tup((N, App(Var("+"), Tup((N, Var("w")), (N, Var("y"))))), (N, Var("z"))))))))))))))) +//│ TypingUnit(List(NuTypeDef(Cls,TypeName(A),List(),Some(Tup(List((None,Fld(FldFlags(false,false,false),Var(x)))))),None,None,List(),None,None,TypingUnit(List(NuFunDef(None,Var(w),None,List(),Left(Var(x))), NuFunDef(None,Var(foo),None,List(),Left(Lam(Tup(List((None,Fld(FldFlags(false,false,false),Var(y))))),Blk(List(NuTypeDef(Cls,TypeName(B),List(),Some(Tup(List((None,Fld(FldFlags(false,false,false),Var(z)))))),None,None,List(),None,None,TypingUnit(List(NuFunDef(None,Var(bar),None,List(),Left(App(Var(+),Tup(List((None,Fld(FldFlags(false,false,false),App(Var(+),Tup(List((None,Fld(FldFlags(false,false,false),Var(x))), (None,Fld(FldFlags(false,false,false),Var(y)))))))), (None,Fld(FldFlags(false,false,false),Var(z))))))))))), Rft(App(NuNew(Var(B)),Tup(List((None,Fld(FldFlags(false,false,false),IntLit(0)))))),TypingUnit(List(NuFunDef(None,Var(bar),None,List(),Left(App(Var(+),Tup(List((None,Fld(FldFlags(false,false,false),App(Var(+),Tup(List((None,Fld(FldFlags(false,false,false),Var(w))), (None,Fld(FldFlags(false,false,false),Var(y)))))))), (None,Fld(FldFlags(false,false,false),Var(z))))))))))))))))))))) //│ Lifted: //│ TypingUnit { //│ class A$1_B$2([par$A$1, z, y,]) { @@ -111,7 +111,7 @@ fun f(x,y,z) = //│ |#fun| |f|(|x|,|y|,|z|)| |#=| |→|#class| |A|{|→|#fun| |foo| |#=| |#new| |B|↵|#fun| |bar1| |#=| |x|←|↵|}|↵|#class| |B|{|→|#fun| |foo| |#=| |#new| |A|↵|#fun| |bar2| |#=| |y|←|↵|}|↵|#class| |C| |#extends| |A|,| |B| |{|→|#fun| |bar| |#=| |bar1| |+| |bar2|←|↵|}|←| //│ Parsed: {fun f = (x, y, z,) => {class A {fun foo = new B; fun bar1 = x}; class B {fun foo = new A; fun bar2 = y}; class C: A, B {fun bar = +(bar1, bar2,)}}} //│ Parsed: -//│ TypingUnit(NuFunDef(None, f, N, Nil, L(Lam(Tup((N, Var("x")), (N, Var("y")), (N, Var("z"))), Blk(NuTypeDef(Cls, TypeName("A"), Ls(), N, N, N, Ls(), N, N, TypingUnit(NuFunDef(None, foo, N, Nil, L(NuNew(Var("B")))), NuFunDef(None, bar1, N, Nil, L(Var("x"))))), NuTypeDef(Cls, TypeName("B"), Ls(), N, N, N, Ls(), N, N, TypingUnit(NuFunDef(None, foo, N, Nil, L(NuNew(Var("A")))), NuFunDef(None, bar2, N, Nil, L(Var("y"))))), NuTypeDef(Cls, TypeName("C"), Ls(), N, N, N, Ls(Var("A"), Var("B")), N, N, TypingUnit(NuFunDef(None, bar, N, Nil, L(App(Var("+"), Tup((N, Var("bar1")), (N, Var("bar2"))))))))))))) +//│ TypingUnit(List(NuFunDef(None,Var(f),None,List(),Left(Lam(Tup(List((None,Fld(FldFlags(false,false,false),Var(x))), (None,Fld(FldFlags(false,false,false),Var(y))), (None,Fld(FldFlags(false,false,false),Var(z))))),Blk(List(NuTypeDef(Cls,TypeName(A),List(),None,None,None,List(),None,None,TypingUnit(List(NuFunDef(None,Var(foo),None,List(),Left(NuNew(Var(B)))), NuFunDef(None,Var(bar1),None,List(),Left(Var(x)))))), NuTypeDef(Cls,TypeName(B),List(),None,None,None,List(),None,None,TypingUnit(List(NuFunDef(None,Var(foo),None,List(),Left(NuNew(Var(A)))), NuFunDef(None,Var(bar2),None,List(),Left(Var(y)))))), NuTypeDef(Cls,TypeName(C),List(),None,None,None,List(Var(A), Var(B)),None,None,TypingUnit(List(NuFunDef(None,Var(bar),None,List(),Left(App(Var(+),Tup(List((None,Fld(FldFlags(false,false,false),Var(bar1))), (None,Fld(FldFlags(false,false,false),Var(bar2)))))))))))))))))) //│ Lifted: //│ TypingUnit { //│ class A$1([x, y,]) { @@ -142,7 +142,7 @@ fun f(x,y,z) = //│ |#fun| |f|(|x|,|y|,|z|)| |#=| |→|#class| |C|{|→|#class| |A|{|→|#fun| |foo| |#=| |#new| |B|↵|#fun| |bar1| |#=| |x|←|↵|}|↵|#class| |B|{|→|#fun| |foo| |#=| |#new| |A|↵|#fun| |bar2| |#=| |y|←|↵|}|↵|#fun| |boo| |#=| |(|#new| |A|)|.bar1| |+| |B|(||)|.bar2| |+| |z|←|↵|}|←| //│ Parsed: {fun f = (x, y, z,) => {class C {class A {fun foo = new B; fun bar1 = x}; class B {fun foo = new A; fun bar2 = y}; fun boo = +(+(('(' new A ')').bar1, (B()).bar2,), z,)}}} //│ Parsed: -//│ TypingUnit(NuFunDef(None, f, N, Nil, L(Lam(Tup((N, Var("x")), (N, Var("y")), (N, Var("z"))), Blk(NuTypeDef(Cls, TypeName("C"), Ls(), N, N, N, Ls(), N, N, TypingUnit(NuTypeDef(Cls, TypeName("A"), Ls(), N, N, N, Ls(), N, N, TypingUnit(NuFunDef(None, foo, N, Nil, L(NuNew(Var("B")))), NuFunDef(None, bar1, N, Nil, L(Var("x"))))), NuTypeDef(Cls, TypeName("B"), Ls(), N, N, N, Ls(), N, N, TypingUnit(NuFunDef(None, foo, N, Nil, L(NuNew(Var("A")))), NuFunDef(None, bar2, N, Nil, L(Var("y"))))), NuFunDef(None, boo, N, Nil, L(App(Var("+"), Tup((N, App(Var("+"), Tup((N, Sel(Bra(rcd = false, NuNew(Var("A"))), bar1)), (N, Sel(App(Var("B"), Tup()), bar2))))), (N, Var("z"))))))))))))) +//│ TypingUnit(List(NuFunDef(None,Var(f),None,List(),Left(Lam(Tup(List((None,Fld(FldFlags(false,false,false),Var(x))), (None,Fld(FldFlags(false,false,false),Var(y))), (None,Fld(FldFlags(false,false,false),Var(z))))),Blk(List(NuTypeDef(Cls,TypeName(C),List(),None,None,None,List(),None,None,TypingUnit(List(NuTypeDef(Cls,TypeName(A),List(),None,None,None,List(),None,None,TypingUnit(List(NuFunDef(None,Var(foo),None,List(),Left(NuNew(Var(B)))), NuFunDef(None,Var(bar1),None,List(),Left(Var(x)))))), NuTypeDef(Cls,TypeName(B),List(),None,None,None,List(),None,None,TypingUnit(List(NuFunDef(None,Var(foo),None,List(),Left(NuNew(Var(A)))), NuFunDef(None,Var(bar2),None,List(),Left(Var(y)))))), NuFunDef(None,Var(boo),None,List(),Left(App(Var(+),Tup(List((None,Fld(FldFlags(false,false,false),App(Var(+),Tup(List((None,Fld(FldFlags(false,false,false),Sel(Bra(false,NuNew(Var(A))),Var(bar1)))), (None,Fld(FldFlags(false,false,false),Sel(App(Var(B),Tup(List())),Var(bar2))))))))), (None,Fld(FldFlags(false,false,false),Var(z)))))))))))))))))) //│ Lifted: //│ TypingUnit { //│ class C$1_A$2([par$C$1,]) { @@ -168,7 +168,7 @@ fun f(y) = //│ |#fun| |f|(|y|)| |#=|→|#let| |g|(|x|)| |#=| |x| |+| |y| |+| |1|↵|#class| |Foo|(|x|)| |{|→|#fun| |h| |#=| |g|(|x|)|←|↵|}|←| //│ Parsed: {fun f = (y,) => {let g = (x,) => +(+(x, y,), 1,); class Foo(x,) {fun h = g(x,)}}} //│ Parsed: -//│ TypingUnit(NuFunDef(None, f, N, Nil, L(Lam(Tup((N, Var("y"))), Blk(NuFunDef(Some(false), g, N, Nil, L(Lam(Tup((N, Var("x"))), App(Var("+"), Tup((N, App(Var("+"), Tup((N, Var("x")), (N, Var("y"))))), (N, IntLit(1))))))), NuTypeDef(Cls, TypeName("Foo"), Ls(), S(Tup((N, Var("x")))), N, N, Ls(), N, N, TypingUnit(NuFunDef(None, h, N, Nil, L(App(Var("g"), Tup((N, Var("x"))))))))))))) +//│ TypingUnit(List(NuFunDef(None,Var(f),None,List(),Left(Lam(Tup(List((None,Fld(FldFlags(false,false,false),Var(y))))),Blk(List(NuFunDef(Some(false),Var(g),None,List(),Left(Lam(Tup(List((None,Fld(FldFlags(false,false,false),Var(x))))),App(Var(+),Tup(List((None,Fld(FldFlags(false,false,false),App(Var(+),Tup(List((None,Fld(FldFlags(false,false,false),Var(x))), (None,Fld(FldFlags(false,false,false),Var(y)))))))), (None,Fld(FldFlags(false,false,false),IntLit(1))))))))), NuTypeDef(Cls,TypeName(Foo),List(),Some(Tup(List((None,Fld(FldFlags(false,false,false),Var(x)))))),None,None,List(),None,None,TypingUnit(List(NuFunDef(None,Var(h),None,List(),Left(App(Var(g),Tup(List((None,Fld(FldFlags(false,false,false),Var(x)))))))))))))))))) //│ Lifted: //│ TypingUnit { //│ class Foo$1([x, y,]) {fun h = () => g$2((this).x, y,)} @@ -180,7 +180,7 @@ fun f(y) = //│ | |Foo|(|1|)|.h| //│ Parsed: {(Foo(1,)).h} //│ Parsed: -//│ TypingUnit(Sel(App(Var("Foo"), Tup((N, IntLit(1)))), h)) +//│ TypingUnit(List(Sel(App(Var(Foo),Tup(List((None,Fld(FldFlags(false,false,false),IntLit(1)))))),Var(h)))) //│ Lifted: //│ TypingUnit {Code(List((Foo(1,)).h))} //│ @@ -188,7 +188,7 @@ fun f(y) = //│ | |Foo|(|x|)|.h| //│ Parsed: {(Foo(x,)).h} //│ Parsed: -//│ TypingUnit(Sel(App(Var("Foo"), Tup((N, Var("x")))), h)) +//│ TypingUnit(List(Sel(App(Var(Foo),Tup(List((None,Fld(FldFlags(false,false,false),Var(x)))))),Var(h)))) //│ Lifted: //│ TypingUnit {Code(List((Foo(x,)).h))} //│ @@ -204,7 +204,7 @@ fun f(x) = //│ |#fun| |f|(|x|)| |#=|→|#let| |g|(|x|)| |#=| |→|#let| |h|(|x|)| |#=| |x| |+| |2|↵|Foo|(|h|(|x|)|,| |x|)|.bar|←|↵|#class| |Foo|(|x|,| |y|)| |{|→|#fun| |bar| |#=| |g|(|x|)|+|y|←|↵|}|↵|Foo|(|x|,| |x|)|.bar|←| //│ Parsed: {fun f = (x,) => {let g = (x,) => {let h = (x,) => +(x, 2,); (Foo(h(x,), x,)).bar}; class Foo(x, y,) {fun bar = +(g(x,), y,)}; (Foo(x, x,)).bar}} //│ Parsed: -//│ TypingUnit(NuFunDef(None, f, N, Nil, L(Lam(Tup((N, Var("x"))), Blk(NuFunDef(Some(false), g, N, Nil, L(Lam(Tup((N, Var("x"))), Blk(NuFunDef(Some(false), h, N, Nil, L(Lam(Tup((N, Var("x"))), App(Var("+"), Tup((N, Var("x")), (N, IntLit(2))))))), Sel(App(Var("Foo"), Tup((N, App(Var("h"), Tup((N, Var("x"))))), (N, Var("x")))), bar))))), NuTypeDef(Cls, TypeName("Foo"), Ls(), S(Tup((N, Var("x")), (N, Var("y")))), N, N, Ls(), N, N, TypingUnit(NuFunDef(None, bar, N, Nil, L(App(Var("+"), Tup((N, App(Var("g"), Tup((N, Var("x"))))), (N, Var("y")))))))), Sel(App(Var("Foo"), Tup((N, Var("x")), (N, Var("x")))), bar)))))) +//│ TypingUnit(List(NuFunDef(None,Var(f),None,List(),Left(Lam(Tup(List((None,Fld(FldFlags(false,false,false),Var(x))))),Blk(List(NuFunDef(Some(false),Var(g),None,List(),Left(Lam(Tup(List((None,Fld(FldFlags(false,false,false),Var(x))))),Blk(List(NuFunDef(Some(false),Var(h),None,List(),Left(Lam(Tup(List((None,Fld(FldFlags(false,false,false),Var(x))))),App(Var(+),Tup(List((None,Fld(FldFlags(false,false,false),Var(x))), (None,Fld(FldFlags(false,false,false),IntLit(2))))))))), Sel(App(Var(Foo),Tup(List((None,Fld(FldFlags(false,false,false),App(Var(h),Tup(List((None,Fld(FldFlags(false,false,false),Var(x)))))))), (None,Fld(FldFlags(false,false,false),Var(x)))))),Var(bar))))))), NuTypeDef(Cls,TypeName(Foo),List(),Some(Tup(List((None,Fld(FldFlags(false,false,false),Var(x))), (None,Fld(FldFlags(false,false,false),Var(y)))))),None,None,List(),None,None,TypingUnit(List(NuFunDef(None,Var(bar),None,List(),Left(App(Var(+),Tup(List((None,Fld(FldFlags(false,false,false),App(Var(g),Tup(List((None,Fld(FldFlags(false,false,false),Var(x)))))))), (None,Fld(FldFlags(false,false,false),Var(y))))))))))), Sel(App(Var(Foo),Tup(List((None,Fld(FldFlags(false,false,false),Var(x))), (None,Fld(FldFlags(false,false,false),Var(x)))))),Var(bar))))))))) //│ Lifted: //│ TypingUnit { //│ class Foo$1([x, y,]) {fun bar = () => +(g$2((this).x,), (this).y,)} @@ -218,7 +218,7 @@ class Foo(x, y) extends Bar(y, x), Baz(x + y) //│ |#class| |Foo|(|x|,| |y|)| |#extends| |Bar|(|y|,| |x|)|,| |Baz|(|x| |+| |y|)| //│ Parsed: {class Foo(x, y,): Bar(y, x,), Baz(+(x, y,),) {}} //│ Parsed: -//│ TypingUnit(NuTypeDef(Cls, TypeName("Foo"), Ls(), S(Tup((N, Var("x")), (N, Var("y")))), N, N, Ls(App(Var("Bar"), Tup((N, Var("y")), (N, Var("x")))), App(Var("Baz"), Tup((N, App(Var("+"), Tup((N, Var("x")), (N, Var("y")))))))), N, N, TypingUnit())) +//│ TypingUnit(List(NuTypeDef(Cls,TypeName(Foo),List(),Some(Tup(List((None,Fld(FldFlags(false,false,false),Var(x))), (None,Fld(FldFlags(false,false,false),Var(y)))))),None,None,List(App(Var(Bar),Tup(List((None,Fld(FldFlags(false,false,false),Var(y))), (None,Fld(FldFlags(false,false,false),Var(x)))))), App(Var(Baz),Tup(List((None,Fld(FldFlags(false,false,false),App(Var(+),Tup(List((None,Fld(FldFlags(false,false,false),Var(x))), (None,Fld(FldFlags(false,false,false),Var(y)))))))))))),None,None,TypingUnit(List())))) //│ Lifted: //│ TypingUnit { //│ class Foo$1([x, y,]): Bar((this).y, (this).x,), Baz(+((this).x, (this).y,),) {} @@ -233,7 +233,7 @@ fun foo(x: T): string = //│ |#fun| |foo|‹|T|,| |U|›|(|x|#:| |T|)|#:| |string| |#=| |→|#class| |A|(|y|)| |#extends| |B|‹|T|›|,| |C|(|y|#:| |U|)| |{|→|#fun| |bar| |#=| |this|←|↵|}|↵|"rua"|←| //│ Parsed: {fun foo = (x: T,) => {class A(y,): B‹T›, C(y: U,) {fun bar = this}; "rua"} : string} //│ Parsed: -//│ TypingUnit(NuFunDef(None, foo, N, TypeName("T") :: TypeName("U") :: Nil, L(Lam(Tup((S(Var("x")), Var("T"))), Asc(Blk(NuTypeDef(Cls, TypeName("A"), Ls(), S(Tup((N, Var("y")))), N, N, Ls(TyApp(Var("B"), List(TypeName(T))), App(Var("C"), Tup((S(Var("y")), Var("U"))))), N, N, TypingUnit(NuFunDef(None, bar, N, Nil, L(Var("this"))))), StrLit(rua)), TypeName("string")))))) +//│ TypingUnit(List(NuFunDef(None,Var(foo),None,List(TypeName(T), TypeName(U)),Left(Lam(Tup(List((Some(Var(x)),Fld(FldFlags(false,false,false),Var(T))))),Asc(Blk(List(NuTypeDef(Cls,TypeName(A),List(),Some(Tup(List((None,Fld(FldFlags(false,false,false),Var(y)))))),None,None,List(TyApp(Var(B),List(TypeName(T))), App(Var(C),Tup(List((Some(Var(y)),Fld(FldFlags(false,false,false),Var(U))))))),None,None,TypingUnit(List(NuFunDef(None,Var(bar),None,List(),Left(Var(this)))))), StrLit(rua))),TypeName(string))))))) //│ Lifted: //│ TypingUnit { //│ class A$1[T,U]([y,]): B‹T›, C(y: U,) {fun bar = () => this} @@ -250,7 +250,7 @@ class A{ //│ |#class| |A|‹|T|›|{|→|#class| |B|{|→|#fun| |f| |#=| |x| |#=>| |y| |#=>| |x|↵|#fun| |g|#:| |T| |#=>| |B| |#=>| |T|←|↵|}|←|↵|}| //│ Parsed: {class A‹T› {class B {fun f = (x,) => (y,) => x; fun g: T -> B -> T}}} //│ Parsed: -//│ TypingUnit(NuTypeDef(Cls, TypeName("A"), Ls(N -> TypeName("T")), N, N, N, Ls(), N, N, TypingUnit(NuTypeDef(Cls, TypeName("B"), Ls(), N, N, N, Ls(), N, N, TypingUnit(NuFunDef(None, f, N, Nil, L(Lam(Tup((N, Var("x"))), Lam(Tup((N, Var("y"))), Var("x"))))), NuFunDef(None, g, N, Nil, R(PolyType(Ls(), Function(Tuple(N -> Fld(N, TypeName("T"))), Function(Tuple(N -> Fld(N, TypeName("B"))), TypeName("T"))))))))))) +//│ TypingUnit(List(NuTypeDef(Cls,TypeName(A),List((None,TypeName(T))),None,None,None,List(),None,None,TypingUnit(List(NuTypeDef(Cls,TypeName(B),List(),None,None,None,List(),None,None,TypingUnit(List(NuFunDef(None,Var(f),None,List(),Left(Lam(Tup(List((None,Fld(FldFlags(false,false,false),Var(x))))),Lam(Tup(List((None,Fld(FldFlags(false,false,false),Var(y))))),Var(x))))), NuFunDef(None,Var(g),None,List(),Right(PolyType(List(),Function(Tuple(List((None,Field(None,TypeName(T))))),Function(Tuple(List((None,Field(None,TypeName(B))))),TypeName(T)))))))))))))) //│ Lifted: //│ TypingUnit { //│ class A$1_B$2_Lambda1$1$3([par$A$1_B$2, x,]) {fun apply = (y,) => (this).x} @@ -270,7 +270,7 @@ class Foo{ //│ |#class| |Foo|‹|T|›|{|→|#class| |RectangleBox|#:| |Box|‹|T|›| |&| |{| |breadth|#:| |T| |}|↵|#class| |StackedRectangleBoxes|‹|N|›| |#:| |RectangleBox|‹|T|›| |&| |{| |size|#:| |N| |}|↵|#class| |Bar|#:| |{|any|#:| |RectangleBox| |#=>| |StackedRectangleBoxes|}|←|↵|}| //│ Parsed: {class Foo‹T› {class RectangleBox: Box[T] & {breadth: T} {}; class StackedRectangleBoxes‹N›: RectangleBox[T] & {size: N} {}; class Bar: {any: RectangleBox -> StackedRectangleBoxes} {}}} //│ Parsed: -//│ TypingUnit(NuTypeDef(Cls, TypeName("Foo"), Ls(N -> TypeName("T")), N, N, N, Ls(), N, N, TypingUnit(NuTypeDef(Cls, TypeName("RectangleBox"), Ls(), N, N, S(Inter(AppliedType(TypeName("Box"), TypeName("T") :: Nil), Record(breadth: Fld(N, TypeName("T"))))), Ls(), N, N, TypingUnit()), NuTypeDef(Cls, TypeName("StackedRectangleBoxes"), Ls(N -> TypeName("N")), N, N, S(Inter(AppliedType(TypeName("RectangleBox"), TypeName("T") :: Nil), Record(size: Fld(N, TypeName("N"))))), Ls(), N, N, TypingUnit()), NuTypeDef(Cls, TypeName("Bar"), Ls(), N, N, S(Record(any: Fld(N, Function(Tuple(N -> Fld(N, TypeName("RectangleBox"))), TypeName("StackedRectangleBoxes"))))), Ls(), N, N, TypingUnit())))) +//│ TypingUnit(List(NuTypeDef(Cls,TypeName(Foo),List((None,TypeName(T))),None,None,None,List(),None,None,TypingUnit(List(NuTypeDef(Cls,TypeName(RectangleBox),List(),None,None,Some(Inter(AppliedType(TypeName(Box),List(TypeName(T))),Record(List((Var(breadth),Field(None,TypeName(T))))))),List(),None,None,TypingUnit(List())), NuTypeDef(Cls,TypeName(StackedRectangleBoxes),List((None,TypeName(N))),None,None,Some(Inter(AppliedType(TypeName(RectangleBox),List(TypeName(T))),Record(List((Var(size),Field(None,TypeName(N))))))),List(),None,None,TypingUnit(List())), NuTypeDef(Cls,TypeName(Bar),List(),None,None,Some(Record(List((Var(any),Field(None,Function(Tuple(List((None,Field(None,TypeName(RectangleBox))))),TypeName(StackedRectangleBoxes))))))),List(),None,None,TypingUnit(List()))))))) //│ Lifted: //│ TypingUnit { //│ class Foo$1_RectangleBox$2([par$Foo$1,]) {} @@ -293,7 +293,7 @@ fun ctx(a,b) = //│ |#class| |Func|‹|T|,| |U|›| |{|→|#fun| |apply|#:| |T| |#=>| |U|←|↵|}|↵|#class| |Lambda|‹|T|,| |U|›| |#:| |Func|‹|T|,| |U|›| |{||}|↵|#fun| |ctx|(|a|,|b|)| |#=|→|#fun| |foo|(|f|#:| |Func|,| |x|)| |#=| |→|f|.apply|(|x|)|←|↵|foo|(|#new| |Lambda|{|→|#fun| |apply|(|x|)| |#=| |a|+|x|←|↵|}|,| |b|)|←| //│ Parsed: {class Func‹T, U› {fun apply: T -> U}; class Lambda‹T, U›: Func[T, U] {}; fun ctx = (a, b,) => {fun foo = (f: Func, x,) => {(f).apply(x,)}; foo(new Lambda { ‹fun apply = (x,) => +(a, x,)› }, b,)}} //│ Parsed: -//│ TypingUnit(NuTypeDef(Cls, TypeName("Func"), Ls(N -> TypeName("T"), N -> TypeName("U")), N, N, N, Ls(), N, N, TypingUnit(NuFunDef(None, apply, N, Nil, R(PolyType(Ls(), Function(Tuple(N -> Fld(N, TypeName("T"))), TypeName("U"))))))), NuTypeDef(Cls, TypeName("Lambda"), Ls(N -> TypeName("T"), N -> TypeName("U")), N, N, S(AppliedType(TypeName("Func"), TypeName("T") :: TypeName("U") :: Nil)), Ls(), N, N, TypingUnit()), NuFunDef(None, ctx, N, Nil, L(Lam(Tup((N, Var("a")), (N, Var("b"))), Blk(NuFunDef(None, foo, N, Nil, L(Lam(Tup((S(Var("f")), Var("Func")), (N, Var("x"))), Blk(App(Sel(Var("f"), apply), Tup((N, Var("x")))))))), App(Var("foo"), Tup((N, Rft(NuNew(Var("Lambda")), TypingUnit(NuFunDef(None, apply, N, Nil, L(Lam(Tup((N, Var("x"))), App(Var("+"), Tup((N, Var("a")), (N, Var("x")))))))))), (N, Var("b"))))))))) +//│ TypingUnit(List(NuTypeDef(Cls,TypeName(Func),List((None,TypeName(T)), (None,TypeName(U))),None,None,None,List(),None,None,TypingUnit(List(NuFunDef(None,Var(apply),None,List(),Right(PolyType(List(),Function(Tuple(List((None,Field(None,TypeName(T))))),TypeName(U)))))))), NuTypeDef(Cls,TypeName(Lambda),List((None,TypeName(T)), (None,TypeName(U))),None,None,Some(AppliedType(TypeName(Func),List(TypeName(T), TypeName(U)))),List(),None,None,TypingUnit(List())), NuFunDef(None,Var(ctx),None,List(),Left(Lam(Tup(List((None,Fld(FldFlags(false,false,false),Var(a))), (None,Fld(FldFlags(false,false,false),Var(b))))),Blk(List(NuFunDef(None,Var(foo),None,List(),Left(Lam(Tup(List((Some(Var(f)),Fld(FldFlags(false,false,false),Var(Func))), (None,Fld(FldFlags(false,false,false),Var(x))))),Blk(List(App(Sel(Var(f),Var(apply)),Tup(List((None,Fld(FldFlags(false,false,false),Var(x))))))))))), App(Var(foo),Tup(List((None,Fld(FldFlags(false,false,false),Rft(NuNew(Var(Lambda)),TypingUnit(List(NuFunDef(None,Var(apply),None,List(),Left(Lam(Tup(List((None,Fld(FldFlags(false,false,false),Var(x))))),App(Var(+),Tup(List((None,Fld(FldFlags(false,false,false),Var(a))), (None,Fld(FldFlags(false,false,false),Var(x)))))))))))))), (None,Fld(FldFlags(false,false,false),Var(b))))))))))))) //│ Lifted: //│ TypingUnit { //│ class Func$1[T,U]([]) {fun apply = T -> U} @@ -309,7 +309,7 @@ f(MyClass) //│ |#fun| |f|(|T|)| |#=| |→|#new| |T|(||)|←|↵|f|(|MyClass|)| //│ Parsed: {fun f = (T,) => {(new T)()}; f(MyClass,)} //│ Parsed: -//│ TypingUnit(NuFunDef(None, f, N, Nil, L(Lam(Tup((N, Var("T"))), Blk(App(NuNew(Var("T")), Tup()))))), App(Var("f"), Tup((N, Var("MyClass"))))) +//│ TypingUnit(List(NuFunDef(None,Var(f),None,List(),Left(Lam(Tup(List((None,Fld(FldFlags(false,false,false),Var(T))))),Blk(List(App(NuNew(Var(T)),Tup(List()))))))), App(Var(f),Tup(List((None,Fld(FldFlags(false,false,false),Var(MyClass)))))))) //│ Lifted: //│ Lifting failed: mlscript.codegen.CodeGenError: Cannot find type T. Class values are not supported in lifter. //│ @@ -322,7 +322,7 @@ class A { //│ |#class| |A| |{|→|#fun| |foo| |#=| |→|#fun| |bar| |#=| |foo|(||)|↵|bar|(||)|←|←|↵|}| //│ Parsed: {class A {fun foo = {fun bar = foo(); bar()}}} //│ Parsed: -//│ TypingUnit(NuTypeDef(Cls, TypeName("A"), Ls(), N, N, N, Ls(), N, N, TypingUnit(NuFunDef(None, foo, N, Nil, L(Blk(NuFunDef(None, bar, N, Nil, L(App(Var("foo"), Tup()))), App(Var("bar"), Tup()))))))) +//│ TypingUnit(List(NuTypeDef(Cls,TypeName(A),List(),None,None,None,List(),None,None,TypingUnit(List(NuFunDef(None,Var(foo),None,List(),Left(Blk(List(NuFunDef(None,Var(bar),None,List(),Left(App(Var(foo),Tup(List())))), App(Var(bar),Tup(List()))))))))))) //│ Lifted: //│ TypingUnit { //│ class A$1([]) {fun foo = () => {bar$1(this,)}} diff --git a/compiler/shared/test/diff/mono.mls b/compiler/shared/test/diff/mono.mls index 31ec3e212..43422ef6d 100644 --- a/compiler/shared/test/diff/mono.mls +++ b/compiler/shared/test/diff/mono.mls @@ -4,7 +4,7 @@ :mono fun f(x: Int) = if x then 42 else 1337 //│ Parsed: -//│ TypingUnit(NuFunDef(None, f, N, Nil, L(Lam(Tup((S(Var("x")), Var("Int"))), If(IfThen(Var("x"), IntLit(42), Some(IntLit(1337))))))) +//│ TypingUnit(List(NuFunDef(None,Var(f),None,List(),Left(Lam(Tup(List((Some(Var(x)),Fld(FldFlags(false,false,false),Var(Int))))),If(IfThen(Var(x),IntLit(42)),Some(IntLit(1337)))))))) //│ Lifted: //│ TypingUnit { //│ fun f$1 = (x: Int,) => if (x) then 42 else 1337 @@ -19,7 +19,7 @@ fun f(x: Int) = if x then 42 else 1337 :mono fun foo() = 42 //│ Parsed: -//│ TypingUnit(NuFunDef(None, foo, N, Nil, L(Lam(Tup(), IntLit(42))))) +//│ TypingUnit(List(NuFunDef(None,Var(foo),None,List(),Left(Lam(Tup(List()),IntLit(42)))))) //│ Lifted: //│ TypingUnit {fun foo$1 = () => 42} //│ Mono: @@ -34,7 +34,7 @@ fun foo(x, #b) = if b then x else 1337 let a = foo(42, true) let b = foo(23, false) //│ Parsed: -//│ TypingUnit(NuFunDef(None, foo, N, Nil, L(Lam(Tup((N, Var("x")), (N, Var("b"))), If(IfThen(Var("b"), Var("x"), Some(IntLit(1337)))))), NuFunDef(Some(false), a, N, Nil, L(App(Var("foo"), Tup((N, IntLit(42)), (N, Var("true")))))), NuFunDef(Some(false), b, N, Nil, L(App(Var("foo"), Tup((N, IntLit(23)), (N, Var("false"))))))) +//│ TypingUnit(List(NuFunDef(None,Var(foo),None,List(),Left(Lam(Tup(List((None,Fld(FldFlags(false,false,false),Var(x))), (None,Fld(FldFlags(false,true,false),Var(b))))),If(IfThen(Var(b),Var(x)),Some(IntLit(1337)))))), NuFunDef(Some(false),Var(a),None,List(),Left(App(Var(foo),Tup(List((None,Fld(FldFlags(false,false,false),IntLit(42))), (None,Fld(FldFlags(false,false,false),Var(true)))))))), NuFunDef(Some(false),Var(b),None,List(),Left(App(Var(foo),Tup(List((None,Fld(FldFlags(false,false,false),IntLit(23))), (None,Fld(FldFlags(false,false,false),Var(false)))))))))) //│ Lifted: //│ TypingUnit { //│ fun foo$3 = (x, #b,) => if (b) then x else 1337 @@ -61,7 +61,7 @@ let b = foo(23, false) :mono let x = 42 + 1337 //│ Parsed: -//│ TypingUnit(NuFunDef(Some(false), x, N, Nil, L(App(Var("+"), Tup((N, IntLit(42)), (N, IntLit(1337))))))) +//│ TypingUnit(List(NuFunDef(Some(false),Var(x),None,List(),Left(App(Var(+),Tup(List((None,Fld(FldFlags(false,false,false),IntLit(42))), (None,Fld(FldFlags(false,false,false),IntLit(1337)))))))))) //│ Lifted: //│ TypingUnit {let x$1 = () => +(42, 1337,)} //│ Mono: @@ -99,7 +99,7 @@ let x = 42 + 1337 if true then 1 else 0 if 1+1 > 1 then 1 - 1 else 1*1 //│ Parsed: -//│ TypingUnit(If(IfThen(Var("true"), IntLit(1), Some(IntLit(0))), If(IfThen(App(Var(">"), Tup((N, App(Var("+"), Tup((N, IntLit(1)), (N, IntLit(1))))), (N, IntLit(1)))), App(Var("-"), Tup((N, IntLit(1)), (N, IntLit(1)))), Some(App(Var("*"), Tup((N, IntLit(1)), (N, IntLit(1))))))) +//│ TypingUnit(List(If(IfThen(Var(true),IntLit(1)),Some(IntLit(0))), If(IfThen(App(Var(>),Tup(List((None,Fld(FldFlags(false,false,false),App(Var(+),Tup(List((None,Fld(FldFlags(false,false,false),IntLit(1))), (None,Fld(FldFlags(false,false,false),IntLit(1)))))))), (None,Fld(FldFlags(false,false,false),IntLit(1)))))),App(Var(-),Tup(List((None,Fld(FldFlags(false,false,false),IntLit(1))), (None,Fld(FldFlags(false,false,false),IntLit(1))))))),Some(App(Var(*),Tup(List((None,Fld(FldFlags(false,false,false),IntLit(1))), (None,Fld(FldFlags(false,false,false),IntLit(1)))))))))) //│ Lifted: //│ TypingUnit { //│ Code(List(if (true) then 1 else 0)) @@ -123,7 +123,7 @@ if 1+1 > 1 then 1 - 1 else 1*1 :mono if(b) then 1 else 2 //│ Parsed: -//│ TypingUnit(If(IfThen(Bra(rcd = false, Var("b")), IntLit(1), Some(IntLit(2)))) +//│ TypingUnit(List(If(IfThen(Bra(false,Var(b)),IntLit(1)),Some(IntLit(2))))) //│ Lifted: //│ TypingUnit {Code(List(if ('(' b ')') then 1 else 2))} //│ Mono: @@ -139,7 +139,7 @@ if(b) then 1 else 2 :mono ((f, g) => f(g))(f => f, true) //│ Parsed: -//│ TypingUnit(App(Bra(rcd = false, Lam(Tup((N, Var("f")), (N, Var("g"))), App(Var("f"), Tup((N, Var("g")))))), Tup((N, Lam(Tup((N, Var("f"))), Var("f"))), (N, Var("true"))))) +//│ TypingUnit(List(App(Bra(false,Lam(Tup(List((None,Fld(FldFlags(false,false,false),Var(f))), (None,Fld(FldFlags(false,false,false),Var(g))))),App(Var(f),Tup(List((None,Fld(FldFlags(false,false,false),Var(g)))))))),Tup(List((None,Fld(FldFlags(false,false,false),Lam(Tup(List((None,Fld(FldFlags(false,false,false),Var(f))))),Var(f)))), (None,Fld(FldFlags(false,false,false),Var(true)))))))) //│ Lifted: //│ TypingUnit { //│ class Lambda2$1$1([]) {fun apply = (f, g,) => f(g,)} @@ -168,7 +168,7 @@ if(b) then 1 else 2 :mono (b => if b then true else false) (true) //│ Parsed: -//│ TypingUnit(App(Bra(rcd = false, Lam(Tup((N, Var("b"))), If(IfThen(Var("b"), Var("true"), Some(Var("false"))))), Tup((N, Var("true"))))) +//│ TypingUnit(List(App(Bra(false,Lam(Tup(List((None,Fld(FldFlags(false,false,false),Var(b))))),If(IfThen(Var(b),Var(true)),Some(Var(false))))),Tup(List((None,Fld(FldFlags(false,false,false),Var(true)))))))) //│ Lifted: //│ TypingUnit { //│ class Lambda1$1$1([]) {fun apply = (b,) => if (b) then true else false} @@ -193,7 +193,7 @@ fun f(x) = if(x > 0) then x+1 else x - 1 f(2)+3 //│ Parsed: -//│ TypingUnit(NuFunDef(None, f, N, Nil, L(Lam(Tup((N, Var("x"))), Blk(If(IfThen(Bra(rcd = false, App(Var(">"), Tup((N, Var("x")), (N, IntLit(0))))), App(Var("+"), Tup((N, Var("x")), (N, IntLit(1)))), Some(App(Var("-"), Tup((N, Var("x")), (N, IntLit(1)))))))))), App(Var("+"), Tup((N, App(Var("f"), Tup((N, IntLit(2))))), (N, IntLit(3))))) +//│ TypingUnit(List(NuFunDef(None,Var(f),None,List(),Left(Lam(Tup(List((None,Fld(FldFlags(false,false,false),Var(x))))),Blk(List(If(IfThen(Bra(false,App(Var(>),Tup(List((None,Fld(FldFlags(false,false,false),Var(x))), (None,Fld(FldFlags(false,false,false),IntLit(0))))))),App(Var(+),Tup(List((None,Fld(FldFlags(false,false,false),Var(x))), (None,Fld(FldFlags(false,false,false),IntLit(1))))))),Some(App(Var(-),Tup(List((None,Fld(FldFlags(false,false,false),Var(x))), (None,Fld(FldFlags(false,false,false),IntLit(1))))))))))))), App(Var(+),Tup(List((None,Fld(FldFlags(false,false,false),App(Var(f),Tup(List((None,Fld(FldFlags(false,false,false),IntLit(2)))))))), (None,Fld(FldFlags(false,false,false),IntLit(3)))))))) //│ Lifted: //│ TypingUnit { //│ fun f$1 = (x,) => {if ('(' >(x, 0,) ')') then +(x, 1,) else -(x, 1,)} @@ -217,7 +217,7 @@ fun fac(n) = if (n > 1) then fac(n - 1) * n else 1 fac(2) //│ Parsed: -//│ TypingUnit(NuFunDef(None, fac, N, Nil, L(Lam(Tup((N, Var("n"))), Blk(If(IfThen(Bra(rcd = false, App(Var(">"), Tup((N, Var("n")), (N, IntLit(1))))), App(Var("*"), Tup((N, App(Var("fac"), Tup((N, App(Var("-"), Tup((N, Var("n")), (N, IntLit(1)))))))), (N, Var("n")))), Some(IntLit(1))))))), App(Var("fac"), Tup((N, IntLit(2))))) +//│ TypingUnit(List(NuFunDef(None,Var(fac),None,List(),Left(Lam(Tup(List((None,Fld(FldFlags(false,false,false),Var(n))))),Blk(List(If(IfThen(Bra(false,App(Var(>),Tup(List((None,Fld(FldFlags(false,false,false),Var(n))), (None,Fld(FldFlags(false,false,false),IntLit(1))))))),App(Var(*),Tup(List((None,Fld(FldFlags(false,false,false),App(Var(fac),Tup(List((None,Fld(FldFlags(false,false,false),App(Var(-),Tup(List((None,Fld(FldFlags(false,false,false),Var(n))), (None,Fld(FldFlags(false,false,false),IntLit(1))))))))))))), (None,Fld(FldFlags(false,false,false),Var(n))))))),Some(IntLit(1)))))))), App(Var(fac),Tup(List((None,Fld(FldFlags(false,false,false),IntLit(2)))))))) //│ Lifted: //│ TypingUnit { //│ fun fac$1 = (n,) => {if ('(' >(n, 1,) ')') then *(fac$1(-(n, 1,),), n,) else 1} @@ -246,7 +246,7 @@ fun count(lst) = else 0 count(new List(new List(new Nil(undefined, false), true), true)) //│ Parsed: -//│ TypingUnit(NuTypeDef(Cls, TypeName("List"), Ls(), S(Tup((S(Var("l")), App(Var("|"), Tup((N, App(Var("|"), Tup((N, Var("List")), (N, Var("Nil"))))), (N, UnitLit(true))))), (S(Var("hasTail")), Var("Bool")))), N, N, Ls(), N, N, TypingUnit()), NuTypeDef(Cls, TypeName("Nil"), Ls(), S(Tup((S(Var("l")), App(Var("|"), Tup((N, App(Var("|"), Tup((N, Var("List")), (N, Var("Nil"))))), (N, UnitLit(true))))), (S(Var("hasTail")), Var("Bool")))), N, N, Ls(), N, N, TypingUnit()), NuFunDef(None, count, N, Nil, L(Lam(Tup((N, Var("lst"))), Blk(If(IfThen(Sel(Var("lst"), hasTail), Blk(NuFunDef(Some(false), l, N, Nil, L(Sel(Var("lst"), l))), If(IfThen(App(Var("is"), Tup((N, Var("l")), (N, UnitLit(true)))), IntLit(1), Some(App(Var("+"), Tup((N, App(Var("count"), Tup((N, Var("l"))))), (N, IntLit(1))))))), Some(IntLit(0))))))), App(Var("count"), Tup((N, App(NuNew(Var("List")), Tup((N, App(NuNew(Var("List")), Tup((N, App(NuNew(Var("Nil")), Tup((N, UnitLit(true)), (N, Var("false"))))), (N, Var("true"))))), (N, Var("true")))))))) +//│ TypingUnit(List(NuTypeDef(Cls,TypeName(List),List(),Some(Tup(List((Some(Var(l)),Fld(FldFlags(false,false,true),App(Var(|),Tup(List((None,Fld(FldFlags(false,false,false),App(Var(|),Tup(List((None,Fld(FldFlags(false,false,false),Var(List))), (None,Fld(FldFlags(false,false,false),Var(Nil)))))))), (None,Fld(FldFlags(false,false,false),UnitLit(true)))))))), (Some(Var(hasTail)),Fld(FldFlags(false,false,true),Var(Bool)))))),None,None,List(),None,None,TypingUnit(List())), NuTypeDef(Cls,TypeName(Nil),List(),Some(Tup(List((Some(Var(l)),Fld(FldFlags(false,false,true),App(Var(|),Tup(List((None,Fld(FldFlags(false,false,false),App(Var(|),Tup(List((None,Fld(FldFlags(false,false,false),Var(List))), (None,Fld(FldFlags(false,false,false),Var(Nil)))))))), (None,Fld(FldFlags(false,false,false),UnitLit(true)))))))), (Some(Var(hasTail)),Fld(FldFlags(false,false,true),Var(Bool)))))),None,None,List(),None,None,TypingUnit(List())), NuFunDef(None,Var(count),None,List(),Left(Lam(Tup(List((None,Fld(FldFlags(false,false,false),Var(lst))))),Blk(List(If(IfThen(Sel(Var(lst),Var(hasTail)),Blk(List(NuFunDef(Some(false),Var(l),None,List(),Left(Sel(Var(lst),Var(l)))), If(IfThen(App(Var(is),Tup(List((None,Fld(FldFlags(false,false,false),Var(l))), (None,Fld(FldFlags(false,false,false),UnitLit(true)))))),IntLit(1)),Some(App(Var(+),Tup(List((None,Fld(FldFlags(false,false,false),App(Var(count),Tup(List((None,Fld(FldFlags(false,false,false),Var(l)))))))), (None,Fld(FldFlags(false,false,false),IntLit(1))))))))))),Some(IntLit(0)))))))), App(Var(count),Tup(List((None,Fld(FldFlags(false,false,false),App(NuNew(Var(List)),Tup(List((None,Fld(FldFlags(false,false,false),App(NuNew(Var(List)),Tup(List((None,Fld(FldFlags(false,false,false),App(NuNew(Var(Nil)),Tup(List((None,Fld(FldFlags(false,false,false),UnitLit(true))), (None,Fld(FldFlags(false,false,false),Var(false)))))))), (None,Fld(FldFlags(false,false,false),Var(true)))))))), (None,Fld(FldFlags(false,false,false),Var(true))))))))))))) //│ Lifted: //│ TypingUnit { //│ class List$1([val l: |(|(List, Nil,), undefined,), val hasTail: Bool,]) {} @@ -303,7 +303,7 @@ class Nil() { fun add2(x) = x+2 (new List(1, new List(2, new Nil()))).map(x => x+1).map(x => add2(x)) //│ Parsed: -//│ TypingUnit(NuTypeDef(Cls, TypeName("List"), Ls(), S(Tup((S(Var("e")), Var("Int")), (S(Var("tail")), App(Var("|"), Tup((N, Var("List")), (N, Var("Nil"))))))), N, N, Ls(), N, N, TypingUnit(NuFunDef(None, map, N, Nil, R(PolyType(Ls(), Function(Tuple(N -> Fld(N, Function(Tuple(N -> Fld(N, TypeName("Int"))), TypeName("Int")))), TypeName("List"))))), NuFunDef(None, map, N, Nil, L(Lam(Tup((N, Var("f"))), App(NuNew(Var("List")), Tup((N, App(Var("f"), Tup((N, Var("e"))))), (N, App(Sel(Var("tail"), map), Tup((N, Var("f")))))))))), NuFunDef(None, count, N, Nil, R(PolyType(Ls(), Function(Tuple(), TypeName("Int"))))), NuFunDef(None, count, N, Nil, L(Lam(Tup(), App(Var("+"), Tup((N, IntLit(1)), (N, App(Sel(Var("tail"), count), Tup()))))))))), NuTypeDef(Cls, TypeName("Nil"), Ls(), S(Tup()), N, N, Ls(), N, N, TypingUnit(NuFunDef(None, map, N, Nil, L(Lam(Tup((N, Var("f"))), Var("this")))), NuFunDef(None, count, N, Nil, L(Lam(Tup(), IntLit(0)))))), NuFunDef(None, add2, N, Nil, L(Lam(Tup((N, Var("x"))), App(Var("+"), Tup((N, Var("x")), (N, IntLit(2))))))), App(Sel(App(Sel(Bra(rcd = false, App(NuNew(Var("List")), Tup((N, IntLit(1)), (N, App(NuNew(Var("List")), Tup((N, IntLit(2)), (N, App(NuNew(Var("Nil")), Tup())))))))), map), Tup((N, Lam(Tup((N, Var("x"))), App(Var("+"), Tup((N, Var("x")), (N, IntLit(1)))))))), map), Tup((N, Lam(Tup((N, Var("x"))), App(Var("add2"), Tup((N, Var("x"))))))))) +//│ TypingUnit(List(NuTypeDef(Cls,TypeName(List),List(),Some(Tup(List((Some(Var(e)),Fld(FldFlags(false,false,false),Var(Int))), (Some(Var(tail)),Fld(FldFlags(false,false,false),App(Var(|),Tup(List((None,Fld(FldFlags(false,false,false),Var(List))), (None,Fld(FldFlags(false,false,false),Var(Nil))))))))))),None,None,List(),None,None,TypingUnit(List(NuFunDef(None,Var(map),None,List(),Right(PolyType(List(),Function(Tuple(List((None,Field(None,Function(Tuple(List((None,Field(None,TypeName(Int))))),TypeName(Int)))))),TypeName(List))))), NuFunDef(None,Var(map),None,List(),Left(Lam(Tup(List((None,Fld(FldFlags(false,false,false),Var(f))))),App(NuNew(Var(List)),Tup(List((None,Fld(FldFlags(false,false,false),App(Var(f),Tup(List((None,Fld(FldFlags(false,false,false),Var(e)))))))), (None,Fld(FldFlags(false,false,false),App(Sel(Var(tail),Var(map)),Tup(List((None,Fld(FldFlags(false,false,false),Var(f)))))))))))))), NuFunDef(None,Var(count),None,List(),Right(PolyType(List(),Function(Tuple(List()),TypeName(Int))))), NuFunDef(None,Var(count),None,List(),Left(Lam(Tup(List()),App(Var(+),Tup(List((None,Fld(FldFlags(false,false,false),IntLit(1))), (None,Fld(FldFlags(false,false,false),App(Sel(Var(tail),Var(count)),Tup(List()))))))))))))), NuTypeDef(Cls,TypeName(Nil),List(),Some(Tup(List())),None,None,List(),None,None,TypingUnit(List(NuFunDef(None,Var(map),None,List(),Left(Lam(Tup(List((None,Fld(FldFlags(false,false,false),Var(f))))),Var(this)))), NuFunDef(None,Var(count),None,List(),Left(Lam(Tup(List()),IntLit(0))))))), NuFunDef(None,Var(add2),None,List(),Left(Lam(Tup(List((None,Fld(FldFlags(false,false,false),Var(x))))),App(Var(+),Tup(List((None,Fld(FldFlags(false,false,false),Var(x))), (None,Fld(FldFlags(false,false,false),IntLit(2))))))))), App(Sel(App(Sel(Bra(false,App(NuNew(Var(List)),Tup(List((None,Fld(FldFlags(false,false,false),IntLit(1))), (None,Fld(FldFlags(false,false,false),App(NuNew(Var(List)),Tup(List((None,Fld(FldFlags(false,false,false),IntLit(2))), (None,Fld(FldFlags(false,false,false),App(NuNew(Var(Nil)),Tup(List()))))))))))))),Var(map)),Tup(List((None,Fld(FldFlags(false,false,false),Lam(Tup(List((None,Fld(FldFlags(false,false,false),Var(x))))),App(Var(+),Tup(List((None,Fld(FldFlags(false,false,false),Var(x))), (None,Fld(FldFlags(false,false,false),IntLit(1)))))))))))),Var(map)),Tup(List((None,Fld(FldFlags(false,false,false),Lam(Tup(List((None,Fld(FldFlags(false,false,false),Var(x))))),App(Var(add2),Tup(List((None,Fld(FldFlags(false,false,false),Var(x)))))))))))))) //│ Lifted: //│ TypingUnit { //│ class List$1([e: Int, tail: |(List, Nil,),]) { @@ -370,7 +370,7 @@ fun generate(x) = foo(new List(1, new List(2, new Nil()))) foo(generate(1)) //│ Parsed: -//│ TypingUnit(NuTypeDef(Cls, TypeName("List"), Ls(), S(Tup((S(Var("e")), Var("Int")), (S(Var("tail")), App(Var("|"), Tup((N, Var("List")), (N, Var("Nil"))))))), N, N, Ls(), N, N, TypingUnit(NuFunDef(None, count, N, Nil, R(PolyType(Ls(), Function(Tuple(), TypeName("Int"))))), NuFunDef(None, count, N, Nil, L(Lam(Tup(), App(Var("+"), Tup((N, IntLit(1)), (N, App(Sel(Var("tail"), count), Tup()))))))))), NuTypeDef(Cls, TypeName("Nil"), Ls(), S(Tup()), N, N, Ls(), N, N, TypingUnit(NuFunDef(None, count, N, Nil, L(Lam(Tup(), IntLit(0)))))), NuFunDef(None, foo, N, Nil, L(Lam(Tup((N, Var("x"))), App(Sel(Var("x"), count), Tup())))), NuFunDef(None, generate, N, Nil, L(Lam(Tup((N, Var("x"))), Blk(If(IfThen(App(Var(">"), Tup((N, Var("x")), (N, IntLit(0)))), App(NuNew(Var("List")), Tup((N, Var("x")), (N, App(Var("generate"), Tup((N, App(Var("+"), Tup((N, Var("x")), (N, IntLit(1)))))))))), Some(App(NuNew(Var("Nil")), Tup()))))))), App(Var("foo"), Tup((N, App(NuNew(Var("List")), Tup((N, IntLit(1)), (N, App(NuNew(Var("List")), Tup((N, IntLit(2)), (N, App(NuNew(Var("Nil")), Tup())))))))))), App(Var("foo"), Tup((N, App(Var("generate"), Tup((N, IntLit(1)))))))) +//│ TypingUnit(List(NuTypeDef(Cls,TypeName(List),List(),Some(Tup(List((Some(Var(e)),Fld(FldFlags(false,false,false),Var(Int))), (Some(Var(tail)),Fld(FldFlags(false,false,false),App(Var(|),Tup(List((None,Fld(FldFlags(false,false,false),Var(List))), (None,Fld(FldFlags(false,false,false),Var(Nil))))))))))),None,None,List(),None,None,TypingUnit(List(NuFunDef(None,Var(count),None,List(),Right(PolyType(List(),Function(Tuple(List()),TypeName(Int))))), NuFunDef(None,Var(count),None,List(),Left(Lam(Tup(List()),App(Var(+),Tup(List((None,Fld(FldFlags(false,false,false),IntLit(1))), (None,Fld(FldFlags(false,false,false),App(Sel(Var(tail),Var(count)),Tup(List()))))))))))))), NuTypeDef(Cls,TypeName(Nil),List(),Some(Tup(List())),None,None,List(),None,None,TypingUnit(List(NuFunDef(None,Var(count),None,List(),Left(Lam(Tup(List()),IntLit(0))))))), NuFunDef(None,Var(foo),None,List(),Left(Lam(Tup(List((None,Fld(FldFlags(false,false,false),Var(x))))),App(Sel(Var(x),Var(count)),Tup(List()))))), NuFunDef(None,Var(generate),None,List(),Left(Lam(Tup(List((None,Fld(FldFlags(false,false,false),Var(x))))),Blk(List(If(IfThen(App(Var(>),Tup(List((None,Fld(FldFlags(false,false,false),Var(x))), (None,Fld(FldFlags(false,false,false),IntLit(0)))))),App(NuNew(Var(List)),Tup(List((None,Fld(FldFlags(false,false,false),Var(x))), (None,Fld(FldFlags(false,false,false),App(Var(generate),Tup(List((None,Fld(FldFlags(false,false,false),App(Var(+),Tup(List((None,Fld(FldFlags(false,false,false),Var(x))), (None,Fld(FldFlags(false,false,false),IntLit(1))))))))))))))))),Some(App(NuNew(Var(Nil)),Tup(List()))))))))), App(Var(foo),Tup(List((None,Fld(FldFlags(false,false,false),App(NuNew(Var(List)),Tup(List((None,Fld(FldFlags(false,false,false),IntLit(1))), (None,Fld(FldFlags(false,false,false),App(NuNew(Var(List)),Tup(List((None,Fld(FldFlags(false,false,false),IntLit(2))), (None,Fld(FldFlags(false,false,false),App(NuNew(Var(Nil)),Tup(List()))))))))))))))))), App(Var(foo),Tup(List((None,Fld(FldFlags(false,false,false),App(Var(generate),Tup(List((None,Fld(FldFlags(false,false,false),IntLit(1))))))))))))) //│ Lifted: //│ TypingUnit { //│ class List$1([e: Int, tail: |(List, Nil,),]) { @@ -424,7 +424,7 @@ fun foo(x) = (f => f(x))(z => z+1) foo(2) //│ Parsed: -//│ TypingUnit(NuFunDef(None, foo, N, Nil, L(Lam(Tup((N, Var("x"))), Blk(App(Bra(rcd = false, Lam(Tup((N, Var("f"))), App(Var("f"), Tup((N, Var("x")))))), Tup((N, Lam(Tup((N, Var("z"))), App(Var("+"), Tup((N, Var("z")), (N, IntLit(1)))))))))))), App(Var("foo"), Tup((N, IntLit(2))))) +//│ TypingUnit(List(NuFunDef(None,Var(foo),None,List(),Left(Lam(Tup(List((None,Fld(FldFlags(false,false,false),Var(x))))),Blk(List(App(Bra(false,Lam(Tup(List((None,Fld(FldFlags(false,false,false),Var(f))))),App(Var(f),Tup(List((None,Fld(FldFlags(false,false,false),Var(x)))))))),Tup(List((None,Fld(FldFlags(false,false,false),Lam(Tup(List((None,Fld(FldFlags(false,false,false),Var(z))))),App(Var(+),Tup(List((None,Fld(FldFlags(false,false,false),Var(z))), (None,Fld(FldFlags(false,false,false),IntLit(1))))))))))))))))), App(Var(foo),Tup(List((None,Fld(FldFlags(false,false,false),IntLit(2)))))))) //│ Lifted: //│ TypingUnit { //│ class Lambda1$2$1([x,]) {fun apply = (f,) => f((this).x,)} @@ -458,7 +458,7 @@ fun f(x) = (y => f(x+y))(x+1) f(1) //│ Parsed: -//│ TypingUnit(NuFunDef(None, f, N, Nil, L(Lam(Tup((N, Var("x"))), Blk(App(Bra(rcd = false, Lam(Tup((N, Var("y"))), App(Var("f"), Tup((N, App(Var("+"), Tup((N, Var("x")), (N, Var("y"))))))))), Tup((N, App(Var("+"), Tup((N, Var("x")), (N, IntLit(1))))))))))), App(Var("f"), Tup((N, IntLit(1))))) +//│ TypingUnit(List(NuFunDef(None,Var(f),None,List(),Left(Lam(Tup(List((None,Fld(FldFlags(false,false,false),Var(x))))),Blk(List(App(Bra(false,Lam(Tup(List((None,Fld(FldFlags(false,false,false),Var(y))))),App(Var(f),Tup(List((None,Fld(FldFlags(false,false,false),App(Var(+),Tup(List((None,Fld(FldFlags(false,false,false),Var(x))), (None,Fld(FldFlags(false,false,false),Var(y))))))))))))),Tup(List((None,Fld(FldFlags(false,false,false),App(Var(+),Tup(List((None,Fld(FldFlags(false,false,false),Var(x))), (None,Fld(FldFlags(false,false,false),IntLit(1)))))))))))))))), App(Var(f),Tup(List((None,Fld(FldFlags(false,false,false),IntLit(1)))))))) //│ Lifted: //│ TypingUnit { //│ class Lambda1$2$1([x,]) {fun apply = (y,) => f$1(+((this).x, y,),)} @@ -489,7 +489,7 @@ fun f(x) = f(x) f(0) f(1) //│ Parsed: -//│ TypingUnit(NuFunDef(None, f, N, Nil, L(Lam(Tup((N, Var("x"))), App(Var("f"), Tup((N, Var("x"))))))), App(Var("f"), Tup((N, IntLit(0)))), App(Var("f"), Tup((N, IntLit(1))))) +//│ TypingUnit(List(NuFunDef(None,Var(f),None,List(),Left(Lam(Tup(List((None,Fld(FldFlags(false,false,false),Var(x))))),App(Var(f),Tup(List((None,Fld(FldFlags(false,false,false),Var(x))))))))), App(Var(f),Tup(List((None,Fld(FldFlags(false,false,false),IntLit(0)))))), App(Var(f),Tup(List((None,Fld(FldFlags(false,false,false),IntLit(1)))))))) //│ Lifted: //│ TypingUnit { //│ fun f$1 = (x,) => f$1(x,) @@ -537,7 +537,7 @@ fun foo(x) = foo(new Lambda()) foo(new Lambda2(2)) //│ Parsed: -//│ TypingUnit(NuTypeDef(Cls, TypeName("Cons"), Ls(), S(Tup((S(Var("e")), Var("'A")), (S(Var("tail")), App(Var("|"), Tup((N, Var("Cons")), (N, Var("Nil"))))))), N, N, Ls(), N, N, TypingUnit(NuFunDef(None, count, N, Nil, R(PolyType(Ls(), Function(Tuple(), TypeName("Int"))))), NuFunDef(None, count, N, Nil, L(Lam(Tup(), App(Var("+"), Tup((N, IntLit(1)), (N, App(Sel(Var("tail"), count), Tup()))))))))), NuTypeDef(Cls, TypeName("Nil"), Ls(), S(Tup()), N, N, Ls(), N, N, TypingUnit(NuFunDef(None, count, N, Nil, L(Lam(Tup(), IntLit(0)))))), NuTypeDef(Cls, TypeName("Lambda"), Ls(), S(Tup()), N, N, Ls(), N, N, TypingUnit(NuFunDef(None, apply, N, Nil, L(Lam(Tup((N, Var("l"))), Blk(App(Sel(Var("l"), count), Tup()))))))), NuTypeDef(Cls, TypeName("Lambda2"), Ls(), S(Tup((S(Var("a")), Var("Int")))), N, N, Ls(), N, N, TypingUnit(NuFunDef(None, apply, N, Nil, L(Lam(Tup((N, Var("l"))), Blk(App(Sel(Bra(rcd = false, App(NuNew(Var("Cons")), Tup((N, Var("a")), (N, Var("l"))))), count), Tup()))))))), NuFunDef(None, foo, N, Nil, L(Lam(Tup((N, Var("x"))), Blk(App(Var("+"), Tup((N, App(Sel(Var("x"), apply), Tup((N, App(NuNew(Var("Cons")), Tup((N, IntLit(1)), (N, App(NuNew(Var("Nil")), Tup())))))))), (N, App(Sel(Var("x"), apply), Tup((N, App(NuNew(Var("Nil")), Tup()))))))))))), App(Var("foo"), Tup((N, App(NuNew(Var("Lambda")), Tup())))), App(Var("foo"), Tup((N, App(NuNew(Var("Lambda2")), Tup((N, IntLit(2)))))))) +//│ TypingUnit(List(NuTypeDef(Cls,TypeName(Cons),List(),Some(Tup(List((Some(Var(e)),Fld(FldFlags(false,false,false),Var('A))), (Some(Var(tail)),Fld(FldFlags(false,false,false),App(Var(|),Tup(List((None,Fld(FldFlags(false,false,false),Var(Cons))), (None,Fld(FldFlags(false,false,false),Var(Nil))))))))))),None,None,List(),None,None,TypingUnit(List(NuFunDef(None,Var(count),None,List(),Right(PolyType(List(),Function(Tuple(List()),TypeName(Int))))), NuFunDef(None,Var(count),None,List(),Left(Lam(Tup(List()),App(Var(+),Tup(List((None,Fld(FldFlags(false,false,false),IntLit(1))), (None,Fld(FldFlags(false,false,false),App(Sel(Var(tail),Var(count)),Tup(List()))))))))))))), NuTypeDef(Cls,TypeName(Nil),List(),Some(Tup(List())),None,None,List(),None,None,TypingUnit(List(NuFunDef(None,Var(count),None,List(),Left(Lam(Tup(List()),IntLit(0))))))), NuTypeDef(Cls,TypeName(Lambda),List(),Some(Tup(List())),None,None,List(),None,None,TypingUnit(List(NuFunDef(None,Var(apply),None,List(),Left(Lam(Tup(List((None,Fld(FldFlags(false,false,false),Var(l))))),Blk(List(App(Sel(Var(l),Var(count)),Tup(List())))))))))), NuTypeDef(Cls,TypeName(Lambda2),List(),Some(Tup(List((Some(Var(a)),Fld(FldFlags(false,false,false),Var(Int)))))),None,None,List(),None,None,TypingUnit(List(NuFunDef(None,Var(apply),None,List(),Left(Lam(Tup(List((None,Fld(FldFlags(false,false,false),Var(l))))),Blk(List(App(Sel(Bra(false,App(NuNew(Var(Cons)),Tup(List((None,Fld(FldFlags(false,false,false),Var(a))), (None,Fld(FldFlags(false,false,false),Var(l))))))),Var(count)),Tup(List())))))))))), NuFunDef(None,Var(foo),None,List(),Left(Lam(Tup(List((None,Fld(FldFlags(false,false,false),Var(x))))),Blk(List(App(Var(+),Tup(List((None,Fld(FldFlags(false,false,false),App(Sel(Var(x),Var(apply)),Tup(List((None,Fld(FldFlags(false,false,false),App(NuNew(Var(Cons)),Tup(List((None,Fld(FldFlags(false,false,false),IntLit(1))), (None,Fld(FldFlags(false,false,false),App(NuNew(Var(Nil)),Tup(List())))))))))))))), (None,Fld(FldFlags(false,false,false),App(Sel(Var(x),Var(apply)),Tup(List((None,Fld(FldFlags(false,false,false),App(NuNew(Var(Nil)),Tup(List()))))))))))))))))), App(Var(foo),Tup(List((None,Fld(FldFlags(false,false,false),App(NuNew(Var(Lambda)),Tup(List()))))))), App(Var(foo),Tup(List((None,Fld(FldFlags(false,false,false),App(NuNew(Var(Lambda2)),Tup(List((None,Fld(FldFlags(false,false,false),IntLit(2))))))))))))) //│ Lifted: //│ TypingUnit { //│ class Cons$1([e: 'A, tail: |(Cons, Nil,),]) { @@ -612,7 +612,7 @@ fun foo(x) = foo(l => l.count()) foo(l => (new Cons(2, l)).count()) //│ Parsed: -//│ TypingUnit(NuTypeDef(Cls, TypeName("Cons"), Ls(), S(Tup((S(Var("e")), Var("Int")), (S(Var("tail")), App(Var("|"), Tup((N, Var("Cons")), (N, Var("Nil"))))))), N, N, Ls(), N, N, TypingUnit(NuFunDef(None, count, N, Nil, R(PolyType(Ls(), Function(Tuple(), TypeName("Int"))))), NuFunDef(None, count, N, Nil, L(Lam(Tup(), App(Var("+"), Tup((N, IntLit(1)), (N, App(Sel(Var("tail"), count), Tup()))))))))), NuTypeDef(Cls, TypeName("Nil"), Ls(), S(Tup()), N, N, Ls(), N, N, TypingUnit(NuFunDef(None, count, N, Nil, L(Lam(Tup(), IntLit(0)))))), NuFunDef(None, foo, N, Nil, L(Lam(Tup((N, Var("x"))), Blk(App(Var("+"), Tup((N, App(Var("x"), Tup((N, App(NuNew(Var("Cons")), Tup((N, IntLit(1)), (N, App(NuNew(Var("Nil")), Tup())))))))), (N, App(Var("x"), Tup((N, App(NuNew(Var("Nil")), Tup()))))))))))), App(Var("foo"), Tup((N, Lam(Tup((N, Var("l"))), App(Sel(Var("l"), count), Tup()))))), App(Var("foo"), Tup((N, Lam(Tup((N, Var("l"))), App(Sel(Bra(rcd = false, App(NuNew(Var("Cons")), Tup((N, IntLit(2)), (N, Var("l"))))), count), Tup())))))) +//│ TypingUnit(List(NuTypeDef(Cls,TypeName(Cons),List(),Some(Tup(List((Some(Var(e)),Fld(FldFlags(false,false,false),Var(Int))), (Some(Var(tail)),Fld(FldFlags(false,false,false),App(Var(|),Tup(List((None,Fld(FldFlags(false,false,false),Var(Cons))), (None,Fld(FldFlags(false,false,false),Var(Nil))))))))))),None,None,List(),None,None,TypingUnit(List(NuFunDef(None,Var(count),None,List(),Right(PolyType(List(),Function(Tuple(List()),TypeName(Int))))), NuFunDef(None,Var(count),None,List(),Left(Lam(Tup(List()),App(Var(+),Tup(List((None,Fld(FldFlags(false,false,false),IntLit(1))), (None,Fld(FldFlags(false,false,false),App(Sel(Var(tail),Var(count)),Tup(List()))))))))))))), NuTypeDef(Cls,TypeName(Nil),List(),Some(Tup(List())),None,None,List(),None,None,TypingUnit(List(NuFunDef(None,Var(count),None,List(),Left(Lam(Tup(List()),IntLit(0))))))), NuFunDef(None,Var(foo),None,List(),Left(Lam(Tup(List((None,Fld(FldFlags(false,false,false),Var(x))))),Blk(List(App(Var(+),Tup(List((None,Fld(FldFlags(false,false,false),App(Var(x),Tup(List((None,Fld(FldFlags(false,false,false),App(NuNew(Var(Cons)),Tup(List((None,Fld(FldFlags(false,false,false),IntLit(1))), (None,Fld(FldFlags(false,false,false),App(NuNew(Var(Nil)),Tup(List())))))))))))))), (None,Fld(FldFlags(false,false,false),App(Var(x),Tup(List((None,Fld(FldFlags(false,false,false),App(NuNew(Var(Nil)),Tup(List()))))))))))))))))), App(Var(foo),Tup(List((None,Fld(FldFlags(false,false,false),Lam(Tup(List((None,Fld(FldFlags(false,false,false),Var(l))))),App(Sel(Var(l),Var(count)),Tup(List())))))))), App(Var(foo),Tup(List((None,Fld(FldFlags(false,false,false),Lam(Tup(List((None,Fld(FldFlags(false,false,false),Var(l))))),App(Sel(Bra(false,App(NuNew(Var(Cons)),Tup(List((None,Fld(FldFlags(false,false,false),IntLit(2))), (None,Fld(FldFlags(false,false,false),Var(l))))))),Var(count)),Tup(List())))))))))) //│ Lifted: //│ TypingUnit { //│ class Cons$1([e: Int, tail: |(Cons, Nil,),]) { @@ -707,7 +707,7 @@ class C(e1: Exp, e2: Exp) extends Exp { } (new C(new Ch(1), new A(new Ch(2), new Ch(3)))).derive(0).isEmpty() //│ Parsed: -//│ TypingUnit(NuTypeDef(Cls, TypeName("Exp"), Ls(), S(Tup()), N, N, Ls(), N, N, TypingUnit(NuFunDef(None, derive, N, Nil, R(PolyType(Ls(), Function(Tuple(S(x) -> Fld(N, TypeName("Int"))), TypeName("Exp"))))), NuFunDef(None, derive, N, Nil, L(Lam(Tup((S(Var("x")), Var("Int"))), App(Var("Exp"), Tup())))), NuFunDef(None, isEmpty, N, Nil, R(PolyType(Ls(), Function(Tuple(), TypeName("Bool"))))), NuFunDef(None, isEmpty, N, Nil, L(Lam(Tup(), Var("false")))))), NuTypeDef(Cls, TypeName("E"), Ls(), S(Tup()), N, N, Ls(Var("Exp")), N, N, TypingUnit(NuFunDef(None, derive, N, Nil, L(Lam(Tup((N, Var("x"))), Blk(NuNew(Var("E")))))), NuFunDef(None, isEmpty, N, Nil, L(Lam(Tup(), Blk(Var("false"))))))), NuTypeDef(Cls, TypeName("Ep"), Ls(), S(Tup()), N, N, Ls(Var("Exp")), N, N, TypingUnit(NuFunDef(None, derive, N, Nil, L(Lam(Tup((N, Var("x"))), Blk(NuNew(Var("E")))))), NuFunDef(None, isEmpty, N, Nil, L(Lam(Tup(), Blk(Var("true"))))))), NuTypeDef(Cls, TypeName("Ch"), Ls(), S(Tup((S(Var("i")), Var("Int")))), N, N, Ls(Var("Exp")), N, N, TypingUnit(NuFunDef(None, derive, N, Nil, L(Lam(Tup((N, Var("x"))), Blk(If(IfThen(App(Var("=="), Tup((N, Var("x")), (N, Var("i")))), NuNew(Var("Ep")), Some(NuNew(Var("E")))))))), NuFunDef(None, isEmpty, N, Nil, L(Lam(Tup(), Blk(Var("false"))))))), NuTypeDef(Cls, TypeName("A"), Ls(), S(Tup((S(Var("e1")), Var("Exp")), (S(Var("e2")), Var("Exp")))), N, N, Ls(Var("Exp")), N, N, TypingUnit(NuFunDef(None, derive, N, Nil, L(Lam(Tup((N, Var("x"))), Blk(App(NuNew(Var("A")), Tup((N, App(Sel(Var("e1"), derive), Tup((N, Var("x"))))), (N, App(Sel(Var("e2"), derive), Tup((N, Var("x"))))))))))), NuFunDef(None, isEmpty, N, Nil, L(Lam(Tup(), Blk(App(Var("||"), Tup((N, App(Sel(Var("e1"), isEmpty), Tup())), (N, App(Sel(Var("e2"), isEmpty), Tup())))))))))), NuTypeDef(Cls, TypeName("C"), Ls(), S(Tup((S(Var("e1")), Var("Exp")), (S(Var("e2")), Var("Exp")))), N, N, Ls(Var("Exp")), N, N, TypingUnit(NuFunDef(None, derive, N, Nil, L(Lam(Tup((N, Var("x"))), Blk(If(IfThen(App(Sel(Var("e1"), isEmpty), Tup()), App(NuNew(Var("A")), Tup((N, App(NuNew(Var("C")), Tup((N, App(Sel(Var("e1"), derive), Tup((N, Var("x"))))), (N, Var("e2"))))), (N, App(Sel(Var("e2"), derive), Tup((N, Var("x"))))))), Some(App(NuNew(Var("C")), Tup((N, App(Sel(Var("e1"), derive), Tup((N, Var("x"))))), (N, Var("e2")))))))))), NuFunDef(None, isEmpty, N, Nil, L(Lam(Tup(), Blk(App(Var("&&"), Tup((N, App(Sel(Var("e1"), isEmpty), Tup())), (N, App(Sel(Var("e2"), isEmpty), Tup())))))))))), App(Sel(App(Sel(Bra(rcd = false, App(NuNew(Var("C")), Tup((N, App(NuNew(Var("Ch")), Tup((N, IntLit(1))))), (N, App(NuNew(Var("A")), Tup((N, App(NuNew(Var("Ch")), Tup((N, IntLit(2))))), (N, App(NuNew(Var("Ch")), Tup((N, IntLit(3))))))))))), derive), Tup((N, IntLit(0)))), isEmpty), Tup())) +//│ TypingUnit(List(NuTypeDef(Cls,TypeName(Exp),List(),Some(Tup(List())),None,None,List(),None,None,TypingUnit(List(NuFunDef(None,Var(derive),None,List(),Right(PolyType(List(),Function(Tuple(List((Some(Var(x)),Field(None,TypeName(Int))))),TypeName(Exp))))), NuFunDef(None,Var(derive),None,List(),Left(Lam(Tup(List((Some(Var(x)),Fld(FldFlags(false,false,false),Var(Int))))),App(Var(Exp),Tup(List()))))), NuFunDef(None,Var(isEmpty),None,List(),Right(PolyType(List(),Function(Tuple(List()),TypeName(Bool))))), NuFunDef(None,Var(isEmpty),None,List(),Left(Lam(Tup(List()),Var(false))))))), NuTypeDef(Cls,TypeName(E),List(),Some(Tup(List())),None,None,List(Var(Exp)),None,None,TypingUnit(List(NuFunDef(None,Var(derive),None,List(),Left(Lam(Tup(List((None,Fld(FldFlags(false,false,false),Var(x))))),Blk(List(NuNew(Var(E))))))), NuFunDef(None,Var(isEmpty),None,List(),Left(Lam(Tup(List()),Blk(List(Var(false))))))))), NuTypeDef(Cls,TypeName(Ep),List(),Some(Tup(List())),None,None,List(Var(Exp)),None,None,TypingUnit(List(NuFunDef(None,Var(derive),None,List(),Left(Lam(Tup(List((None,Fld(FldFlags(false,false,false),Var(x))))),Blk(List(NuNew(Var(E))))))), NuFunDef(None,Var(isEmpty),None,List(),Left(Lam(Tup(List()),Blk(List(Var(true))))))))), NuTypeDef(Cls,TypeName(Ch),List(),Some(Tup(List((Some(Var(i)),Fld(FldFlags(false,false,false),Var(Int)))))),None,None,List(Var(Exp)),None,None,TypingUnit(List(NuFunDef(None,Var(derive),None,List(),Left(Lam(Tup(List((None,Fld(FldFlags(false,false,false),Var(x))))),Blk(List(If(IfThen(App(Var(==),Tup(List((None,Fld(FldFlags(false,false,false),Var(x))), (None,Fld(FldFlags(false,false,false),Var(i)))))),NuNew(Var(Ep))),Some(NuNew(Var(E))))))))), NuFunDef(None,Var(isEmpty),None,List(),Left(Lam(Tup(List()),Blk(List(Var(false))))))))), NuTypeDef(Cls,TypeName(A),List(),Some(Tup(List((Some(Var(e1)),Fld(FldFlags(false,false,false),Var(Exp))), (Some(Var(e2)),Fld(FldFlags(false,false,false),Var(Exp)))))),None,None,List(Var(Exp)),None,None,TypingUnit(List(NuFunDef(None,Var(derive),None,List(),Left(Lam(Tup(List((None,Fld(FldFlags(false,false,false),Var(x))))),Blk(List(App(NuNew(Var(A)),Tup(List((None,Fld(FldFlags(false,false,false),App(Sel(Var(e1),Var(derive)),Tup(List((None,Fld(FldFlags(false,false,false),Var(x)))))))), (None,Fld(FldFlags(false,false,false),App(Sel(Var(e2),Var(derive)),Tup(List((None,Fld(FldFlags(false,false,false),Var(x)))))))))))))))), NuFunDef(None,Var(isEmpty),None,List(),Left(Lam(Tup(List()),Blk(List(App(Var(||),Tup(List((None,Fld(FldFlags(false,false,false),App(Sel(Var(e1),Var(isEmpty)),Tup(List())))), (None,Fld(FldFlags(false,false,false),App(Sel(Var(e2),Var(isEmpty)),Tup(List()))))))))))))))), NuTypeDef(Cls,TypeName(C),List(),Some(Tup(List((Some(Var(e1)),Fld(FldFlags(false,false,false),Var(Exp))), (Some(Var(e2)),Fld(FldFlags(false,false,false),Var(Exp)))))),None,None,List(Var(Exp)),None,None,TypingUnit(List(NuFunDef(None,Var(derive),None,List(),Left(Lam(Tup(List((None,Fld(FldFlags(false,false,false),Var(x))))),Blk(List(If(IfThen(App(Sel(Var(e1),Var(isEmpty)),Tup(List())),App(NuNew(Var(A)),Tup(List((None,Fld(FldFlags(false,false,false),App(NuNew(Var(C)),Tup(List((None,Fld(FldFlags(false,false,false),App(Sel(Var(e1),Var(derive)),Tup(List((None,Fld(FldFlags(false,false,false),Var(x)))))))), (None,Fld(FldFlags(false,false,false),Var(e2)))))))), (None,Fld(FldFlags(false,false,false),App(Sel(Var(e2),Var(derive)),Tup(List((None,Fld(FldFlags(false,false,false),Var(x)))))))))))),Some(App(NuNew(Var(C)),Tup(List((None,Fld(FldFlags(false,false,false),App(Sel(Var(e1),Var(derive)),Tup(List((None,Fld(FldFlags(false,false,false),Var(x)))))))), (None,Fld(FldFlags(false,false,false),Var(e2))))))))))))), NuFunDef(None,Var(isEmpty),None,List(),Left(Lam(Tup(List()),Blk(List(App(Var(&&),Tup(List((None,Fld(FldFlags(false,false,false),App(Sel(Var(e1),Var(isEmpty)),Tup(List())))), (None,Fld(FldFlags(false,false,false),App(Sel(Var(e2),Var(isEmpty)),Tup(List()))))))))))))))), App(Sel(App(Sel(Bra(false,App(NuNew(Var(C)),Tup(List((None,Fld(FldFlags(false,false,false),App(NuNew(Var(Ch)),Tup(List((None,Fld(FldFlags(false,false,false),IntLit(1)))))))), (None,Fld(FldFlags(false,false,false),App(NuNew(Var(A)),Tup(List((None,Fld(FldFlags(false,false,false),App(NuNew(Var(Ch)),Tup(List((None,Fld(FldFlags(false,false,false),IntLit(2)))))))), (None,Fld(FldFlags(false,false,false),App(NuNew(Var(Ch)),Tup(List((None,Fld(FldFlags(false,false,false),IntLit(3))))))))))))))))),Var(derive)),Tup(List((None,Fld(FldFlags(false,false,false),IntLit(0)))))),Var(isEmpty)),Tup(List())))) //│ Lifted: //│ TypingUnit { //│ class Exp$1([]) { @@ -809,7 +809,7 @@ fun gen() = if anyUnknown then new List(gen(), true) else new Nil(false) gen() //│ Parsed: -//│ TypingUnit(NuFunDef(Some(false), anyUnknown, N, Nil, L(Var("false"))), NuTypeDef(Cls, TypeName("List"), Ls(), S(Tup((S(Var("l")), App(Var("|"), Tup((N, Var("List")), (N, Var("Nil"))))), (S(Var("hasTail")), Var("Bool")))), N, N, Ls(), N, N, TypingUnit()), NuTypeDef(Cls, TypeName("Nil"), Ls(), S(Tup((S(Var("hasTail")), Var("Bool")))), N, N, Ls(), N, N, TypingUnit()), NuFunDef(None, gen, N, Nil, L(Lam(Tup(), Blk(If(IfThen(Var("anyUnknown"), App(NuNew(Var("List")), Tup((N, App(Var("gen"), Tup())), (N, Var("true")))), Some(App(NuNew(Var("Nil")), Tup((N, Var("false")))))))))), App(Var("gen"), Tup())) +//│ TypingUnit(List(NuFunDef(Some(false),Var(anyUnknown),None,List(),Left(Var(false))), NuTypeDef(Cls,TypeName(List),List(),Some(Tup(List((Some(Var(l)),Fld(FldFlags(false,false,false),App(Var(|),Tup(List((None,Fld(FldFlags(false,false,false),Var(List))), (None,Fld(FldFlags(false,false,false),Var(Nil)))))))), (Some(Var(hasTail)),Fld(FldFlags(false,false,false),Var(Bool)))))),None,None,List(),None,None,TypingUnit(List())), NuTypeDef(Cls,TypeName(Nil),List(),Some(Tup(List((Some(Var(hasTail)),Fld(FldFlags(false,false,false),Var(Bool)))))),None,None,List(),None,None,TypingUnit(List())), NuFunDef(None,Var(gen),None,List(),Left(Lam(Tup(List()),Blk(List(If(IfThen(Var(anyUnknown),App(NuNew(Var(List)),Tup(List((None,Fld(FldFlags(false,false,false),App(Var(gen),Tup(List())))), (None,Fld(FldFlags(false,false,false),Var(true))))))),Some(App(NuNew(Var(Nil)),Tup(List((None,Fld(FldFlags(false,false,false),Var(false))))))))))))), App(Var(gen),Tup(List())))) //│ Lifted: //│ TypingUnit { //│ class List$1([l: |(List, Nil,), hasTail: Bool,]) {} @@ -851,7 +851,7 @@ class Foo(x: Int){ } (new Foo(1)).boo(2) //│ Parsed: -//│ TypingUnit(NuTypeDef(Cls, TypeName("Foo"), Ls(), S(Tup((S(Var("x")), Var("Int")))), N, N, Ls(), N, N, TypingUnit(NuFunDef(None, bar, N, Nil, L(Lam(Tup((N, Var("y"))), App(Var("+"), Tup((N, Var("x")), (N, Var("y"))))))), NuFunDef(None, boo, N, Nil, L(Lam(Tup((N, Var("z"))), App(Var("+"), Tup((N, App(Var("bar"), Tup((N, Var("z"))))), (N, Var("x"))))))))), App(Sel(Bra(rcd = false, App(NuNew(Var("Foo")), Tup((N, IntLit(1))))), boo), Tup((N, IntLit(2))))) +//│ TypingUnit(List(NuTypeDef(Cls,TypeName(Foo),List(),Some(Tup(List((Some(Var(x)),Fld(FldFlags(false,false,false),Var(Int)))))),None,None,List(),None,None,TypingUnit(List(NuFunDef(None,Var(bar),None,List(),Left(Lam(Tup(List((None,Fld(FldFlags(false,false,false),Var(y))))),App(Var(+),Tup(List((None,Fld(FldFlags(false,false,false),Var(x))), (None,Fld(FldFlags(false,false,false),Var(y))))))))), NuFunDef(None,Var(boo),None,List(),Left(Lam(Tup(List((None,Fld(FldFlags(false,false,false),Var(z))))),App(Var(+),Tup(List((None,Fld(FldFlags(false,false,false),App(Var(bar),Tup(List((None,Fld(FldFlags(false,false,false),Var(z)))))))), (None,Fld(FldFlags(false,false,false),Var(x)))))))))))), App(Sel(Bra(false,App(NuNew(Var(Foo)),Tup(List((None,Fld(FldFlags(false,false,false),IntLit(1))))))),Var(boo)),Tup(List((None,Fld(FldFlags(false,false,false),IntLit(2)))))))) //│ Lifted: //│ TypingUnit { //│ class Foo$1([x: Int,]) { @@ -888,7 +888,7 @@ class OneInt(a: Int){ } (new OneInt(10)).fac() //│ Parsed: -//│ TypingUnit(NuTypeDef(Cls, TypeName("OneInt"), Ls(), S(Tup((S(Var("a")), Var("Int")))), N, N, Ls(), N, N, TypingUnit(NuFunDef(None, fac, N, Nil, R(PolyType(Ls(), Function(Tuple(), TypeName("Int"))))), NuFunDef(None, fac, N, Nil, L(Lam(Tup(), Blk(If(IfThen(Bra(rcd = false, App(Var(">"), Tup((N, Var("a")), (N, IntLit(0))))), App(Sel(Bra(rcd = false, App(NuNew(Var("OneInt")), Tup((N, App(Var("-"), Tup((N, Var("a")), (N, IntLit(1)))))))), fac), Tup()), Some(IntLit(1))))))))), App(Sel(Bra(rcd = false, App(NuNew(Var("OneInt")), Tup((N, IntLit(10))))), fac), Tup())) +//│ TypingUnit(List(NuTypeDef(Cls,TypeName(OneInt),List(),Some(Tup(List((Some(Var(a)),Fld(FldFlags(false,false,false),Var(Int)))))),None,None,List(),None,None,TypingUnit(List(NuFunDef(None,Var(fac),None,List(),Right(PolyType(List(),Function(Tuple(List()),TypeName(Int))))), NuFunDef(None,Var(fac),None,List(),Left(Lam(Tup(List()),Blk(List(If(IfThen(Bra(false,App(Var(>),Tup(List((None,Fld(FldFlags(false,false,false),Var(a))), (None,Fld(FldFlags(false,false,false),IntLit(0))))))),App(Sel(Bra(false,App(NuNew(Var(OneInt)),Tup(List((None,Fld(FldFlags(false,false,false),App(Var(-),Tup(List((None,Fld(FldFlags(false,false,false),Var(a))), (None,Fld(FldFlags(false,false,false),IntLit(1)))))))))))),Var(fac)),Tup(List()))),Some(IntLit(1))))))))))), App(Sel(Bra(false,App(NuNew(Var(OneInt)),Tup(List((None,Fld(FldFlags(false,false,false),IntLit(10))))))),Var(fac)),Tup(List())))) //│ Lifted: //│ TypingUnit { //│ class OneInt$1([a: Int,]) { @@ -938,7 +938,7 @@ fun g(x) = else f(x - 2) g(1) //│ Parsed: -//│ TypingUnit(NuFunDef(Some(false), any, N, Nil, L(IntLit(-20))), NuFunDef(None, f, N, Nil, L(Lam(Tup((N, Var("x"))), Blk(If(IfThen(App(Var(">"), Tup((N, Var("x")), (N, Var("any")))), IntLit(0), Some(App(Var("g"), Tup((N, App(Var("-"), Tup((N, Var("x")), (N, IntLit(1))))))))))))), NuFunDef(None, g, N, Nil, L(Lam(Tup((N, Var("x"))), Blk(If(IfThen(App(Var(">"), Tup((N, Var("x")), (N, Var("any")))), App(Var("g"), Tup((N, App(Var("-"), Tup((N, Var("x")), (N, IntLit(1))))))), Some(App(Var("f"), Tup((N, App(Var("-"), Tup((N, Var("x")), (N, IntLit(2))))))))))))), App(Var("g"), Tup((N, IntLit(1))))) +//│ TypingUnit(List(NuFunDef(Some(false),Var(any),None,List(),Left(IntLit(-20))), NuFunDef(None,Var(f),None,List(),Left(Lam(Tup(List((None,Fld(FldFlags(false,false,false),Var(x))))),Blk(List(If(IfThen(App(Var(>),Tup(List((None,Fld(FldFlags(false,false,false),Var(x))), (None,Fld(FldFlags(false,false,false),Var(any)))))),IntLit(0)),Some(App(Var(g),Tup(List((None,Fld(FldFlags(false,false,false),App(Var(-),Tup(List((None,Fld(FldFlags(false,false,false),Var(x))), (None,Fld(FldFlags(false,false,false),IntLit(1)))))))))))))))))), NuFunDef(None,Var(g),None,List(),Left(Lam(Tup(List((None,Fld(FldFlags(false,false,false),Var(x))))),Blk(List(If(IfThen(App(Var(>),Tup(List((None,Fld(FldFlags(false,false,false),Var(x))), (None,Fld(FldFlags(false,false,false),Var(any)))))),App(Var(g),Tup(List((None,Fld(FldFlags(false,false,false),App(Var(-),Tup(List((None,Fld(FldFlags(false,false,false),Var(x))), (None,Fld(FldFlags(false,false,false),IntLit(1)))))))))))),Some(App(Var(f),Tup(List((None,Fld(FldFlags(false,false,false),App(Var(-),Tup(List((None,Fld(FldFlags(false,false,false),Var(x))), (None,Fld(FldFlags(false,false,false),IntLit(2)))))))))))))))))), App(Var(g),Tup(List((None,Fld(FldFlags(false,false,false),IntLit(1)))))))) //│ Lifted: //│ TypingUnit { //│ let any$3 = () => -20 @@ -977,7 +977,7 @@ class OneBool(b: Bool){ } (if b then new OneInt(1) else new OneBool(true)).get() //│ Parsed: -//│ TypingUnit(NuTypeDef(Cls, TypeName("OneInt"), Ls(), S(Tup((S(Var("a")), Var("Int")))), N, N, Ls(), N, N, TypingUnit(NuFunDef(None, get, N, Nil, L(Lam(Tup(), Var("a")))))), NuTypeDef(Cls, TypeName("OneBool"), Ls(), S(Tup((S(Var("b")), Var("Bool")))), N, N, Ls(), N, N, TypingUnit(NuFunDef(None, get, N, Nil, L(Lam(Tup(), Var("b")))))), App(Sel(Bra(rcd = false, If(IfThen(Var("b"), App(NuNew(Var("OneInt")), Tup((N, IntLit(1)))), Some(App(NuNew(Var("OneBool")), Tup((N, Var("true"))))))), get), Tup())) +//│ TypingUnit(List(NuTypeDef(Cls,TypeName(OneInt),List(),Some(Tup(List((Some(Var(a)),Fld(FldFlags(false,false,false),Var(Int)))))),None,None,List(),None,None,TypingUnit(List(NuFunDef(None,Var(get),None,List(),Left(Lam(Tup(List()),Var(a))))))), NuTypeDef(Cls,TypeName(OneBool),List(),Some(Tup(List((Some(Var(b)),Fld(FldFlags(false,false,false),Var(Bool)))))),None,None,List(),None,None,TypingUnit(List(NuFunDef(None,Var(get),None,List(),Left(Lam(Tup(List()),Var(b))))))), App(Sel(Bra(false,If(IfThen(Var(b),App(NuNew(Var(OneInt)),Tup(List((None,Fld(FldFlags(false,false,false),IntLit(1))))))),Some(App(NuNew(Var(OneBool)),Tup(List((None,Fld(FldFlags(false,false,false),Var(true))))))))),Var(get)),Tup(List())))) //│ Lifted: //│ TypingUnit { //│ class OneInt$1([a: Int,]) {fun get = () => (this).a} @@ -1023,7 +1023,7 @@ baz(bar) (new Car()).da(Bar(1337)) bar.car //│ Parsed: -//│ TypingUnit(NuTypeDef(Cls, TypeName("Bar"), Ls(), S(Tup((S(Var("x")), Var("Int")))), N, N, Ls(), N, N, TypingUnit(NuFunDef(None, foo, N, Nil, L(Lam(Tup((N, Var("x"))), Var("x")))), NuFunDef(None, FooMinus, N, Nil, L(Lam(Tup((S(Var("y")), Var("Int"))), App(Var("+"), Tup((N, Var("x")), (N, Var("y"))))))), NuFunDef(None, car, N, Nil, L(App(Var("foo"), Tup((N, IntLit(2)))))))), NuTypeDef(Cls, TypeName("Car"), Ls(), N, N, N, Ls(), N, N, TypingUnit(NuFunDef(None, da, N, Nil, L(Lam(Tup((S(Var("b")), Var("Bar"))), App(Sel(Var("b"), foo), Tup((N, IntLit(2))))))))), NuFunDef(None, baz, N, Nil, L(Lam(Tup((S(Var("b")), Var("Bar"))), App(Sel(Var("b"), foo), Tup((N, IntLit(2))))))), NuFunDef(Some(false), bar, N, Nil, L(App(Var("Bar"), Tup((N, IntLit(42)))))), App(Var("baz"), Tup((N, Var("bar")))), App(Sel(Bra(rcd = false, App(NuNew(Var("Car")), Tup())), da), Tup((N, App(Var("Bar"), Tup((N, IntLit(1337))))))), Sel(Var("bar"), car)) +//│ TypingUnit(List(NuTypeDef(Cls,TypeName(Bar),List(),Some(Tup(List((Some(Var(x)),Fld(FldFlags(false,false,false),Var(Int)))))),None,None,List(),None,None,TypingUnit(List(NuFunDef(None,Var(foo),None,List(),Left(Lam(Tup(List((None,Fld(FldFlags(false,false,false),Var(x))))),Var(x)))), NuFunDef(None,Var(FooMinus),None,List(),Left(Lam(Tup(List((Some(Var(y)),Fld(FldFlags(false,false,false),Var(Int))))),App(Var(+),Tup(List((None,Fld(FldFlags(false,false,false),Var(x))), (None,Fld(FldFlags(false,false,false),Var(y))))))))), NuFunDef(None,Var(car),None,List(),Left(App(Var(foo),Tup(List((None,Fld(FldFlags(false,false,false),IntLit(2))))))))))), NuTypeDef(Cls,TypeName(Car),List(),None,None,None,List(),None,None,TypingUnit(List(NuFunDef(None,Var(da),None,List(),Left(Lam(Tup(List((Some(Var(b)),Fld(FldFlags(false,false,false),Var(Bar))))),App(Sel(Var(b),Var(foo)),Tup(List((None,Fld(FldFlags(false,false,false),IntLit(2)))))))))))), NuFunDef(None,Var(baz),None,List(),Left(Lam(Tup(List((Some(Var(b)),Fld(FldFlags(false,false,false),Var(Bar))))),App(Sel(Var(b),Var(foo)),Tup(List((None,Fld(FldFlags(false,false,false),IntLit(2))))))))), NuFunDef(Some(false),Var(bar),None,List(),Left(App(Var(Bar),Tup(List((None,Fld(FldFlags(false,false,false),IntLit(42)))))))), App(Var(baz),Tup(List((None,Fld(FldFlags(false,false,false),Var(bar)))))), App(Sel(Bra(false,App(NuNew(Var(Car)),Tup(List()))),Var(da)),Tup(List((None,Fld(FldFlags(false,false,false),App(Var(Bar),Tup(List((None,Fld(FldFlags(false,false,false),IntLit(1337))))))))))), Sel(Var(bar),Var(car)))) //│ Lifted: //│ TypingUnit { //│ class Bar$1([x: Int,]) { @@ -1094,7 +1094,7 @@ class Sub2(c: Int) extends Sub(c+c){ (new Sub(10)).foo() (new Sub2(c)).foo() //│ Parsed: -//│ TypingUnit(NuFunDef(Some(false), c, N, Nil, L(IntLit(5))), NuTypeDef(Cls, TypeName("Sup"), Ls(), S(Tup((S(Var("a")), Var("Int")))), N, N, Ls(), N, N, TypingUnit(NuFunDef(None, foo, N, Nil, L(Lam(Tup(), Var("a")))))), NuTypeDef(Cls, TypeName("Sub"), Ls(), S(Tup((S(Var("b")), Var("Int")))), N, N, Ls(App(Var("Sup"), Tup((N, App(Var("+"), Tup((N, Var("b")), (N, Var("b")))))))), N, N, TypingUnit()), NuTypeDef(Cls, TypeName("Sub2"), Ls(), S(Tup((S(Var("c")), Var("Int")))), N, N, Ls(App(Var("Sub"), Tup((N, App(Var("+"), Tup((N, Var("c")), (N, Var("c")))))))), N, N, TypingUnit(NuFunDef(None, foo, N, Nil, L(Lam(Tup(), App(Var("+"), Tup((N, Var("a")), (N, Var("c"))))))))), App(Sel(Bra(rcd = false, App(NuNew(Var("Sub")), Tup((N, IntLit(10))))), foo), Tup()), App(Sel(Bra(rcd = false, App(NuNew(Var("Sub2")), Tup((N, Var("c"))))), foo), Tup())) +//│ TypingUnit(List(NuFunDef(Some(false),Var(c),None,List(),Left(IntLit(5))), NuTypeDef(Cls,TypeName(Sup),List(),Some(Tup(List((Some(Var(a)),Fld(FldFlags(false,false,false),Var(Int)))))),None,None,List(),None,None,TypingUnit(List(NuFunDef(None,Var(foo),None,List(),Left(Lam(Tup(List()),Var(a))))))), NuTypeDef(Cls,TypeName(Sub),List(),Some(Tup(List((Some(Var(b)),Fld(FldFlags(false,false,false),Var(Int)))))),None,None,List(App(Var(Sup),Tup(List((None,Fld(FldFlags(false,false,false),App(Var(+),Tup(List((None,Fld(FldFlags(false,false,false),Var(b))), (None,Fld(FldFlags(false,false,false),Var(b)))))))))))),None,None,TypingUnit(List())), NuTypeDef(Cls,TypeName(Sub2),List(),Some(Tup(List((Some(Var(c)),Fld(FldFlags(false,false,false),Var(Int)))))),None,None,List(App(Var(Sub),Tup(List((None,Fld(FldFlags(false,false,false),App(Var(+),Tup(List((None,Fld(FldFlags(false,false,false),Var(c))), (None,Fld(FldFlags(false,false,false),Var(c)))))))))))),None,None,TypingUnit(List(NuFunDef(None,Var(foo),None,List(),Left(Lam(Tup(List()),App(Var(+),Tup(List((None,Fld(FldFlags(false,false,false),Var(a))), (None,Fld(FldFlags(false,false,false),Var(c)))))))))))), App(Sel(Bra(false,App(NuNew(Var(Sub)),Tup(List((None,Fld(FldFlags(false,false,false),IntLit(10))))))),Var(foo)),Tup(List())), App(Sel(Bra(false,App(NuNew(Var(Sub2)),Tup(List((None,Fld(FldFlags(false,false,false),Var(c))))))),Var(foo)),Tup(List())))) //│ Lifted: //│ TypingUnit { //│ class Sup$1([a: Int,]) {fun foo = () => (this).a} @@ -1152,7 +1152,7 @@ class F2() extends Foo(x => x+2){} (new F1()).foo() (new F2()).foo() //│ Parsed: -//│ TypingUnit(NuTypeDef(Cls, TypeName("Foo"), Ls(), S(Tup((S(Var("f")), App(Var("->"), Tup((N, Var("Int")), (N, Var("Int"))))))), N, N, Ls(), N, N, TypingUnit(NuFunDef(None, foo, N, Nil, L(Lam(Tup(), App(Var("f"), Tup((N, IntLit(1))))))))), NuTypeDef(Cls, TypeName("F1"), Ls(), S(Tup()), N, N, Ls(App(Var("Foo"), Tup((N, Lam(Tup((N, Var("x"))), App(Var("+"), Tup((N, Var("x")), (N, IntLit(1))))))))), N, N, TypingUnit()), NuTypeDef(Cls, TypeName("F2"), Ls(), S(Tup()), N, N, Ls(App(Var("Foo"), Tup((N, Lam(Tup((N, Var("x"))), App(Var("+"), Tup((N, Var("x")), (N, IntLit(2))))))))), N, N, TypingUnit()), App(Sel(Bra(rcd = false, App(NuNew(Var("F1")), Tup())), foo), Tup()), App(Sel(Bra(rcd = false, App(NuNew(Var("F2")), Tup())), foo), Tup())) +//│ TypingUnit(List(NuTypeDef(Cls,TypeName(Foo),List(),Some(Tup(List((Some(Var(f)),Fld(FldFlags(false,false,false),App(Var(->),Tup(List((None,Fld(FldFlags(false,false,false),Var(Int))), (None,Fld(FldFlags(false,false,false),Var(Int))))))))))),None,None,List(),None,None,TypingUnit(List(NuFunDef(None,Var(foo),None,List(),Left(Lam(Tup(List()),App(Var(f),Tup(List((None,Fld(FldFlags(false,false,false),IntLit(1)))))))))))), NuTypeDef(Cls,TypeName(F1),List(),Some(Tup(List())),None,None,List(App(Var(Foo),Tup(List((None,Fld(FldFlags(false,false,false),Lam(Tup(List((None,Fld(FldFlags(false,false,false),Var(x))))),App(Var(+),Tup(List((None,Fld(FldFlags(false,false,false),Var(x))), (None,Fld(FldFlags(false,false,false),IntLit(1))))))))))))),None,None,TypingUnit(List())), NuTypeDef(Cls,TypeName(F2),List(),Some(Tup(List())),None,None,List(App(Var(Foo),Tup(List((None,Fld(FldFlags(false,false,false),Lam(Tup(List((None,Fld(FldFlags(false,false,false),Var(x))))),App(Var(+),Tup(List((None,Fld(FldFlags(false,false,false),Var(x))), (None,Fld(FldFlags(false,false,false),IntLit(2))))))))))))),None,None,TypingUnit(List())), App(Sel(Bra(false,App(NuNew(Var(F1)),Tup(List()))),Var(foo)),Tup(List())), App(Sel(Bra(false,App(NuNew(Var(F2)),Tup(List()))),Var(foo)),Tup(List())))) //│ Lifted: //│ TypingUnit { //│ class Foo$1([f: ->(Int, Int,),]) {fun foo = () => (this).f(1,)}