diff --git a/compiler/shared/test/diff/LambLift.mls b/compiler/shared/test/diff/LambLift.mls index bbfea08e3..ec08d4f08 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(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())))) +//│ 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(_,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(_,Var(x))), (None,Fld(_,App(Var(foo),Tup(List())))))))))))), Sel(Bra(false,App(NuNew(Var(Foo)),Tup(List()))),Var(bar))))))), App(Var(local),Tup(List((None,Fld(_,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(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)))))))))))))) +//│ TypingUnit(List(NuFunDef(None,Var(foo),None,List(),Left(Lam(Tup(List((None,Fld(_,Var(f))))),Blk(List(App(Var(f),Tup(List((None,Fld(_,IntLit(1))))))))))), App(Var(foo),Tup(List((None,Fld(_,Lam(Tup(List((None,Fld(_,Var(x))))),App(Var(+),Tup(List((None,Fld(_,Var(x))), (None,Fld(_,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(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)))))))) +//│ TypingUnit(List(NuFunDef(None,Var(foo),None,List(),Left(Lam(Tup(List((None,Fld(_,Var(x))))),Blk(List(NuFunDef(Some(false),Var(bar),None,List(),Left(Lam(Tup(List((None,Fld(_,Var(f))))),Blk(List(App(Var(f),Tup(List((None,Fld(_,Var(x))))))))))), App(Var(bar),Tup(List((None,Fld(_,Lam(Tup(List((None,Fld(_,Var(y))))),App(Var(+),Tup(List((None,Fld(_,Var(y))), (None,Fld(_,Var(x))))))))))))))))), App(Var(foo),Tup(List((None,Fld(_,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(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))))))))))))) +//│ TypingUnit(List(NuFunDef(None,Var(foo),None,List(),Left(Lam(Tup(List((None,Fld(_,Var(f))))),Blk(List(App(Var(f),Tup(List((None,Fld(_,IntLit(1))))))))))), NuTypeDef(Cls,TypeName(A),List(),Some(Tup(List((Some(Var(y)),Fld(_,Var(Int)))))),None,None,List(),None,None,TypingUnit(List(NuFunDef(None,Var(bar),None,List(),Left(Lam(Tup(List((None,Fld(_,Var(z))))),App(Var(+),Tup(List((None,Fld(_,Var(y))), (None,Fld(_,Var(z)))))))))))), NuFunDef(None,Var(app),None,List(),Left(Lam(Tup(List((None,Fld(_,Var(a))))),Blk(List(App(Var(foo),Tup(List((None,Fld(_,Lam(Tup(List((None,Fld(_,Var(z))))),App(Sel(Var(a),Var(bar)),Tup(List((None,Fld(_,Var(z))))))))))))))))), App(Var(app),Tup(List((None,Fld(_,App(NuNew(Var(A)),Tup(List((None,Fld(_,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 0d8ea8eaf..4f2bebe4d 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(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))))))))))) +//│ 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(_,Lam(Tup(List((None,Fld(_,Var(A))))),Var(A)))))),Asc(App(Var(f),Tup(List((None,Fld(_,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(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)))))))))))))) +//│ TypingUnit(List(NuTypeDef(Cls,TypeName(CTX),List(),Some(Tup(List((None,Fld(_,Var(x))), (None,Fld(_,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(_,Tup(List((None,Fld(_,Var(A))), (None,Fld(_,Var(B))))))))),Asc(Tup(List((None,Fld(_,Sel(Var(any),Var(_2)))), (None,Fld(_,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(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)))))))))))))) +//│ TypingUnit(List(NuTypeDef(Cls,TypeName(CTX),List(),Some(Tup(List((None,Fld(_,Var(x))), (None,Fld(_,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(_,Bra(true,Rcd(List((Var(p1),Fld(_,Var(A))), (Var(p2),Fld(_,Var(B)))))))))),Asc(Tup(List((None,Fld(_,Sel(Var(any),Var(p2)))), (None,Fld(_,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(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)))))))))))))) +//│ TypingUnit(List(NuTypeDef(Cls,TypeName(CTX),List(),Some(Tup(List((None,Fld(_,Var(x))), (None,Fld(_,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(_,Tup(List((None,Fld(_,Var(A))), (None,Fld(_,TyApp(Var(B),List(TypeName(A))))))))))),Asc(Tup(List((None,Fld(_,Var(any))), (None,Fld(_,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(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))))))))))))) +//│ 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(_,Var(x))), (None,Fld(_,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(_,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 d55d43034..a1eb51a20 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(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))))))))))))) +//│ TypingUnit(List(NuTypeDef(Cls,TypeName(A),List(),Some(Tup(List((None,Fld(_,Var(x)))))),None,None,List(),None,None,TypingUnit(List(NuTypeDef(Cls,TypeName(B),List(),Some(Tup(List((None,Fld(_,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(_,Var(y)))))))), NuTypeDef(Cls,TypeName(C),List(),Some(Tup(List((None,Fld(_,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(_,Var(x))), (None,Fld(_,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(_,Var(z)))))))), NuFunDef(None,Var(getB),None,List(),Left(Lam(Tup(List((None,Fld(_,Var(w))))),App(Var(B),Tup(List((None,Fld(_,Var(w))))))))), NuFunDef(None,Var(getC),None,List(),Left(App(NuNew(Var(C)),Tup(List((None,Fld(_,App(Var(inc),Tup(List()))))))))), NuFunDef(None,Var(getSelf),None,List(),Left(Var(this))))))))), NuTypeDef(Cls,TypeName(B1),List(),Some(Tup(List((None,Fld(_,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(_,Var(y)))))))), NuFunDef(None,Var(getB1),None,List(),Left(App(NuNew(Var(B1)),Tup(List((None,Fld(_,Var(y))))))))))), NuFunDef(None,Var(getB),None,List(),Left(App(NuNew(Var(B)),Tup(List((None,Fld(_,Var(x)))))))), NuFunDef(None,Var(getB2),None,List(),Left(Lam(Tup(List((None,Fld(_,Var(y))))),App(Var(B1),Tup(List((None,Fld(_,Var(y))))))))), NuFunDef(None,Var(getB3),None,List(),Left(Lam(Tup(List((None,Fld(_,Var(z))))),App(Var(getB2),Tup(List((None,Fld(_,Var(z))))))))), NuFunDef(None,Var(getA),None,List(),Left(App(Var(A),Tup(List((None,Fld(_,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(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))))))))))))))))))) +//│ TypingUnit(List(NuTypeDef(Cls,TypeName(A),List(),Some(Tup(List((None,Fld(_,Var(x)))))),None,None,List(),None,None,TypingUnit(List(NuTypeDef(Cls,TypeName(B),List(),Some(Tup(List((None,Fld(_,Var(y)))))),None,None,List(),None,None,TypingUnit(List(NuTypeDef(Cls,TypeName(C),List(),Some(Tup(List((None,Fld(_,Var(z)))))),None,None,List(),None,None,TypingUnit(List(NuFunDef(None,Var(sum),None,List(),Left(App(Var(+),Tup(List((None,Fld(_,App(Var(+),Tup(List((None,Fld(_,Var(x))), (None,Fld(_,Var(y)))))))), (None,Fld(_,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(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)))))))) +//│ TypingUnit(List(NuTypeDef(Cls,TypeName(A),List(),Some(Tup(List((None,Fld(_,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(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)))))))))))) +//│ TypingUnit(List(NuTypeDef(Cls,TypeName(Parent),List((None,TypeName(T)), (None,TypeName(U)), (None,TypeName(V))),Some(Tup(List((None,Fld(_,Var(x)))))),None,None,List(),None,None,TypingUnit(List(NuFunDef(None,Var(foo),None,List(),Left(Lam(Tup(List((Some(Var(x)),Fld(_,Var(Int))))),Asc(App(Var(+),Tup(List((None,Fld(_,Var(x))), (None,Fld(_,IntLit(1)))))),TypeName(T))))), NuTypeDef(Cls,TypeName(Inner),List((None,TypeName(W))),Some(Tup(List((Some(Var(y)),Fld(_,Var(Int)))))),None,None,List(),None,None,TypingUnit(List(NuFunDef(None,Var(bar),None,List(),Left(Lam(Tup(List((Some(Var(z)),Fld(_,Var(U))))),App(Var(foo),Tup(List((None,Fld(_,Var(y))))))))), NuFunDef(None,Var(boo),None,List(),Left(Lam(Tup(List((Some(Var(z)),Fld(_,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(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))))))))))))))) +//│ 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(_,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(_,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(_,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(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))))))))))))))) +//│ 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(_,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(_,Var(Int)))))),None,None,List(Bra(true,Rcd(List((Var(a1),Fld(_,Var(Int)))))), TyApp(Var(B),List(TypeName(T))), App(Var(D),Tup(List((None,Fld(_,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(_,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(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))))))))) +//│ TypingUnit(List(NuTypeDef(Cls,TypeName(Child),List((None,TypeName(T)), (None,TypeName(U))),Some(Tup(List((None,Fld(_,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(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)))))))) +//│ TypingUnit(List(NuTypeDef(Cls,TypeName(A),List(),Some(Tup(List((Some(Var(x)),Fld(_,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(_,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(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)))))))))))))))))) +//│ TypingUnit(List(NuTypeDef(Cls,TypeName(A),List(),Some(Tup(List((None,Fld(_,Var(x)))))),None,None,List(),None,None,TypingUnit(List(NuTypeDef(Cls,TypeName(B),List(),Some(Tup(List((None,Fld(_,Var(y)))))),None,None,List(),None,None,TypingUnit(List()))))), Rft(App(NuNew(Var(A)),Tup(List((None,Fld(_,IntLit(1)))))),TypingUnit(List(NuFunDef(None,Var(getB),None,List(),Left(Rft(App(NuNew(Var(B)),Tup(List((None,Fld(_,IntLit(2)))))),TypingUnit(List(NuFunDef(None,Var(getB),None,List(),Left(App(NuNew(Var(B)),Tup(List((None,Fld(_,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(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)))))))) +//│ 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(_,Var(x))))),If(IfThen(App(Var(is),Tup(List((None,Fld(_,Var(x))), (None,Fld(_,Var(A)))))),IntLit(0)),Some(IntLit(1)))))), App(Var(f),Tup(List((None,Fld(_,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} @@ -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(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)))))))))))))))))))) +//│ TypingUnit(List(NuTypeDef(Cls,TypeName(A),List(),Some(Tup(List((None,Fld(_,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(_,Var(foo)))))),TypingUnit(List(NuFunDef(None,Var(foo),None,List(),Left(App(Var(+),Tup(List((None,Fld(_,Var(bar))), (None,Fld(_,IntLit(1)))))))), NuFunDef(None,Var(bar2),None,List(),Left(App(Var(+),Tup(List((None,Fld(_,Var(newFun))), (None,Fld(_,IntLit(1)))))))))))))))))))) //│ Lifted: //│ TypingUnit { //│ class A$1([x,]) {fun foo = () => 0; fun bar = () => (this).x} diff --git a/compiler/shared/test/diff/LifterBlks.mls b/compiler/shared/test/diff/LifterBlks.mls index f5e52e146..826dc8a9c 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(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)))))))))))) +//│ TypingUnit(List(NuFunDef(None,Var(foo),None,List(),Left(Blk(List(App(Var(print),Tup(List((None,Fld(_,StrLit(ok)))))), App(Var(print),Tup(List((None,Fld(_,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(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))))))))))) +//│ 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(_,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(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))))))))) +//│ TypingUnit(List(NuFunDef(None,Var(foo),None,List(),Left(Blk(List(NuFunDef(Some(false),Var(local),None,List(),Left(Lam(Tup(List((None,Fld(_,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(_,Var(x))), (None,Fld(_,IntLit(1))))))))))), Sel(App(Var(Foo),Tup(List())),Var(bar))))))), App(Var(print),Tup(List((None,Fld(_,App(Var(+),Tup(List((None,Fld(_,App(Var(local),Tup(List((None,Fld(_,IntLit(0)))))))), (None,Fld(_,App(Var(local),Tup(List((None,Fld(_,IntLit(1)))))))))))))))), App(Var(print),Tup(List((None,Fld(_,App(Var(+),Tup(List((None,Fld(_,Bra(false,App(Var(local),Tup(List((None,Fld(_,IntLit(0))))))))), (None,Fld(_,App(Var(local),Tup(List((None,Fld(_,IntLit(1)))))))))))))))), NuFunDef(None,Var(tmp),None,List(),Left(IntLit(1))), App(Var(print),Tup(List((None,Fld(_,App(Var(local),Tup(List((None,Fld(_,App(Var(+),Tup(List((None,Fld(_,IntLit(0))), (None,Fld(_,App(Var(local),Tup(List((None,Fld(_,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(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)))))))) +//│ TypingUnit(List(NuTypeDef(Cls,TypeName(A),List(),Some(Tup(List((None,Fld(_,Var(y)))))),None,None,List(),None,None,TypingUnit(List())), NuFunDef(Some(false),Var(f),None,List(),Left(Lam(Tup(List((None,Fld(_,Var(x))))),Rft(App(NuNew(Var(A)),Tup(List((None,Fld(_,IntLit(0)))))),TypingUnit(List(NuFunDef(None,Var(bar),None,List(),Left(App(Var(+),Tup(List((None,Fld(_,Var(x))), (None,Fld(_,Var(y)))))))))))))), App(Var(f),Tup(List((None,Fld(_,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(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))))))))))))))))))))) +//│ TypingUnit(List(NuTypeDef(Cls,TypeName(A),List(),Some(Tup(List((None,Fld(_,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(_,Var(y))))),Blk(List(NuTypeDef(Cls,TypeName(B),List(),Some(Tup(List((None,Fld(_,Var(z)))))),None,None,List(),None,None,TypingUnit(List(NuFunDef(None,Var(bar),None,List(),Left(App(Var(+),Tup(List((None,Fld(_,App(Var(+),Tup(List((None,Fld(_,Var(x))), (None,Fld(_,Var(y)))))))), (None,Fld(_,Var(z))))))))))), Rft(App(NuNew(Var(B)),Tup(List((None,Fld(_,IntLit(0)))))),TypingUnit(List(NuFunDef(None,Var(bar),None,List(),Left(App(Var(+),Tup(List((None,Fld(_,App(Var(+),Tup(List((None,Fld(_,Var(w))), (None,Fld(_,Var(y)))))))), (None,Fld(_,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(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)))))))))))))))))) +//│ TypingUnit(List(NuFunDef(None,Var(f),None,List(),Left(Lam(Tup(List((None,Fld(_,Var(x))), (None,Fld(_,Var(y))), (None,Fld(_,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(_,Var(bar1))), (None,Fld(_,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(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)))))))))))))))))) +//│ TypingUnit(List(NuFunDef(None,Var(f),None,List(),Left(Lam(Tup(List((None,Fld(_,Var(x))), (None,Fld(_,Var(y))), (None,Fld(_,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(_,App(Var(+),Tup(List((None,Fld(_,Sel(Bra(false,NuNew(Var(A))),Var(bar1)))), (None,Fld(_,Sel(App(Var(B),Tup(List())),Var(bar2))))))))), (None,Fld(_,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(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)))))))))))))))))) +//│ TypingUnit(List(NuFunDef(None,Var(f),None,List(),Left(Lam(Tup(List((None,Fld(_,Var(y))))),Blk(List(NuFunDef(Some(false),Var(g),None,List(),Left(Lam(Tup(List((None,Fld(_,Var(x))))),App(Var(+),Tup(List((None,Fld(_,App(Var(+),Tup(List((None,Fld(_,Var(x))), (None,Fld(_,Var(y)))))))), (None,Fld(_,IntLit(1))))))))), NuTypeDef(Cls,TypeName(Foo),List(),Some(Tup(List((None,Fld(_,Var(x)))))),None,None,List(),None,None,TypingUnit(List(NuFunDef(None,Var(h),None,List(),Left(App(Var(g),Tup(List((None,Fld(_,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(List(Sel(App(Var(Foo),Tup(List((None,Fld(FldFlags(false,false,false),IntLit(1)))))),Var(h)))) +//│ TypingUnit(List(Sel(App(Var(Foo),Tup(List((None,Fld(_,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(List(Sel(App(Var(Foo),Tup(List((None,Fld(FldFlags(false,false,false),Var(x)))))),Var(h)))) +//│ TypingUnit(List(Sel(App(Var(Foo),Tup(List((None,Fld(_,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(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))))))))) +//│ TypingUnit(List(NuFunDef(None,Var(f),None,List(),Left(Lam(Tup(List((None,Fld(_,Var(x))))),Blk(List(NuFunDef(Some(false),Var(g),None,List(),Left(Lam(Tup(List((None,Fld(_,Var(x))))),Blk(List(NuFunDef(Some(false),Var(h),None,List(),Left(Lam(Tup(List((None,Fld(_,Var(x))))),App(Var(+),Tup(List((None,Fld(_,Var(x))), (None,Fld(_,IntLit(2))))))))), Sel(App(Var(Foo),Tup(List((None,Fld(_,App(Var(h),Tup(List((None,Fld(_,Var(x)))))))), (None,Fld(_,Var(x)))))),Var(bar))))))), NuTypeDef(Cls,TypeName(Foo),List(),Some(Tup(List((None,Fld(_,Var(x))), (None,Fld(_,Var(y)))))),None,None,List(),None,None,TypingUnit(List(NuFunDef(None,Var(bar),None,List(),Left(App(Var(+),Tup(List((None,Fld(_,App(Var(g),Tup(List((None,Fld(_,Var(x)))))))), (None,Fld(_,Var(y))))))))))), Sel(App(Var(Foo),Tup(List((None,Fld(_,Var(x))), (None,Fld(_,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(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())))) +//│ TypingUnit(List(NuTypeDef(Cls,TypeName(Foo),List(),Some(Tup(List((None,Fld(_,Var(x))), (None,Fld(_,Var(y)))))),None,None,List(App(Var(Bar),Tup(List((None,Fld(_,Var(y))), (None,Fld(_,Var(x)))))), App(Var(Baz),Tup(List((None,Fld(_,App(Var(+),Tup(List((None,Fld(_,Var(x))), (None,Fld(_,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(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))))))) +//│ TypingUnit(List(NuFunDef(None,Var(foo),None,List(TypeName(T), TypeName(U)),Left(Lam(Tup(List((Some(Var(x)),Fld(_,Var(T))))),Asc(Blk(List(NuTypeDef(Cls,TypeName(A),List(),Some(Tup(List((None,Fld(_,Var(y)))))),None,None,List(TyApp(Var(B),List(TypeName(T))), App(Var(C),Tup(List((Some(Var(y)),Fld(_,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(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)))))))))))))) +//│ 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(_,Var(x))))),Lam(Tup(List((None,Fld(_,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} @@ -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(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))))))))))))) +//│ 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(_,Var(a))), (None,Fld(_,Var(b))))),Blk(List(NuFunDef(None,Var(foo),None,List(),Left(Lam(Tup(List((Some(Var(f)),Fld(_,Var(Func))), (None,Fld(_,Var(x))))),Blk(List(App(Sel(Var(f),Var(apply)),Tup(List((None,Fld(_,Var(x))))))))))), App(Var(foo),Tup(List((None,Fld(_,Rft(NuNew(Var(Lambda)),TypingUnit(List(NuFunDef(None,Var(apply),None,List(),Left(Lam(Tup(List((None,Fld(_,Var(x))))),App(Var(+),Tup(List((None,Fld(_,Var(a))), (None,Fld(_,Var(x)))))))))))))), (None,Fld(_,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(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)))))))) +//│ TypingUnit(List(NuFunDef(None,Var(f),None,List(),Left(Lam(Tup(List((None,Fld(_,Var(T))))),Blk(List(App(NuNew(Var(T)),Tup(List()))))))), App(Var(f),Tup(List((None,Fld(_,Var(MyClass)))))))) //│ Lifted: //│ Lifting failed: mlscript.codegen.CodeGenError: Cannot find type T. Class values are not supported in lifter. //│ diff --git a/compiler/shared/test/diff/mono.mls b/compiler/shared/test/diff/mono.mls index 43422ef6d..ef39b7e12 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(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)))))))) +//│ TypingUnit(List(NuFunDef(None,Var(f),None,List(),Left(Lam(Tup(List((Some(Var(x)),Fld(_,Var(Int))))),If(IfThen(Var(x),IntLit(42)),Some(IntLit(1337)))))))) //│ Lifted: //│ TypingUnit { //│ fun f$1 = (x: Int,) => if (x) then 42 else 1337 @@ -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(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)))))))))) +//│ TypingUnit(List(NuFunDef(None,Var(foo),None,List(),Left(Lam(Tup(List((None,Fld(_,Var(x))), (None,Fld(s,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(_,IntLit(42))), (None,Fld(_,Var(true)))))))), NuFunDef(Some(false),Var(b),None,List(),Left(App(Var(foo),Tup(List((None,Fld(_,IntLit(23))), (None,Fld(_,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(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)))))))))) +//│ TypingUnit(List(NuFunDef(Some(false),Var(x),None,List(),Left(App(Var(+),Tup(List((None,Fld(_,IntLit(42))), (None,Fld(_,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(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)))))))))) +//│ TypingUnit(List(If(IfThen(Var(true),IntLit(1)),Some(IntLit(0))), If(IfThen(App(Var(>),Tup(List((None,Fld(_,App(Var(+),Tup(List((None,Fld(_,IntLit(1))), (None,Fld(_,IntLit(1)))))))), (None,Fld(_,IntLit(1)))))),App(Var(-),Tup(List((None,Fld(_,IntLit(1))), (None,Fld(_,IntLit(1))))))),Some(App(Var(*),Tup(List((None,Fld(_,IntLit(1))), (None,Fld(_,IntLit(1)))))))))) //│ Lifted: //│ TypingUnit { //│ Code(List(if (true) then 1 else 0)) @@ -139,7 +139,7 @@ if(b) then 1 else 2 :mono ((f, g) => f(g))(f => f, true) //│ Parsed: -//│ 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)))))))) +//│ TypingUnit(List(App(Bra(false,Lam(Tup(List((None,Fld(_,Var(f))), (None,Fld(_,Var(g))))),App(Var(f),Tup(List((None,Fld(_,Var(g)))))))),Tup(List((None,Fld(_,Lam(Tup(List((None,Fld(_,Var(f))))),Var(f)))), (None,Fld(_,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(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)))))))) +//│ TypingUnit(List(App(Bra(false,Lam(Tup(List((None,Fld(_,Var(b))))),If(IfThen(Var(b),Var(true)),Some(Var(false))))),Tup(List((None,Fld(_,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(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)))))))) +//│ TypingUnit(List(NuFunDef(None,Var(f),None,List(),Left(Lam(Tup(List((None,Fld(_,Var(x))))),Blk(List(If(IfThen(Bra(false,App(Var(>),Tup(List((None,Fld(_,Var(x))), (None,Fld(_,IntLit(0))))))),App(Var(+),Tup(List((None,Fld(_,Var(x))), (None,Fld(_,IntLit(1))))))),Some(App(Var(-),Tup(List((None,Fld(_,Var(x))), (None,Fld(_,IntLit(1))))))))))))), App(Var(+),Tup(List((None,Fld(_,App(Var(f),Tup(List((None,Fld(_,IntLit(2)))))))), (None,Fld(_,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(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)))))))) +//│ TypingUnit(List(NuFunDef(None,Var(fac),None,List(),Left(Lam(Tup(List((None,Fld(_,Var(n))))),Blk(List(If(IfThen(Bra(false,App(Var(>),Tup(List((None,Fld(_,Var(n))), (None,Fld(_,IntLit(1))))))),App(Var(*),Tup(List((None,Fld(_,App(Var(fac),Tup(List((None,Fld(_,App(Var(-),Tup(List((None,Fld(_,Var(n))), (None,Fld(_,IntLit(1))))))))))))), (None,Fld(_,Var(n))))))),Some(IntLit(1)))))))), App(Var(fac),Tup(List((None,Fld(_,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(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))))))))))))) +//│ TypingUnit(List(NuTypeDef(Cls,TypeName(List),List(),Some(Tup(List((Some(Var(l)),Fld(g,App(Var(|),Tup(List((None,Fld(_,App(Var(|),Tup(List((None,Fld(_,Var(List))), (None,Fld(_,Var(Nil)))))))), (None,Fld(_,UnitLit(true)))))))), (Some(Var(hasTail)),Fld(g,Var(Bool)))))),None,None,List(),None,None,TypingUnit(List())), NuTypeDef(Cls,TypeName(Nil),List(),Some(Tup(List((Some(Var(l)),Fld(g,App(Var(|),Tup(List((None,Fld(_,App(Var(|),Tup(List((None,Fld(_,Var(List))), (None,Fld(_,Var(Nil)))))))), (None,Fld(_,UnitLit(true)))))))), (Some(Var(hasTail)),Fld(g,Var(Bool)))))),None,None,List(),None,None,TypingUnit(List())), NuFunDef(None,Var(count),None,List(),Left(Lam(Tup(List((None,Fld(_,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(_,Var(l))), (None,Fld(_,UnitLit(true)))))),IntLit(1)),Some(App(Var(+),Tup(List((None,Fld(_,App(Var(count),Tup(List((None,Fld(_,Var(l)))))))), (None,Fld(_,IntLit(1))))))))))),Some(IntLit(0)))))))), App(Var(count),Tup(List((None,Fld(_,App(NuNew(Var(List)),Tup(List((None,Fld(_,App(NuNew(Var(List)),Tup(List((None,Fld(_,App(NuNew(Var(Nil)),Tup(List((None,Fld(_,UnitLit(true))), (None,Fld(_,Var(false)))))))), (None,Fld(_,Var(true)))))))), (None,Fld(_,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(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)))))))))))))) +//│ TypingUnit(List(NuTypeDef(Cls,TypeName(List),List(),Some(Tup(List((Some(Var(e)),Fld(_,Var(Int))), (Some(Var(tail)),Fld(_,App(Var(|),Tup(List((None,Fld(_,Var(List))), (None,Fld(_,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(_,Var(f))))),App(NuNew(Var(List)),Tup(List((None,Fld(_,App(Var(f),Tup(List((None,Fld(_,Var(e)))))))), (None,Fld(_,App(Sel(Var(tail),Var(map)),Tup(List((None,Fld(_,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(_,IntLit(1))), (None,Fld(_,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(_,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(_,Var(x))))),App(Var(+),Tup(List((None,Fld(_,Var(x))), (None,Fld(_,IntLit(2))))))))), App(Sel(App(Sel(Bra(false,App(NuNew(Var(List)),Tup(List((None,Fld(_,IntLit(1))), (None,Fld(_,App(NuNew(Var(List)),Tup(List((None,Fld(_,IntLit(2))), (None,Fld(_,App(NuNew(Var(Nil)),Tup(List()))))))))))))),Var(map)),Tup(List((None,Fld(_,Lam(Tup(List((None,Fld(_,Var(x))))),App(Var(+),Tup(List((None,Fld(_,Var(x))), (None,Fld(_,IntLit(1)))))))))))),Var(map)),Tup(List((None,Fld(_,Lam(Tup(List((None,Fld(_,Var(x))))),App(Var(add2),Tup(List((None,Fld(_,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(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))))))))))))) +//│ TypingUnit(List(NuTypeDef(Cls,TypeName(List),List(),Some(Tup(List((Some(Var(e)),Fld(_,Var(Int))), (Some(Var(tail)),Fld(_,App(Var(|),Tup(List((None,Fld(_,Var(List))), (None,Fld(_,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(_,IntLit(1))), (None,Fld(_,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(_,Var(x))))),App(Sel(Var(x),Var(count)),Tup(List()))))), NuFunDef(None,Var(generate),None,List(),Left(Lam(Tup(List((None,Fld(_,Var(x))))),Blk(List(If(IfThen(App(Var(>),Tup(List((None,Fld(_,Var(x))), (None,Fld(_,IntLit(0)))))),App(NuNew(Var(List)),Tup(List((None,Fld(_,Var(x))), (None,Fld(_,App(Var(generate),Tup(List((None,Fld(_,App(Var(+),Tup(List((None,Fld(_,Var(x))), (None,Fld(_,IntLit(1))))))))))))))))),Some(App(NuNew(Var(Nil)),Tup(List()))))))))), App(Var(foo),Tup(List((None,Fld(_,App(NuNew(Var(List)),Tup(List((None,Fld(_,IntLit(1))), (None,Fld(_,App(NuNew(Var(List)),Tup(List((None,Fld(_,IntLit(2))), (None,Fld(_,App(NuNew(Var(Nil)),Tup(List()))))))))))))))))), App(Var(foo),Tup(List((None,Fld(_,App(Var(generate),Tup(List((None,Fld(_,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(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)))))))) +//│ TypingUnit(List(NuFunDef(None,Var(foo),None,List(),Left(Lam(Tup(List((None,Fld(_,Var(x))))),Blk(List(App(Bra(false,Lam(Tup(List((None,Fld(_,Var(f))))),App(Var(f),Tup(List((None,Fld(_,Var(x)))))))),Tup(List((None,Fld(_,Lam(Tup(List((None,Fld(_,Var(z))))),App(Var(+),Tup(List((None,Fld(_,Var(z))), (None,Fld(_,IntLit(1))))))))))))))))), App(Var(foo),Tup(List((None,Fld(_,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(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)))))))) +//│ TypingUnit(List(NuFunDef(None,Var(f),None,List(),Left(Lam(Tup(List((None,Fld(_,Var(x))))),Blk(List(App(Bra(false,Lam(Tup(List((None,Fld(_,Var(y))))),App(Var(f),Tup(List((None,Fld(_,App(Var(+),Tup(List((None,Fld(_,Var(x))), (None,Fld(_,Var(y))))))))))))),Tup(List((None,Fld(_,App(Var(+),Tup(List((None,Fld(_,Var(x))), (None,Fld(_,IntLit(1)))))))))))))))), App(Var(f),Tup(List((None,Fld(_,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(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)))))))) +//│ TypingUnit(List(NuFunDef(None,Var(f),None,List(),Left(Lam(Tup(List((None,Fld(_,Var(x))))),App(Var(f),Tup(List((None,Fld(_,Var(x))))))))), App(Var(f),Tup(List((None,Fld(_,IntLit(0)))))), App(Var(f),Tup(List((None,Fld(_,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(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))))))))))))) +//│ TypingUnit(List(NuTypeDef(Cls,TypeName(Cons),List(),Some(Tup(List((Some(Var(e)),Fld(_,Var('A))), (Some(Var(tail)),Fld(_,App(Var(|),Tup(List((None,Fld(_,Var(Cons))), (None,Fld(_,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(_,IntLit(1))), (None,Fld(_,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(_,Var(l))))),Blk(List(App(Sel(Var(l),Var(count)),Tup(List())))))))))), NuTypeDef(Cls,TypeName(Lambda2),List(),Some(Tup(List((Some(Var(a)),Fld(_,Var(Int)))))),None,None,List(),None,None,TypingUnit(List(NuFunDef(None,Var(apply),None,List(),Left(Lam(Tup(List((None,Fld(_,Var(l))))),Blk(List(App(Sel(Bra(false,App(NuNew(Var(Cons)),Tup(List((None,Fld(_,Var(a))), (None,Fld(_,Var(l))))))),Var(count)),Tup(List())))))))))), NuFunDef(None,Var(foo),None,List(),Left(Lam(Tup(List((None,Fld(_,Var(x))))),Blk(List(App(Var(+),Tup(List((None,Fld(_,App(Sel(Var(x),Var(apply)),Tup(List((None,Fld(_,App(NuNew(Var(Cons)),Tup(List((None,Fld(_,IntLit(1))), (None,Fld(_,App(NuNew(Var(Nil)),Tup(List())))))))))))))), (None,Fld(_,App(Sel(Var(x),Var(apply)),Tup(List((None,Fld(_,App(NuNew(Var(Nil)),Tup(List()))))))))))))))))), App(Var(foo),Tup(List((None,Fld(_,App(NuNew(Var(Lambda)),Tup(List()))))))), App(Var(foo),Tup(List((None,Fld(_,App(NuNew(Var(Lambda2)),Tup(List((None,Fld(_,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(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())))))))))) +//│ TypingUnit(List(NuTypeDef(Cls,TypeName(Cons),List(),Some(Tup(List((Some(Var(e)),Fld(_,Var(Int))), (Some(Var(tail)),Fld(_,App(Var(|),Tup(List((None,Fld(_,Var(Cons))), (None,Fld(_,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(_,IntLit(1))), (None,Fld(_,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(_,Var(x))))),Blk(List(App(Var(+),Tup(List((None,Fld(_,App(Var(x),Tup(List((None,Fld(_,App(NuNew(Var(Cons)),Tup(List((None,Fld(_,IntLit(1))), (None,Fld(_,App(NuNew(Var(Nil)),Tup(List())))))))))))))), (None,Fld(_,App(Var(x),Tup(List((None,Fld(_,App(NuNew(Var(Nil)),Tup(List()))))))))))))))))), App(Var(foo),Tup(List((None,Fld(_,Lam(Tup(List((None,Fld(_,Var(l))))),App(Sel(Var(l),Var(count)),Tup(List())))))))), App(Var(foo),Tup(List((None,Fld(_,Lam(Tup(List((None,Fld(_,Var(l))))),App(Sel(Bra(false,App(NuNew(Var(Cons)),Tup(List((None,Fld(_,IntLit(2))), (None,Fld(_,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(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())))) +//│ 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(_,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(_,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(_,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(_,Var(Int)))))),None,None,List(Var(Exp)),None,None,TypingUnit(List(NuFunDef(None,Var(derive),None,List(),Left(Lam(Tup(List((None,Fld(_,Var(x))))),Blk(List(If(IfThen(App(Var(==),Tup(List((None,Fld(_,Var(x))), (None,Fld(_,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(_,Var(Exp))), (Some(Var(e2)),Fld(_,Var(Exp)))))),None,None,List(Var(Exp)),None,None,TypingUnit(List(NuFunDef(None,Var(derive),None,List(),Left(Lam(Tup(List((None,Fld(_,Var(x))))),Blk(List(App(NuNew(Var(A)),Tup(List((None,Fld(_,App(Sel(Var(e1),Var(derive)),Tup(List((None,Fld(_,Var(x)))))))), (None,Fld(_,App(Sel(Var(e2),Var(derive)),Tup(List((None,Fld(_,Var(x)))))))))))))))), NuFunDef(None,Var(isEmpty),None,List(),Left(Lam(Tup(List()),Blk(List(App(Var(||),Tup(List((None,Fld(_,App(Sel(Var(e1),Var(isEmpty)),Tup(List())))), (None,Fld(_,App(Sel(Var(e2),Var(isEmpty)),Tup(List()))))))))))))))), NuTypeDef(Cls,TypeName(C),List(),Some(Tup(List((Some(Var(e1)),Fld(_,Var(Exp))), (Some(Var(e2)),Fld(_,Var(Exp)))))),None,None,List(Var(Exp)),None,None,TypingUnit(List(NuFunDef(None,Var(derive),None,List(),Left(Lam(Tup(List((None,Fld(_,Var(x))))),Blk(List(If(IfThen(App(Sel(Var(e1),Var(isEmpty)),Tup(List())),App(NuNew(Var(A)),Tup(List((None,Fld(_,App(NuNew(Var(C)),Tup(List((None,Fld(_,App(Sel(Var(e1),Var(derive)),Tup(List((None,Fld(_,Var(x)))))))), (None,Fld(_,Var(e2)))))))), (None,Fld(_,App(Sel(Var(e2),Var(derive)),Tup(List((None,Fld(_,Var(x)))))))))))),Some(App(NuNew(Var(C)),Tup(List((None,Fld(_,App(Sel(Var(e1),Var(derive)),Tup(List((None,Fld(_,Var(x)))))))), (None,Fld(_,Var(e2))))))))))))), NuFunDef(None,Var(isEmpty),None,List(),Left(Lam(Tup(List()),Blk(List(App(Var(&&),Tup(List((None,Fld(_,App(Sel(Var(e1),Var(isEmpty)),Tup(List())))), (None,Fld(_,App(Sel(Var(e2),Var(isEmpty)),Tup(List()))))))))))))))), App(Sel(App(Sel(Bra(false,App(NuNew(Var(C)),Tup(List((None,Fld(_,App(NuNew(Var(Ch)),Tup(List((None,Fld(_,IntLit(1)))))))), (None,Fld(_,App(NuNew(Var(A)),Tup(List((None,Fld(_,App(NuNew(Var(Ch)),Tup(List((None,Fld(_,IntLit(2)))))))), (None,Fld(_,App(NuNew(Var(Ch)),Tup(List((None,Fld(_,IntLit(3))))))))))))))))),Var(derive)),Tup(List((None,Fld(_,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(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())))) +//│ TypingUnit(List(NuFunDef(Some(false),Var(anyUnknown),None,List(),Left(Var(false))), NuTypeDef(Cls,TypeName(List),List(),Some(Tup(List((Some(Var(l)),Fld(_,App(Var(|),Tup(List((None,Fld(_,Var(List))), (None,Fld(_,Var(Nil)))))))), (Some(Var(hasTail)),Fld(_,Var(Bool)))))),None,None,List(),None,None,TypingUnit(List())), NuTypeDef(Cls,TypeName(Nil),List(),Some(Tup(List((Some(Var(hasTail)),Fld(_,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(_,App(Var(gen),Tup(List())))), (None,Fld(_,Var(true))))))),Some(App(NuNew(Var(Nil)),Tup(List((None,Fld(_,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(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)))))))) +//│ TypingUnit(List(NuTypeDef(Cls,TypeName(Foo),List(),Some(Tup(List((Some(Var(x)),Fld(_,Var(Int)))))),None,None,List(),None,None,TypingUnit(List(NuFunDef(None,Var(bar),None,List(),Left(Lam(Tup(List((None,Fld(_,Var(y))))),App(Var(+),Tup(List((None,Fld(_,Var(x))), (None,Fld(_,Var(y))))))))), NuFunDef(None,Var(boo),None,List(),Left(Lam(Tup(List((None,Fld(_,Var(z))))),App(Var(+),Tup(List((None,Fld(_,App(Var(bar),Tup(List((None,Fld(_,Var(z)))))))), (None,Fld(_,Var(x)))))))))))), App(Sel(Bra(false,App(NuNew(Var(Foo)),Tup(List((None,Fld(_,IntLit(1))))))),Var(boo)),Tup(List((None,Fld(_,IntLit(2)))))))) //│ Lifted: //│ TypingUnit { //│ class Foo$1([x: Int,]) { @@ -888,7 +888,7 @@ class OneInt(a: Int){ } (new OneInt(10)).fac() //│ Parsed: -//│ 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())))) +//│ TypingUnit(List(NuTypeDef(Cls,TypeName(OneInt),List(),Some(Tup(List((Some(Var(a)),Fld(_,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(_,Var(a))), (None,Fld(_,IntLit(0))))))),App(Sel(Bra(false,App(NuNew(Var(OneInt)),Tup(List((None,Fld(_,App(Var(-),Tup(List((None,Fld(_,Var(a))), (None,Fld(_,IntLit(1)))))))))))),Var(fac)),Tup(List()))),Some(IntLit(1))))))))))), App(Sel(Bra(false,App(NuNew(Var(OneInt)),Tup(List((None,Fld(_,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(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)))))))) +//│ TypingUnit(List(NuFunDef(Some(false),Var(any),None,List(),Left(IntLit(-20))), NuFunDef(None,Var(f),None,List(),Left(Lam(Tup(List((None,Fld(_,Var(x))))),Blk(List(If(IfThen(App(Var(>),Tup(List((None,Fld(_,Var(x))), (None,Fld(_,Var(any)))))),IntLit(0)),Some(App(Var(g),Tup(List((None,Fld(_,App(Var(-),Tup(List((None,Fld(_,Var(x))), (None,Fld(_,IntLit(1)))))))))))))))))), NuFunDef(None,Var(g),None,List(),Left(Lam(Tup(List((None,Fld(_,Var(x))))),Blk(List(If(IfThen(App(Var(>),Tup(List((None,Fld(_,Var(x))), (None,Fld(_,Var(any)))))),App(Var(g),Tup(List((None,Fld(_,App(Var(-),Tup(List((None,Fld(_,Var(x))), (None,Fld(_,IntLit(1)))))))))))),Some(App(Var(f),Tup(List((None,Fld(_,App(Var(-),Tup(List((None,Fld(_,Var(x))), (None,Fld(_,IntLit(2)))))))))))))))))), App(Var(g),Tup(List((None,Fld(_,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(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())))) +//│ TypingUnit(List(NuTypeDef(Cls,TypeName(OneInt),List(),Some(Tup(List((Some(Var(a)),Fld(_,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(_,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(_,IntLit(1))))))),Some(App(NuNew(Var(OneBool)),Tup(List((None,Fld(_,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(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)))) +//│ TypingUnit(List(NuTypeDef(Cls,TypeName(Bar),List(),Some(Tup(List((Some(Var(x)),Fld(_,Var(Int)))))),None,None,List(),None,None,TypingUnit(List(NuFunDef(None,Var(foo),None,List(),Left(Lam(Tup(List((None,Fld(_,Var(x))))),Var(x)))), NuFunDef(None,Var(FooMinus),None,List(),Left(Lam(Tup(List((Some(Var(y)),Fld(_,Var(Int))))),App(Var(+),Tup(List((None,Fld(_,Var(x))), (None,Fld(_,Var(y))))))))), NuFunDef(None,Var(car),None,List(),Left(App(Var(foo),Tup(List((None,Fld(_,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(_,Var(Bar))))),App(Sel(Var(b),Var(foo)),Tup(List((None,Fld(_,IntLit(2)))))))))))), NuFunDef(None,Var(baz),None,List(),Left(Lam(Tup(List((Some(Var(b)),Fld(_,Var(Bar))))),App(Sel(Var(b),Var(foo)),Tup(List((None,Fld(_,IntLit(2))))))))), NuFunDef(Some(false),Var(bar),None,List(),Left(App(Var(Bar),Tup(List((None,Fld(_,IntLit(42)))))))), App(Var(baz),Tup(List((None,Fld(_,Var(bar)))))), App(Sel(Bra(false,App(NuNew(Var(Car)),Tup(List()))),Var(da)),Tup(List((None,Fld(_,App(Var(Bar),Tup(List((None,Fld(_,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(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())))) +//│ TypingUnit(List(NuFunDef(Some(false),Var(c),None,List(),Left(IntLit(5))), NuTypeDef(Cls,TypeName(Sup),List(),Some(Tup(List((Some(Var(a)),Fld(_,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(_,Var(Int)))))),None,None,List(App(Var(Sup),Tup(List((None,Fld(_,App(Var(+),Tup(List((None,Fld(_,Var(b))), (None,Fld(_,Var(b)))))))))))),None,None,TypingUnit(List())), NuTypeDef(Cls,TypeName(Sub2),List(),Some(Tup(List((Some(Var(c)),Fld(_,Var(Int)))))),None,None,List(App(Var(Sub),Tup(List((None,Fld(_,App(Var(+),Tup(List((None,Fld(_,Var(c))), (None,Fld(_,Var(c)))))))))))),None,None,TypingUnit(List(NuFunDef(None,Var(foo),None,List(),Left(Lam(Tup(List()),App(Var(+),Tup(List((None,Fld(_,Var(a))), (None,Fld(_,Var(c)))))))))))), App(Sel(Bra(false,App(NuNew(Var(Sub)),Tup(List((None,Fld(_,IntLit(10))))))),Var(foo)),Tup(List())), App(Sel(Bra(false,App(NuNew(Var(Sub2)),Tup(List((None,Fld(_,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(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())))) +//│ TypingUnit(List(NuTypeDef(Cls,TypeName(Foo),List(),Some(Tup(List((Some(Var(f)),Fld(_,App(Var(->),Tup(List((None,Fld(_,Var(Int))), (None,Fld(_,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(_,IntLit(1)))))))))))), NuTypeDef(Cls,TypeName(F1),List(),Some(Tup(List())),None,None,List(App(Var(Foo),Tup(List((None,Fld(_,Lam(Tup(List((None,Fld(_,Var(x))))),App(Var(+),Tup(List((None,Fld(_,Var(x))), (None,Fld(_,IntLit(1))))))))))))),None,None,TypingUnit(List())), NuTypeDef(Cls,TypeName(F2),List(),Some(Tup(List())),None,None,List(App(Var(Foo),Tup(List((None,Fld(_,Lam(Tup(List((None,Fld(_,Var(x))))),App(Var(+),Tup(List((None,Fld(_,Var(x))), (None,Fld(_,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,)} diff --git a/shared/src/main/scala/mlscript/helpers.scala b/shared/src/main/scala/mlscript/helpers.scala index 63de7f026..57b2a5aea 100644 --- a/shared/src/main/scala/mlscript/helpers.scala +++ b/shared/src/main/scala/mlscript/helpers.scala @@ -504,6 +504,15 @@ trait TypeNameImpl extends Ordered[TypeName] { self: TypeName => lazy val toVar: Var = Var(name).withLocOf(this) } +trait FldFlagsImpl extends Located { self: FldFlags => + def children: Ls[Located] = Nil + override def toString(): String = { + val FldFlags(m, s, g) = this + val res = (if (m) "m" else "") + (if (s) "s" else "") + (if (g) "g" else "") + if (res.isEmpty) "_" else res + } +} + trait FldImpl extends Located { self: Fld => def children: Ls[Located] = self.value :: Nil def describe: Str = diff --git a/shared/src/main/scala/mlscript/syntax.scala b/shared/src/main/scala/mlscript/syntax.scala index e899ff582..d3d3b05c4 100644 --- a/shared/src/main/scala/mlscript/syntax.scala +++ b/shared/src/main/scala/mlscript/syntax.scala @@ -104,7 +104,7 @@ final case class IfOpsApp(lhs: Term, opsRhss: Ls[Var -> IfBody]) extends IfBody final case class IfBlock(lines: Ls[IfBody \/ Statement]) extends IfBody // final case class IfApp(fun: Term, opsRhss: Ls[Var -> IfBody]) extends IfBody -final case class FldFlags(mut: Bool, spec: Bool, genGetter: Bool) +final case class FldFlags(mut: Bool, spec: Bool, genGetter: Bool) extends FldFlagsImpl final case class Fld(flags: FldFlags, value: Term) extends FldImpl object FldFlags { val empty: FldFlags = FldFlags(false, false, false) } diff --git a/shared/src/test/diff/mlscript/Basics.mls b/shared/src/test/diff/mlscript/Basics.mls index b93076134..7ecdfea0f 100644 --- a/shared/src/test/diff/mlscript/Basics.mls +++ b/shared/src/test/diff/mlscript/Basics.mls @@ -96,7 +96,7 @@ def f (x y z) = add x y //│ ╙── ^^^^^ //│ f: error -> int //│ Code generation encountered an error: -//│ term App(App(Var(x),Tup(List((None,Fld(FldFlags(false,false,false),Var(y)))))),Tup(List((None,Fld(FldFlags(false,false,false),Var(z)))))) is not a valid pattern +//│ term App(App(Var(x),Tup(List((None,Fld(_,Var(y)))))),Tup(List((None,Fld(_,Var(z)))))) is not a valid pattern f 1 //│ res: int diff --git a/shared/src/test/diff/mlscript/ByNameByValue.mls b/shared/src/test/diff/mlscript/ByNameByValue.mls index ddef8f3d9..a9b9b9b18 100644 --- a/shared/src/test/diff/mlscript/ByNameByValue.mls +++ b/shared/src/test/diff/mlscript/ByNameByValue.mls @@ -16,7 +16,7 @@ def incr x = x.a <- x.a + 1 def gensym = let n = { mut a = 0 } in fun () -> (incr n, n) //│ Parsed: def gensym: let n = {mut a: 0} in () => [incr(n,), n,]; //│ Desugared: def gensym: let n = {mut a: 0} in () => [incr(n,), n,] -//│ AST: Def(false,Var(gensym),Left(Let(false,Var(n),Rcd(List((Var(a),Fld(FldFlags(true,false,false),IntLit(0))))),Lam(Tup(List()),Tup(List((None,Fld(FldFlags(false,false,false),App(Var(incr),Tup(List((None,Fld(FldFlags(false,false,false),Var(n)))))))), (None,Fld(FldFlags(false,false,false),Var(n)))))))),true) +//│ AST: Def(false,Var(gensym),Left(Let(false,Var(n),Rcd(List((Var(a),Fld(m,IntLit(0))))),Lam(Tup(List()),Tup(List((None,Fld(_,App(Var(incr),Tup(List((None,Fld(_,Var(n)))))))), (None,Fld(_,Var(n)))))))),true) //│ // Query 1 //│ globalThis.gensym = function gensym() { //│ return (((n) => () => [ @@ -35,7 +35,7 @@ def gensym = let n = { mut a = 0 } in fun () -> (incr n, n) gensym1 = let n = { mut a = 0 } in fun () -> (incr n, n) //│ Parsed: let gensym1 = let n = {mut a: 0} in () => [incr(n,), n,]; //│ Desugared: def gensym1: let n = {mut a: 0} in () => [incr(n,), n,] -//│ AST: Def(false,Var(gensym1),Left(Let(false,Var(n),Rcd(List((Var(a),Fld(FldFlags(true,false,false),IntLit(0))))),Lam(Tup(List()),Tup(List((None,Fld(FldFlags(false,false,false),App(Var(incr),Tup(List((None,Fld(FldFlags(false,false,false),Var(n)))))))), (None,Fld(FldFlags(false,false,false),Var(n)))))))),false) +//│ AST: Def(false,Var(gensym1),Left(Let(false,Var(n),Rcd(List((Var(a),Fld(m,IntLit(0))))),Lam(Tup(List()),Tup(List((None,Fld(_,App(Var(incr),Tup(List((None,Fld(_,Var(n)))))))), (None,Fld(_,Var(n)))))))),false) //│ // Query 1 //│ globalThis.gensym1 = ((n) => () => [ //│ incr(n), diff --git a/shared/src/test/diff/mlscript/MultiArgs.mls b/shared/src/test/diff/mlscript/MultiArgs.mls index 996bc44af..9f04e7f15 100644 --- a/shared/src/test/diff/mlscript/MultiArgs.mls +++ b/shared/src/test/diff/mlscript/MultiArgs.mls @@ -75,9 +75,9 @@ f = fun (x, y) -> add x y f(1, 2) //│ Parsed: let f = (x, y,) => add(x,)(y,); f(1, 2,); //│ Desugared: def f: (x, y,) => add(x,)(y,) -//│ AST: Def(false,Var(f),Left(Lam(Tup(List((None,Fld(FldFlags(false,false,false),Var(x))), (None,Fld(FldFlags(false,false,false),Var(y))))),App(App(Var(add),Tup(List((None,Fld(FldFlags(false,false,false),Var(x)))))),Tup(List((None,Fld(FldFlags(false,false,false),Var(y)))))))),false) +//│ AST: Def(false,Var(f),Left(Lam(Tup(List((None,Fld(_,Var(x))), (None,Fld(_,Var(y))))),App(App(Var(add),Tup(List((None,Fld(_,Var(x)))))),Tup(List((None,Fld(_,Var(y)))))))),false) //│ Desugared: f(1, 2,) -//│ AST: App(Var(f),Tup(List((None,Fld(FldFlags(false,false,false),IntLit(1))), (None,Fld(FldFlags(false,false,false),IntLit(2)))))) +//│ AST: App(Var(f),Tup(List((None,Fld(_,IntLit(1))), (None,Fld(_,IntLit(2)))))) //│ f: (int, int,) -> int //│ = [Function: f] //│ res: int @@ -119,9 +119,9 @@ f = fun ((x, y)) -> add x y f((1, 2)) //│ Parsed: let f = ('(' [x, y,] ')',) => add(x,)(y,); f('(' [1, 2,] ')',); //│ Desugared: def f: ('(' [x, y,] ')',) => add(x,)(y,) -//│ AST: Def(false,Var(f),Left(Lam(Tup(List((None,Fld(FldFlags(false,false,false),Bra(false,Tup(List((None,Fld(FldFlags(false,false,false),Var(x))), (None,Fld(FldFlags(false,false,false),Var(y)))))))))),App(App(Var(add),Tup(List((None,Fld(FldFlags(false,false,false),Var(x)))))),Tup(List((None,Fld(FldFlags(false,false,false),Var(y)))))))),false) +//│ AST: Def(false,Var(f),Left(Lam(Tup(List((None,Fld(_,Bra(false,Tup(List((None,Fld(_,Var(x))), (None,Fld(_,Var(y)))))))))),App(App(Var(add),Tup(List((None,Fld(_,Var(x)))))),Tup(List((None,Fld(_,Var(y)))))))),false) //│ Desugared: f('(' [1, 2,] ')',) -//│ AST: App(Var(f),Tup(List((None,Fld(FldFlags(false,false,false),Bra(false,Tup(List((None,Fld(FldFlags(false,false,false),IntLit(1))), (None,Fld(FldFlags(false,false,false),IntLit(2))))))))))) +//│ AST: App(Var(f),Tup(List((None,Fld(_,Bra(false,Tup(List((None,Fld(_,IntLit(1))), (None,Fld(_,IntLit(2))))))))))) //│ f: ((int, int,),) -> int //│ = [Function: f1] //│ res: int diff --git a/shared/src/test/diff/mlscript/Ops.mls b/shared/src/test/diff/mlscript/Ops.mls index 6dbb47205..fb99294cf 100644 --- a/shared/src/test/diff/mlscript/Ops.mls +++ b/shared/src/test/diff/mlscript/Ops.mls @@ -3,7 +3,7 @@ 2 + 2 //│ Parsed: +(2,)(2,); //│ Desugared: +(2,)(2,) -//│ AST: App(App(Var(+),Tup(List((None,Fld(FldFlags(false,false,false),IntLit(2)))))),Tup(List((None,Fld(FldFlags(false,false,false),IntLit(2)))))) +//│ AST: App(App(Var(+),Tup(List((None,Fld(_,IntLit(2)))))),Tup(List((None,Fld(_,IntLit(2)))))) //│ res: int //│ = 4 @@ -11,7 +11,7 @@ 1 + 2 * 2 + 3 //│ Parsed: +(+(1,)(*(2,)(2,),),)(3,); //│ Desugared: +(+(1,)(*(2,)(2,),),)(3,) -//│ AST: App(App(Var(+),Tup(List((None,Fld(FldFlags(false,false,false),App(App(Var(+),Tup(List((None,Fld(FldFlags(false,false,false),IntLit(1)))))),Tup(List((None,Fld(FldFlags(false,false,false),App(App(Var(*),Tup(List((None,Fld(FldFlags(false,false,false),IntLit(2)))))),Tup(List((None,Fld(FldFlags(false,false,false),IntLit(2)))))))))))))))),Tup(List((None,Fld(FldFlags(false,false,false),IntLit(3)))))) +//│ AST: App(App(Var(+),Tup(List((None,Fld(_,App(App(Var(+),Tup(List((None,Fld(_,IntLit(1)))))),Tup(List((None,Fld(_,App(App(Var(*),Tup(List((None,Fld(_,IntLit(2)))))),Tup(List((None,Fld(_,IntLit(2)))))))))))))))),Tup(List((None,Fld(_,IntLit(3)))))) //│ res: int //│ = 8 @@ -20,7 +20,7 @@ 1 + 2 / 2 + 3 //│ Parsed: +(+(1,)(/(2,)(2,),),)(3,); //│ Desugared: +(+(1,)(/(2,)(2,),),)(3,) -//│ AST: App(App(Var(+),Tup(List((None,Fld(FldFlags(false,false,false),App(App(Var(+),Tup(List((None,Fld(FldFlags(false,false,false),IntLit(1)))))),Tup(List((None,Fld(FldFlags(false,false,false),App(App(Var(/),Tup(List((None,Fld(FldFlags(false,false,false),IntLit(2)))))),Tup(List((None,Fld(FldFlags(false,false,false),IntLit(2)))))))))))))))),Tup(List((None,Fld(FldFlags(false,false,false),IntLit(3)))))) +//│ AST: App(App(Var(+),Tup(List((None,Fld(_,App(App(Var(+),Tup(List((None,Fld(_,IntLit(1)))))),Tup(List((None,Fld(_,App(App(Var(/),Tup(List((None,Fld(_,IntLit(2)))))),Tup(List((None,Fld(_,IntLit(2)))))))))))))))),Tup(List((None,Fld(_,IntLit(3)))))) //│ ╔══[ERROR] Type mismatch in operator application: //│ ║ l.20: 1 + 2 / 2 + 3 //│ ║ ^^^^^^^^^ @@ -36,7 +36,7 @@ 1 |> 2 || 3 //│ Parsed: ||(|>(1,)(2,),)(3,); //│ Desugared: ||(|>(1,)(2,),)(3,) -//│ AST: App(App(Var(||),Tup(List((None,Fld(FldFlags(false,false,false),App(App(Var(|>),Tup(List((None,Fld(FldFlags(false,false,false),IntLit(1)))))),Tup(List((None,Fld(FldFlags(false,false,false),IntLit(2))))))))))),Tup(List((None,Fld(FldFlags(false,false,false),IntLit(3)))))) +//│ AST: App(App(Var(||),Tup(List((None,Fld(_,App(App(Var(|>),Tup(List((None,Fld(_,IntLit(1)))))),Tup(List((None,Fld(_,IntLit(2))))))))))),Tup(List((None,Fld(_,IntLit(3)))))) //│ ╔══[ERROR] identifier not found: |> //│ ║ l.36: 1 |> 2 || 3 //│ ╙── ^^ @@ -54,7 +54,7 @@ true || false && true || false //│ Parsed: ||(||(true,)(&&(false,)(true,),),)(false,); //│ Desugared: ||(||(true,)(&&(false,)(true,),),)(false,) -//│ AST: App(App(Var(||),Tup(List((None,Fld(FldFlags(false,false,false),App(App(Var(||),Tup(List((None,Fld(FldFlags(false,false,false),Var(true)))))),Tup(List((None,Fld(FldFlags(false,false,false),App(App(Var(&&),Tup(List((None,Fld(FldFlags(false,false,false),Var(false)))))),Tup(List((None,Fld(FldFlags(false,false,false),Var(true)))))))))))))))),Tup(List((None,Fld(FldFlags(false,false,false),Var(false)))))) +//│ AST: App(App(Var(||),Tup(List((None,Fld(_,App(App(Var(||),Tup(List((None,Fld(_,Var(true)))))),Tup(List((None,Fld(_,App(App(Var(&&),Tup(List((None,Fld(_,Var(false)))))),Tup(List((None,Fld(_,Var(true)))))))))))))))),Tup(List((None,Fld(_,Var(false)))))) //│ res: bool //│ = true diff --git a/shared/src/test/diff/nu/AbstractClasses.mls b/shared/src/test/diff/nu/AbstractClasses.mls index 96dcb79c9..540f361d7 100644 --- a/shared/src/test/diff/nu/AbstractClasses.mls +++ b/shared/src/test/diff/nu/AbstractClasses.mls @@ -51,7 +51,7 @@ new Foo(1) { fun f = id } //│ ╙── ^^^^^^^^^^^^^^^^^^^^^^^^^ //│ error //│ Code generation encountered an error: -//│ cannot generate code for term Rft(App(NuNew(Var(Foo)),Tup(List((None,Fld(FldFlags(false,false,false),IntLit(1)))))),TypingUnit(List(NuFunDef(None,Var(f),None,List(),Left(Var(id)))))) +//│ cannot generate code for term Rft(App(NuNew(Var(Foo)),Tup(List((None,Fld(_,IntLit(1)))))),TypingUnit(List(NuFunDef(None,Var(f),None,List(),Left(Var(id)))))) abstract class Bar extends Foo(1) diff --git a/shared/src/test/diff/nu/BadBlocks.mls b/shared/src/test/diff/nu/BadBlocks.mls index 2e9898637..b76b35c08 100644 --- a/shared/src/test/diff/nu/BadBlocks.mls +++ b/shared/src/test/diff/nu/BadBlocks.mls @@ -176,5 +176,5 @@ fun test = (new { //│ ╙── ^ //│ fun test: error //│ Code generation encountered an error: -//│ Unsupported `new` class term: Bra(true,Rcd(List((Var(res),Fld(FldFlags(false,false,true),Var(res)))))) +//│ Unsupported `new` class term: Bra(true,Rcd(List((Var(res),Fld(g,Var(res)))))) diff --git a/shared/src/test/diff/nu/LamPatterns.mls b/shared/src/test/diff/nu/LamPatterns.mls index 0b4537909..7458108e6 100644 --- a/shared/src/test/diff/nu/LamPatterns.mls +++ b/shared/src/test/diff/nu/LamPatterns.mls @@ -14,7 +14,7 @@ Some(x) => x //│ ╙── ^ //│ error -> error //│ Code generation encountered an error: -//│ term App(Var(Some),Tup(List((None,Fld(FldFlags(false,false,false),Var(x)))))) is not a valid pattern +//│ term App(Var(Some),Tup(List((None,Fld(_,Var(x)))))) is not a valid pattern :js // FIXME type diff --git a/shared/src/test/diff/nu/OverrideShorthand.mls b/shared/src/test/diff/nu/OverrideShorthand.mls index 5f3392d15..2bd823530 100644 --- a/shared/src/test/diff/nu/OverrideShorthand.mls +++ b/shared/src/test/diff/nu/OverrideShorthand.mls @@ -10,7 +10,7 @@ class Pair(lhs: Int, rhs: Int) :e fun f(override Pair(x, y)) = x + y //│ |#fun| |f|(|#override| |Pair|(|x|,| |y|)|)| |#=| |x| |+| |y| -//│ AST: TypingUnit(List(NuFunDef(None,Var(f),None,List(),Left(Lam(Tup(List((None,Fld(FldFlags(false,false,false),Var(_$0))))),If(IfOpApp(Var(_$0),Var(is),IfThen(App(Var(Pair),Tup(List((None,Fld(FldFlags(false,false,false),Var(x))), (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)))))))),Some(App(Sel(Super(),Var(f)),Tup(List((None,Fld(FldFlags(false,false,false),Var(_$0))))))))))))) +//│ AST: TypingUnit(List(NuFunDef(None,Var(f),None,List(),Left(Lam(Tup(List((None,Fld(_,Var(_$0))))),If(IfOpApp(Var(_$0),Var(is),IfThen(App(Var(Pair),Tup(List((None,Fld(_,Var(x))), (None,Fld(_,Var(y)))))),App(Var(+),Tup(List((None,Fld(_,Var(x))), (None,Fld(_,Var(y)))))))),Some(App(Sel(Super(),Var(f)),Tup(List((None,Fld(_,Var(_$0))))))))))))) //│ Parsed: fun f = (_$0,) => if _$0 is (Pair(x, y,)) then +(x, y,) else (super).f(_$0,); //│ ╔══[ERROR] identifier not found: super //│ ║ l.11: fun f(override Pair(x, y)) = x + y @@ -46,7 +46,7 @@ fun f(override Pair(x, y), z) = x + y //│ ╙── ^ //│ fun f: (error, anything) -> Int //│ Code generation encountered an error: -//│ term App(Var(Pair),Tup(List((None,Fld(FldFlags(false,false,false),Var(x))), (None,Fld(FldFlags(false,false,false),Var(y)))))) is not a valid pattern +//│ term App(Var(Pair),Tup(List((None,Fld(_,Var(x))), (None,Fld(_,Var(y)))))) is not a valid pattern // TODO diff --git a/shared/src/test/diff/nu/RightAssocOps.mls b/shared/src/test/diff/nu/RightAssocOps.mls index f6738db61..b692e7fb0 100644 --- a/shared/src/test/diff/nu/RightAssocOps.mls +++ b/shared/src/test/diff/nu/RightAssocOps.mls @@ -30,7 +30,7 @@ fun (++) conc(xs, ys) = [xs, ys] :p 1 +: "a" ++ "b" :+ 2 //│ |1| |+:| |"a"| |++| |"b"| |:+| |2| -//│ AST: TypingUnit(List(App(Var(+:),Tup(List((None,Fld(FldFlags(false,false,false),IntLit(1))), (None,Fld(FldFlags(false,false,false),App(Var(:+),Tup(List((None,Fld(FldFlags(false,false,false),App(Var(++),Tup(List((None,Fld(FldFlags(false,false,false),StrLit(a))), (None,Fld(FldFlags(false,false,false),StrLit(b)))))))), (None,Fld(FldFlags(false,false,false),IntLit(2))))))))))))) +//│ AST: TypingUnit(List(App(Var(+:),Tup(List((None,Fld(_,IntLit(1))), (None,Fld(_,App(Var(:+),Tup(List((None,Fld(_,App(Var(++),Tup(List((None,Fld(_,StrLit(a))), (None,Fld(_,StrLit(b)))))))), (None,Fld(_,IntLit(2))))))))))))) //│ Parsed: +:(1, :+(++("a", "b",), 2,),); //│ [[Int], [["a", "b"], [Int]]] //│ res @@ -39,7 +39,7 @@ fun (++) conc(xs, ys) = [xs, ys] :p 1 +: "a" :+ 2 ++ "b" //│ |1| |+:| |"a"| |:+| |2| |++| |"b"| -//│ AST: TypingUnit(List(App(Var(+:),Tup(List((None,Fld(FldFlags(false,false,false),IntLit(1))), (None,Fld(FldFlags(false,false,false),App(Var(++),Tup(List((None,Fld(FldFlags(false,false,false),App(Var(:+),Tup(List((None,Fld(FldFlags(false,false,false),StrLit(a))), (None,Fld(FldFlags(false,false,false),IntLit(2)))))))), (None,Fld(FldFlags(false,false,false),StrLit(b))))))))))))) +//│ AST: TypingUnit(List(App(Var(+:),Tup(List((None,Fld(_,IntLit(1))), (None,Fld(_,App(Var(++),Tup(List((None,Fld(_,App(Var(:+),Tup(List((None,Fld(_,StrLit(a))), (None,Fld(_,IntLit(2)))))))), (None,Fld(_,StrLit(b))))))))))))) //│ Parsed: +:(1, ++(:+("a", 2,), "b",),); //│ [[Int], [["a", [Int]], "b"]] //│ res @@ -49,7 +49,7 @@ fun (++) conc(xs, ys) = [xs, ys] :e 1 +: "a" ++ 2 +: "b" //│ |1| |+:| |"a"| |++| |2| |+:| |"b"| -//│ AST: TypingUnit(List(App(Var(+:),Tup(List((None,Fld(FldFlags(false,false,false),IntLit(1))), (None,Fld(FldFlags(false,false,false),App(Var(+:),Tup(List((None,Fld(FldFlags(false,false,false),App(Var(++),Tup(List((None,Fld(FldFlags(false,false,false),StrLit(a))), (None,Fld(FldFlags(false,false,false),IntLit(2)))))))), (None,Fld(FldFlags(false,false,false),StrLit(b))))))))))))) +//│ AST: TypingUnit(List(App(Var(+:),Tup(List((None,Fld(_,IntLit(1))), (None,Fld(_,App(Var(+:),Tup(List((None,Fld(_,App(Var(++),Tup(List((None,Fld(_,StrLit(a))), (None,Fld(_,IntLit(2)))))))), (None,Fld(_,StrLit(b))))))))))))) //│ Parsed: +:(1, +:(++("a", 2,), "b",),); //│ ╔══[ERROR] Type mismatch in operator application: //│ ║ l.50: 1 +: "a" ++ 2 +: "b" diff --git a/shared/src/test/diff/ucs/LeadingAnd.mls b/shared/src/test/diff/ucs/LeadingAnd.mls index bb6ac93e0..2303e4ebb 100644 --- a/shared/src/test/diff/ucs/LeadingAnd.mls +++ b/shared/src/test/diff/ucs/LeadingAnd.mls @@ -23,7 +23,7 @@ fun f(a, b) = if a is Some(av) and b is Some(bv) then av + bv //│ |#fun| |f|(|a|,| |b|)| |#=| |#if| |a| |is| |Some|(|av|)|→|and| |b| |is| |Some|(|bv|)|↵|#then| |av| |+| |bv|←| -//│ AST: TypingUnit(List(NuFunDef(None,Var(f),None,List(),Left(Lam(Tup(List((None,Fld(FldFlags(false,false,false),Var(a))), (None,Fld(FldFlags(false,false,false),Var(b))))),If(IfOpApp(Var(a),Var(is),IfOpsApp(App(Var(Some),Tup(List((None,Fld(FldFlags(false,false,false),Var(av)))))),List((Var(and),IfThen(App(Var(is),Tup(List((None,Fld(FldFlags(false,false,false),Var(b))), (None,Fld(FldFlags(false,false,false),App(Var(Some),Tup(List((None,Fld(FldFlags(false,false,false),Var(bv))))))))))),App(Var(+),Tup(List((None,Fld(FldFlags(false,false,false),Var(av))), (None,Fld(FldFlags(false,false,false),Var(bv))))))))))),None)))))) +//│ AST: TypingUnit(List(NuFunDef(None,Var(f),None,List(),Left(Lam(Tup(List((None,Fld(_,Var(a))), (None,Fld(_,Var(b))))),If(IfOpApp(Var(a),Var(is),IfOpsApp(App(Var(Some),Tup(List((None,Fld(_,Var(av)))))),List((Var(and),IfThen(App(Var(is),Tup(List((None,Fld(_,Var(b))), (None,Fld(_,App(Var(Some),Tup(List((None,Fld(_,Var(bv))))))))))),App(Var(+),Tup(List((None,Fld(_,Var(av))), (None,Fld(_,Var(bv))))))))))),None)))))) //│ Parsed: fun f = (a, b,) => if a is Some(av,) ‹· and (is(b, Some(bv,),)) then +(av, bv,)›; //│ fun f: (Some[Int], Some[Int]) -> Int @@ -34,7 +34,7 @@ fun f(a, b) = if a is and b is Some(bv) then av + bv //│ |#fun| |f|(|a|,| |b|)| |#=| |#if| |a| |is|→|Some|(|av|)|→|and| |b| |is| |Some|(|bv|)|↵|#then| |av| |+| |bv|←|←| -//│ AST: TypingUnit(List(NuFunDef(None,Var(f),None,List(),Left(Lam(Tup(List((None,Fld(FldFlags(false,false,false),Var(a))), (None,Fld(FldFlags(false,false,false),Var(b))))),If(IfOpApp(Var(a),Var(is),IfBlock(List(Left(IfOpsApp(App(Var(Some),Tup(List((None,Fld(FldFlags(false,false,false),Var(av)))))),List((Var(and),IfThen(App(Var(is),Tup(List((None,Fld(FldFlags(false,false,false),Var(b))), (None,Fld(FldFlags(false,false,false),App(Var(Some),Tup(List((None,Fld(FldFlags(false,false,false),Var(bv))))))))))),App(Var(+),Tup(List((None,Fld(FldFlags(false,false,false),Var(av))), (None,Fld(FldFlags(false,false,false),Var(bv)))))))))))))),None)))))) +//│ AST: TypingUnit(List(NuFunDef(None,Var(f),None,List(),Left(Lam(Tup(List((None,Fld(_,Var(a))), (None,Fld(_,Var(b))))),If(IfOpApp(Var(a),Var(is),IfBlock(List(Left(IfOpsApp(App(Var(Some),Tup(List((None,Fld(_,Var(av)))))),List((Var(and),IfThen(App(Var(is),Tup(List((None,Fld(_,Var(b))), (None,Fld(_,App(Var(Some),Tup(List((None,Fld(_,Var(bv))))))))))),App(Var(+),Tup(List((None,Fld(_,Var(av))), (None,Fld(_,Var(bv)))))))))))))),None)))))) //│ Parsed: fun f = (a, b,) => if a is ‹Some(av,) ‹· and (is(b, Some(bv,),)) then +(av, bv,)››; //│ ╔══[ERROR] Illegal pattern `and` //│ ║ l.34: and b is Some(bv) diff --git a/shared/src/test/diff/ucs/SplitOps.mls b/shared/src/test/diff/ucs/SplitOps.mls index 6a88e2d49..c966e4b0a 100644 --- a/shared/src/test/diff/ucs/SplitOps.mls +++ b/shared/src/test/diff/ucs/SplitOps.mls @@ -93,10 +93,10 @@ fun f(a, b, c) = if a == 0 and b is B() and c is C() then 0 //│ |#fun| |f|(|a|,| |b|,| |c|)| |#=|→|#if| |a|→|==| |0| |and| |b| |is| |B|(||)| |and| |c| |is| |C|(||)| |#then| |0|←|←| -//│ AST: TypingUnit(List(NuFunDef(None,Var(f),None,List(),Left(Lam(Tup(List((None,Fld(FldFlags(false,false,false),Var(a))), (None,Fld(FldFlags(false,false,false),Var(b))), (None,Fld(FldFlags(false,false,false),Var(c))))),Blk(List(If(IfOpsApp(Var(a),List((Var(==),IfThen(App(App(Var(and),Tup(List((None,Fld(FldFlags(false,false,false),App(App(Var(and),Tup(List((None,Fld(FldFlags(false,false,false),IntLit(0)))))),Tup(List((None,Fld(FldFlags(false,false,false),App(App(Var(is),Tup(List((None,Fld(FldFlags(false,false,false),Var(b)))))),Tup(List((None,Fld(FldFlags(false,false,false),App(Var(B),Tup(List()))))))))))))))))),Tup(List((None,Fld(FldFlags(false,false,false),App(App(Var(is),Tup(List((None,Fld(FldFlags(false,false,false),Var(c)))))),Tup(List((None,Fld(FldFlags(false,false,false),App(Var(C),Tup(List())))))))))))),IntLit(0))))),None)))))))) +//│ AST: TypingUnit(List(NuFunDef(None,Var(f),None,List(),Left(Lam(Tup(List((None,Fld(_,Var(a))), (None,Fld(_,Var(b))), (None,Fld(_,Var(c))))),Blk(List(If(IfOpsApp(Var(a),List((Var(==),IfThen(App(App(Var(and),Tup(List((None,Fld(_,App(App(Var(and),Tup(List((None,Fld(_,IntLit(0)))))),Tup(List((None,Fld(_,App(App(Var(is),Tup(List((None,Fld(_,Var(b)))))),Tup(List((None,Fld(_,App(Var(B),Tup(List()))))))))))))))))),Tup(List((None,Fld(_,App(App(Var(is),Tup(List((None,Fld(_,Var(c)))))),Tup(List((None,Fld(_,App(Var(C),Tup(List())))))))))))),IntLit(0))))),None)))))))) //│ Parsed: fun f = (a, b, c,) => {if a ‹· == (and(and(0,)(is(b,)(B(),),),)(is(c,)(C(),),)) then 0›}; //│ Desugared: rec def f: (a, b, c,) => {if a ‹· == (and(and(0,)(is(b,)(B(),),),)(is(c,)(C(),),)) then 0›} -//│ AST: Def(true,Var(f),Left(Lam(Tup(List((None,Fld(FldFlags(false,false,false),Var(a))), (None,Fld(FldFlags(false,false,false),Var(b))), (None,Fld(FldFlags(false,false,false),Var(c))))),Blk(List(If(IfOpsApp(Var(a),List((Var(==),IfThen(App(App(Var(and),Tup(List((None,Fld(FldFlags(false,false,false),App(App(Var(and),Tup(List((None,Fld(FldFlags(false,false,false),IntLit(0)))))),Tup(List((None,Fld(FldFlags(false,false,false),App(App(Var(is),Tup(List((None,Fld(FldFlags(false,false,false),Var(b)))))),Tup(List((None,Fld(FldFlags(false,false,false),App(Var(B),Tup(List()))))))))))))))))),Tup(List((None,Fld(FldFlags(false,false,false),App(App(Var(is),Tup(List((None,Fld(FldFlags(false,false,false),Var(c)))))),Tup(List((None,Fld(FldFlags(false,false,false),App(Var(C),Tup(List())))))))))))),IntLit(0))))),None))))),true) +//│ AST: Def(true,Var(f),Left(Lam(Tup(List((None,Fld(_,Var(a))), (None,Fld(_,Var(b))), (None,Fld(_,Var(c))))),Blk(List(If(IfOpsApp(Var(a),List((Var(==),IfThen(App(App(Var(and),Tup(List((None,Fld(_,App(App(Var(and),Tup(List((None,Fld(_,IntLit(0)))))),Tup(List((None,Fld(_,App(App(Var(is),Tup(List((None,Fld(_,Var(b)))))),Tup(List((None,Fld(_,App(Var(B),Tup(List()))))))))))))))))),Tup(List((None,Fld(_,App(App(Var(is),Tup(List((None,Fld(_,Var(c)))))),Tup(List((None,Fld(_,App(Var(C),Tup(List())))))))))))),IntLit(0))))),None))))),true) //│ ╔══[ERROR] The case when this is false is not handled: ==(a,)(0,) //│ ║ l.93: if a //│ ║ ^