diff --git a/test/snapshots/identity.output b/test/snapshots/identity.output index 2a44be6..092ab95 100644 --- a/test/snapshots/identity.output +++ b/test/snapshots/identity.output @@ -1,11 +1,11 @@ tokens: -[TokenType,TokenLiteral "Id",TokenEq,TokenOB,TokenLiteral "String",TokenArrow,TokenLiteral "String",TokenCB,TokenAmpersand,TokenOB,TokenLiteral "Int",TokenArrow,TokenLiteral "Int",TokenCB,TokenAmpersand,TokenOB,TokenLiteral "Bool",TokenArrow,TokenLiteral "Bool",TokenCB,TokenIn,TokenLet,TokenLiteral "id",TokenEq,TokenOB,TokenLiteral "x",TokenColon,TokenLiteral "String",TokenPipe,TokenLiteral "Int",TokenPipe,TokenLiteral "Bool",TokenCB,TokenFatArrow,TokenLiteral "x",TokenIn,TokenLet,TokenLiteral "_",TokenEq,TokenLiteral "id",TokenQuote,TokenString "hello world",TokenQuote,TokenIn,TokenLet,TokenLiteral "_",TokenEq,TokenLiteral "id",TokenBool True,TokenIn,TokenLiteral "id",TokenInt 1] +[TokenType,TokenLiteral "Id",TokenEq,TokenOB,TokenLiteral "String",TokenArrow,TokenLiteral "String",TokenCB,TokenAmpersand,TokenOB,TokenLiteral "Int",TokenArrow,TokenLiteral "Int",TokenCB,TokenAmpersand,TokenOB,TokenLiteral "Bool",TokenArrow,TokenLiteral "Bool",TokenCB,TokenIn,TokenLet,TokenLiteral "id",TokenColon,TokenLiteral "Id",TokenEq,TokenOB,TokenLiteral "x",TokenColon,TokenLiteral "String",TokenPipe,TokenLiteral "Bool",TokenPipe,TokenLiteral "Int",TokenCB,TokenFatArrow,TokenLiteral "x",TokenIn,TokenLet,TokenLiteral "_",TokenEq,TokenLiteral "id",TokenQuote,TokenString "hello world",TokenQuote,TokenIn,TokenLet,TokenLiteral "_",TokenEq,TokenLiteral "id",TokenBool True,TokenIn,TokenLiteral "id",TokenInt 1] ast: -STypeAlias "Id" (STypeIntersection (STypeFunc (SType "String") (SType "String")) (STypeIntersection (STypeFunc (SType "Int") (SType "Int")) (STypeFunc (SType "Bool") (SType "Bool")))) (SLetInfer "id" (SDefInfer "x" (STypeUnion (SType "String") (STypeUnion (SType "Int") (SType "Bool"))) (SName "x")) (SLetInfer "_" (SApp (SName "id") (SString "hello world")) (SLetInfer "_" (SApp (SName "id") (SBool True)) (SApp (SName "id") (SInt 1))))) +STypeAlias "Id" (STypeIntersection (STypeFunc (SType "String") (SType "String")) (STypeIntersection (STypeFunc (SType "Int") (SType "Int")) (STypeFunc (SType "Bool") (SType "Bool")))) (SLet "id" (SType "Id") (SDefInfer "x" (STypeUnion (SType "String") (STypeUnion (SType "Bool") (SType "Int"))) (SName "x")) (SLetInfer "_" (SApp (SName "id") (SString "hello world")) (SLetInfer "_" (SApp (SName "id") (SBool True)) (SApp (SName "id") (SInt 1))))) -type: +check err: -TUnion TString (TUnion TInt TBool) +"Var of type trying to be assigned with " diff --git a/test/snapshots/identity.pog b/test/snapshots/identity.pog index 1055180..94340d0 100644 --- a/test/snapshots/identity.pog +++ b/test/snapshots/identity.pog @@ -1,5 +1,5 @@ type Id = (String -> String) & (Int -> Int) & (Bool -> Bool) in -let id = (x: String | Int | Bool) => x in +let id: Id = (x: String | Int | Bool) => x in let _ = id "hello world" in let _ = id True in id 1 \ No newline at end of file