Update tests

This commit is contained in:
Richard Feldman 2025-11-07 22:39:28 -05:00
parent fa11e04460
commit 00d0e6593d
No known key found for this signature in database
15 changed files with 303 additions and 238 deletions

View file

@ -84,18 +84,18 @@ external = Foo.defaultBaz
# CANONICALIZE
~~~clojure
(can-ir
(d-let
(p-assign (ident "external"))
(e-lookup-local
(p-assign (ident "Foo.defaultBaz")))
(annotation
(ty-lookup (name "Foo.Baz") (local))))
(d-let
(p-assign (ident "Foo.defaultBaz"))
(e-nominal (nominal "Foo.Bar")
(e-tag (name "X")))
(annotation
(ty-lookup (name "Foo.Baz") (local))))
(d-let
(p-assign (ident "external"))
(e-lookup-local
(p-assign (ident "Foo.defaultBaz")))
(annotation
(ty-lookup (name "Foo.Baz") (local))))
(s-nominal-decl
(ty-header (name "Foo"))
(ty-tag-union

View file

@ -64,6 +64,9 @@ Foo := [Whatever].{
# CANONICALIZE
~~~clojure
(can-ir
(d-let
(p-assign (ident "Foo.Bar.baz"))
(e-num (value "5")))
(d-let
(p-assign (ident "Foo.Bar.baz"))
(e-num (value "5")))
@ -83,6 +86,7 @@ Foo := [Whatever].{
~~~clojure
(inferred-types
(defs
(patt (type "num where [num.from_int_digits : List(U8) -> Try(num, [OutOfRange])]"))
(patt (type "num where [num.from_int_digits : List(U8) -> Try(num, [OutOfRange])]"))
(patt (type "num where [num.from_int_digits : List(U8) -> Try(num, [OutOfRange])]")))
(type_decls
@ -91,6 +95,7 @@ Foo := [Whatever].{
(nominal (type "Foo.Bar")
(ty-header (name "Foo.Bar"))))
(expressions
(expr (type "num where [num.from_int_digits : List(U8) -> Try(num, [OutOfRange])]"))
(expr (type "num where [num.from_int_digits : List(U8) -> Try(num, [OutOfRange])]"))
(expr (type "num where [num.from_int_digits : List(U8) -> Try(num, [OutOfRange])]"))))
~~~

View file

@ -110,6 +110,18 @@ deepType = C
# CANONICALIZE
~~~clojure
(can-ir
(d-let
(p-assign (ident "Foo.Level1.Level2.Level3.value"))
(e-num (value "42")))
(d-let
(p-assign (ident "Foo.Level1.Level2.Level3.value"))
(e-num (value "42")))
(d-let
(p-assign (ident "Foo.Level1.Level2.Level3.value"))
(e-num (value "42")))
(d-let
(p-assign (ident "Foo.Level1.Level2.Level3.value"))
(e-num (value "42")))
(d-let
(p-assign (ident "deepValue"))
(e-lookup-local
@ -121,9 +133,6 @@ deepType = C
(e-tag (name "C"))
(annotation
(ty-lookup (name "Foo.Level1.Level2.Level3") (local))))
(d-let
(p-assign (ident "Foo.Level1.Level2.Level3.value"))
(e-num (value "42")))
(s-nominal-decl
(ty-header (name "Foo"))
(ty-tag-union
@ -146,8 +155,11 @@ deepType = C
(inferred-types
(defs
(patt (type "Num(Int(Unsigned64))"))
(patt (type "Foo.Level1.Level2.Level3"))
(patt (type "Num(Int(Unsigned64))")))
(patt (type "Num(Int(Unsigned64))"))
(patt (type "Num(Int(Unsigned64))"))
(patt (type "Num(Int(Unsigned64))"))
(patt (type "Num(Int(Unsigned64))"))
(patt (type "Foo.Level1.Level2.Level3")))
(type_decls
(nominal (type "Foo")
(ty-header (name "Foo")))
@ -159,6 +171,9 @@ deepType = C
(ty-header (name "Foo.Level1.Level2.Level3"))))
(expressions
(expr (type "Num(Int(Unsigned64))"))
(expr (type "Foo.Level1.Level2.Level3"))
(expr (type "Num(Int(Unsigned64))"))))
(expr (type "Num(Int(Unsigned64))"))
(expr (type "Num(Int(Unsigned64))"))
(expr (type "Num(Int(Unsigned64))"))
(expr (type "Num(Int(Unsigned64))"))
(expr (type "Foo.Level1.Level2.Level3"))))
~~~

View file

@ -58,15 +58,15 @@ useBar = Foo.bar
# CANONICALIZE
~~~clojure
(can-ir
(d-let
(p-assign (ident "Foo.bar"))
(e-num (value "42")))
(d-let
(p-assign (ident "useBar"))
(e-lookup-local
(p-assign (ident "Foo.bar")))
(annotation
(ty-lookup (name "U64") (builtin))))
(d-let
(p-assign (ident "Foo.bar"))
(e-num (value "42")))
(s-nominal-decl
(ty-header (name "Foo"))
(ty-tag-union

View file

@ -89,15 +89,6 @@ result = Foo.transform(Foo.defaultBar)
# CANONICALIZE
~~~clojure
(can-ir
(d-let
(p-assign (ident "result"))
(e-call
(e-lookup-local
(p-assign (ident "Foo.transform")))
(e-lookup-local
(p-assign (ident "Foo.defaultBar"))))
(annotation
(ty-lookup (name "Foo.Bar") (local))))
(d-let
(p-assign (ident "Foo.defaultBar"))
(e-nominal (nominal "Foo.Bar")
@ -113,6 +104,15 @@ result = Foo.transform(Foo.defaultBar)
(ty-fn (effectful false)
(ty-lookup (name "Foo.Bar") (local))
(ty-lookup (name "Foo.Bar") (local)))))
(d-let
(p-assign (ident "result"))
(e-call
(e-lookup-local
(p-assign (ident "Foo.transform")))
(e-lookup-local
(p-assign (ident "Foo.defaultBar"))))
(annotation
(ty-lookup (name "Foo.Bar") (local))))
(s-nominal-decl
(ty-header (name "Foo"))
(ty-tag-union
@ -129,8 +129,8 @@ result = Foo.transform(Foo.defaultBar)
(inferred-types
(defs
(patt (type "Foo.Bar"))
(patt (type "Foo.Bar"))
(patt (type "Foo.Bar -> Foo.Bar")))
(patt (type "Foo.Bar -> Foo.Bar"))
(patt (type "Foo.Bar")))
(type_decls
(nominal (type "Foo")
(ty-header (name "Foo")))
@ -138,6 +138,6 @@ result = Foo.transform(Foo.defaultBar)
(ty-header (name "Foo.Bar"))))
(expressions
(expr (type "Foo.Bar"))
(expr (type "Foo.Bar"))
(expr (type "Foo.Bar -> Foo.Bar"))))
(expr (type "Foo.Bar -> Foo.Bar"))
(expr (type "Foo.Bar"))))
~~~

View file

@ -84,6 +84,12 @@ myNum = Foo.Bar.baz
# CANONICALIZE
~~~clojure
(can-ir
(d-let
(p-assign (ident "Foo.Bar.baz"))
(e-num (value "5")))
(d-let
(p-assign (ident "Foo.Bar.baz"))
(e-num (value "5")))
(d-let
(p-assign (ident "myType"))
(e-tag (name "Something"))
@ -95,9 +101,6 @@ myNum = Foo.Bar.baz
(p-assign (ident "Foo.Bar.baz")))
(annotation
(ty-lookup (name "U64") (builtin))))
(d-let
(p-assign (ident "Foo.Bar.baz"))
(e-num (value "5")))
(s-nominal-decl
(ty-header (name "Foo"))
(ty-tag-union
@ -111,8 +114,9 @@ myNum = Foo.Bar.baz
~~~clojure
(inferred-types
(defs
(patt (type "Foo.Bar"))
(patt (type "Num(Int(Unsigned64))"))
(patt (type "Num(Int(Unsigned64))"))
(patt (type "Foo.Bar"))
(patt (type "Num(Int(Unsigned64))")))
(type_decls
(nominal (type "Foo")
@ -120,7 +124,8 @@ myNum = Foo.Bar.baz
(nominal (type "Foo.Bar")
(ty-header (name "Foo.Bar"))))
(expressions
(expr (type "Foo.Bar"))
(expr (type "Num(Int(Unsigned64))"))
(expr (type "Num(Int(Unsigned64))"))
(expr (type "Foo.Bar"))
(expr (type "Num(Int(Unsigned64))"))))
~~~

View file

@ -101,12 +101,6 @@ external = Foo.defaultBar
# CANONICALIZE
~~~clojure
(can-ir
(d-let
(p-assign (ident "external"))
(e-lookup-local
(p-assign (ident "Foo.defaultBar")))
(annotation
(ty-lookup (name "Foo.Bar") (local))))
(d-let
(p-assign (ident "Foo.defaultBar"))
(e-tag (name "X"))
@ -130,6 +124,12 @@ external = Foo.defaultBar
(p-assign (ident "Foo.transform")))
(e-lookup-local
(p-assign (ident "Foo.defaultBar")))))
(d-let
(p-assign (ident "external"))
(e-lookup-local
(p-assign (ident "Foo.defaultBar")))
(annotation
(ty-lookup (name "Foo.Bar") (local))))
(s-nominal-decl
(ty-header (name "Foo"))
(ty-tag-union
@ -145,9 +145,9 @@ external = Foo.defaultBar
~~~clojure
(inferred-types
(defs
(patt (type "Foo.Bar"))
(patt (type "Foo.Bar"))
(patt (type "Foo.Bar -> Foo.Bar"))
(patt (type "Foo.Bar"))
(patt (type "Foo.Bar")))
(type_decls
(nominal (type "Foo")
@ -155,8 +155,8 @@ external = Foo.defaultBar
(nominal (type "Foo.Bar")
(ty-header (name "Foo.Bar"))))
(expressions
(expr (type "Foo.Bar"))
(expr (type "Foo.Bar"))
(expr (type "Foo.Bar -> Foo.Bar"))
(expr (type "Foo.Bar"))
(expr (type "Foo.Bar"))))
~~~

View file

@ -73,6 +73,9 @@ result = myBar
# CANONICALIZE
~~~clojure
(can-ir
(d-let
(p-assign (ident "Foo.bar"))
(e-num (value "42")))
(d-let
(p-assign (ident "myBar"))
(e-lookup-local
@ -85,9 +88,6 @@ result = myBar
(p-assign (ident "myBar")))
(annotation
(ty-lookup (name "U64") (builtin))))
(d-let
(p-assign (ident "Foo.bar"))
(e-num (value "42")))
(s-nominal-decl
(ty-header (name "Foo"))
(ty-tag-union

View file

@ -102,6 +102,24 @@ Foo := [Whatever].{
# CANONICALIZE
~~~clojure
(can-ir
(d-let
(p-assign (ident "Foo.Bar.Baz.Qux.w"))
(e-num (value "1")))
(d-let
(p-assign (ident "Foo.Bar.Baz.Qux.w"))
(e-num (value "1")))
(d-let
(p-assign (ident "Foo.Bar.Baz.z"))
(e-num (value "2")))
(d-let
(p-assign (ident "Foo.Bar.Baz.Qux.w"))
(e-num (value "1")))
(d-let
(p-assign (ident "Foo.Bar.Baz.z"))
(e-num (value "2")))
(d-let
(p-assign (ident "Foo.Bar.y"))
(e-num (value "3")))
(d-let
(p-assign (ident "Foo.Bar.Baz.Qux.w"))
(e-num (value "1")))
@ -135,6 +153,12 @@ Foo := [Whatever].{
~~~clojure
(inferred-types
(defs
(patt (type "num where [num.from_int_digits : List(U8) -> Try(num, [OutOfRange])]"))
(patt (type "num where [num.from_int_digits : List(U8) -> Try(num, [OutOfRange])]"))
(patt (type "num where [num.from_int_digits : List(U8) -> Try(num, [OutOfRange])]"))
(patt (type "num where [num.from_int_digits : List(U8) -> Try(num, [OutOfRange])]"))
(patt (type "num where [num.from_int_digits : List(U8) -> Try(num, [OutOfRange])]"))
(patt (type "num where [num.from_int_digits : List(U8) -> Try(num, [OutOfRange])]"))
(patt (type "num where [num.from_int_digits : List(U8) -> Try(num, [OutOfRange])]"))
(patt (type "num where [num.from_int_digits : List(U8) -> Try(num, [OutOfRange])]"))
(patt (type "num where [num.from_int_digits : List(U8) -> Try(num, [OutOfRange])]"))
@ -149,6 +173,12 @@ Foo := [Whatever].{
(nominal (type "Foo.Bar.Baz.Qux")
(ty-header (name "Foo.Bar.Baz.Qux"))))
(expressions
(expr (type "num where [num.from_int_digits : List(U8) -> Try(num, [OutOfRange])]"))
(expr (type "num where [num.from_int_digits : List(U8) -> Try(num, [OutOfRange])]"))
(expr (type "num where [num.from_int_digits : List(U8) -> Try(num, [OutOfRange])]"))
(expr (type "num where [num.from_int_digits : List(U8) -> Try(num, [OutOfRange])]"))
(expr (type "num where [num.from_int_digits : List(U8) -> Try(num, [OutOfRange])]"))
(expr (type "num where [num.from_int_digits : List(U8) -> Try(num, [OutOfRange])]"))
(expr (type "num where [num.from_int_digits : List(U8) -> Try(num, [OutOfRange])]"))
(expr (type "num where [num.from_int_digits : List(U8) -> Try(num, [OutOfRange])]"))
(expr (type "num where [num.from_int_digits : List(U8) -> Try(num, [OutOfRange])]"))

View file

@ -64,6 +64,9 @@ Foo := [Whatever].{
# CANONICALIZE
~~~clojure
(can-ir
(d-let
(p-assign (ident "Foo.Bar.y"))
(e-num (value "6")))
(d-let
(p-assign (ident "Foo.Bar.y"))
(e-num (value "6")))
@ -83,6 +86,7 @@ Foo := [Whatever].{
~~~clojure
(inferred-types
(defs
(patt (type "num where [num.from_int_digits : List(U8) -> Try(num, [OutOfRange])]"))
(patt (type "num where [num.from_int_digits : List(U8) -> Try(num, [OutOfRange])]"))
(patt (type "num where [num.from_int_digits : List(U8) -> Try(num, [OutOfRange])]")))
(type_decls
@ -91,6 +95,7 @@ Foo := [Whatever].{
(nominal (type "Foo.Bar")
(ty-header (name "Foo.Bar"))))
(expressions
(expr (type "num where [num.from_int_digits : List(U8) -> Try(num, [OutOfRange])]"))
(expr (type "num where [num.from_int_digits : List(U8) -> Try(num, [OutOfRange])]"))
(expr (type "num where [num.from_int_digits : List(U8) -> Try(num, [OutOfRange])]"))))
~~~

View file

@ -63,6 +63,9 @@ Foo := [Blah].{
# CANONICALIZE
~~~clojure
(can-ir
(d-let
(p-assign (ident "Foo.Bar.baz"))
(e-empty_record))
(d-let
(p-assign (ident "Foo.Bar.baz"))
(e-empty_record))
@ -81,6 +84,7 @@ Foo := [Blah].{
~~~clojure
(inferred-types
(defs
(patt (type "{}"))
(patt (type "{}"))
(patt (type "{}")))
(type_decls
@ -89,6 +93,7 @@ Foo := [Blah].{
(nominal (type "Foo.Bar")
(ty-header (name "Foo.Bar"))))
(expressions
(expr (type "{}"))
(expr (type "{}"))
(expr (type "{}"))))
~~~

View file

@ -317,6 +317,80 @@ main = {
# CANONICALIZE
~~~clojure
(can-ir
(d-let
(p-assign (ident "Adv.to_str"))
(e-closure
(captures
(capture (ident "s")))
(e-lambda
(args
(p-nominal
(p-applied-tag)))
(e-lookup-local
(p-assign (ident "s")))))
(annotation
(ty-fn (effectful false)
(ty-lookup (name "Adv") (local))
(ty-lookup (name "Str") (builtin)))))
(d-let
(p-assign (ident "Adv.to_u64"))
(e-closure
(captures
(capture (ident "u")))
(e-lambda
(args
(p-nominal
(p-applied-tag)))
(e-lookup-local
(p-assign (ident "u")))))
(annotation
(ty-fn (effectful false)
(ty-lookup (name "Adv") (local))
(ty-lookup (name "U64") (builtin)))))
(d-let
(p-assign (ident "Adv.update_str"))
(e-closure
(captures
(capture (ident "u64")))
(e-lambda
(args
(p-nominal
(p-applied-tag))
(p-assign (ident "next_str")))
(e-nominal (nominal "Adv")
(e-tag (name "Val")
(args
(e-lookup-local
(p-assign (ident "u64")))
(e-lookup-local
(p-assign (ident "next_str"))))))))
(annotation
(ty-fn (effectful false)
(ty-lookup (name "Adv") (local))
(ty-lookup (name "Str") (builtin))
(ty-lookup (name "Adv") (local)))))
(d-let
(p-assign (ident "Adv.update_u64"))
(e-closure
(captures
(capture (ident "str")))
(e-lambda
(args
(p-nominal
(p-applied-tag))
(p-assign (ident "next_u64")))
(e-nominal (nominal "Adv")
(e-tag (name "Val")
(args
(e-lookup-local
(p-assign (ident "next_u64")))
(e-lookup-local
(p-assign (ident "str"))))))))
(annotation
(ty-fn (effectful false)
(ty-lookup (name "Adv") (local))
(ty-lookup (name "U64") (builtin))
(ty-lookup (name "Adv") (local)))))
(d-let
(p-assign (ident "mismatch"))
(e-block
@ -411,80 +485,6 @@ main = {
(ty-tuple
(ty-lookup (name "Str") (builtin))
(ty-lookup (name "U64") (builtin)))))
(d-let
(p-assign (ident "Adv.to_str"))
(e-closure
(captures
(capture (ident "s")))
(e-lambda
(args
(p-nominal
(p-applied-tag)))
(e-lookup-local
(p-assign (ident "s")))))
(annotation
(ty-fn (effectful false)
(ty-lookup (name "Adv") (local))
(ty-lookup (name "Str") (builtin)))))
(d-let
(p-assign (ident "Adv.to_u64"))
(e-closure
(captures
(capture (ident "u")))
(e-lambda
(args
(p-nominal
(p-applied-tag)))
(e-lookup-local
(p-assign (ident "u")))))
(annotation
(ty-fn (effectful false)
(ty-lookup (name "Adv") (local))
(ty-lookup (name "U64") (builtin)))))
(d-let
(p-assign (ident "Adv.update_str"))
(e-closure
(captures
(capture (ident "u64")))
(e-lambda
(args
(p-nominal
(p-applied-tag))
(p-assign (ident "next_str")))
(e-nominal (nominal "Adv")
(e-tag (name "Val")
(args
(e-lookup-local
(p-assign (ident "u64")))
(e-lookup-local
(p-assign (ident "next_str"))))))))
(annotation
(ty-fn (effectful false)
(ty-lookup (name "Adv") (local))
(ty-lookup (name "Str") (builtin))
(ty-lookup (name "Adv") (local)))))
(d-let
(p-assign (ident "Adv.update_u64"))
(e-closure
(captures
(capture (ident "str")))
(e-lambda
(args
(p-nominal
(p-applied-tag))
(p-assign (ident "next_u64")))
(e-nominal (nominal "Adv")
(e-tag (name "Val")
(args
(e-lookup-local
(p-assign (ident "next_u64")))
(e-lookup-local
(p-assign (ident "str"))))))))
(annotation
(ty-fn (effectful false)
(ty-lookup (name "Adv") (local))
(ty-lookup (name "U64") (builtin))
(ty-lookup (name "Adv") (local)))))
(s-nominal-decl
(ty-header (name "Adv"))
(ty-tag-union
@ -496,24 +496,24 @@ main = {
~~~clojure
(inferred-types
(defs
(patt (type "_a"))
(patt (type "_a"))
(patt (type "_a"))
(patt (type "(Str, Num(Int(Unsigned64)))"))
(patt (type "Adv -> Str"))
(patt (type "Adv -> Num(Int(Unsigned64))"))
(patt (type "Adv, Str -> Adv"))
(patt (type "Adv, Num(Int(Unsigned64)) -> Adv")))
(patt (type "Adv, Num(Int(Unsigned64)) -> Adv"))
(patt (type "_a"))
(patt (type "_a"))
(patt (type "_a"))
(patt (type "(Str, Num(Int(Unsigned64)))")))
(type_decls
(nominal (type "Adv")
(ty-header (name "Adv"))))
(expressions
(expr (type "_a"))
(expr (type "_a"))
(expr (type "_a"))
(expr (type "(Str, Num(Int(Unsigned64)))"))
(expr (type "Adv -> Str"))
(expr (type "Adv -> Num(Int(Unsigned64))"))
(expr (type "Adv, Str -> Adv"))
(expr (type "Adv, Num(Int(Unsigned64)) -> Adv"))))
(expr (type "Adv, Num(Int(Unsigned64)) -> Adv"))
(expr (type "_a"))
(expr (type "_a"))
(expr (type "_a"))
(expr (type "(Str, Num(Int(Unsigned64)))"))))
~~~

View file

@ -167,6 +167,35 @@ main = (helper1(val), helper2(val))
# CANONICALIZE
~~~clojure
(can-ir
(d-let
(p-assign (ident "Basic.to_str"))
(e-closure
(captures
(capture (ident "s")))
(e-lambda
(args
(p-nominal
(p-applied-tag)))
(e-lookup-local
(p-assign (ident "s")))))
(annotation
(ty-fn (effectful false)
(ty-lookup (name "Basic") (local))
(ty-lookup (name "Str") (builtin)))))
(d-let
(p-assign (ident "Basic.to_str2"))
(e-lambda
(args
(p-assign (ident "test")))
(e-dot-access (field "to_str")
(receiver
(e-lookup-local
(p-assign (ident "test"))))
(args)))
(annotation
(ty-fn (effectful false)
(ty-lookup (name "Basic") (local))
(ty-lookup (name "Str") (builtin)))))
(d-let
(p-assign (ident "helper1"))
(e-lambda
@ -232,35 +261,6 @@ main = (helper1(val), helper2(val))
(ty-tuple
(ty-lookup (name "Str") (builtin))
(ty-lookup (name "Str") (builtin)))))
(d-let
(p-assign (ident "Basic.to_str"))
(e-closure
(captures
(capture (ident "s")))
(e-lambda
(args
(p-nominal
(p-applied-tag)))
(e-lookup-local
(p-assign (ident "s")))))
(annotation
(ty-fn (effectful false)
(ty-lookup (name "Basic") (local))
(ty-lookup (name "Str") (builtin)))))
(d-let
(p-assign (ident "Basic.to_str2"))
(e-lambda
(args
(p-assign (ident "test")))
(e-dot-access (field "to_str")
(receiver
(e-lookup-local
(p-assign (ident "test"))))
(args)))
(annotation
(ty-fn (effectful false)
(ty-lookup (name "Basic") (local))
(ty-lookup (name "Str") (builtin)))))
(s-nominal-decl
(ty-header (name "Basic"))
(ty-tag-union
@ -271,20 +271,20 @@ main = (helper1(val), helper2(val))
~~~clojure
(inferred-types
(defs
(patt (type "Basic -> Str"))
(patt (type "Basic -> Str"))
(patt (type "a -> b where [a.to_str : a -> b]"))
(patt (type "a -> b where [a.to_str2 : a -> b]"))
(patt (type "Basic"))
(patt (type "(Str, Str)"))
(patt (type "Basic -> Str"))
(patt (type "Basic -> Str")))
(patt (type "(Str, Str)")))
(type_decls
(nominal (type "Basic")
(ty-header (name "Basic"))))
(expressions
(expr (type "Basic -> Str"))
(expr (type "Basic -> Str"))
(expr (type "a -> b where [a.to_str : a -> b]"))
(expr (type "a -> b where [a.to_str2 : a -> b]"))
(expr (type "Basic"))
(expr (type "(Str, Str)"))
(expr (type "Basic -> Str"))
(expr (type "Basic -> Str"))))
(expr (type "(Str, Str)"))))
~~~

View file

@ -124,6 +124,27 @@ main = (helper1(val), helper2(val))
# CANONICALIZE
~~~clojure
(can-ir
(d-let
(p-assign (ident "BasicNoAnno.to_str"))
(e-closure
(captures
(capture (ident "s")))
(e-lambda
(args
(p-nominal
(p-applied-tag)))
(e-lookup-local
(p-assign (ident "s"))))))
(d-let
(p-assign (ident "BasicNoAnno.to_str2"))
(e-lambda
(args
(p-assign (ident "test")))
(e-dot-access (field "to_str")
(receiver
(e-lookup-local
(p-assign (ident "test"))))
(args))))
(d-let
(p-assign (ident "helper1"))
(e-lambda
@ -169,27 +190,6 @@ main = (helper1(val), helper2(val))
(ty-tuple
(ty-lookup (name "Str") (builtin))
(ty-lookup (name "Str") (builtin)))))
(d-let
(p-assign (ident "BasicNoAnno.to_str"))
(e-closure
(captures
(capture (ident "s")))
(e-lambda
(args
(p-nominal
(p-applied-tag)))
(e-lookup-local
(p-assign (ident "s"))))))
(d-let
(p-assign (ident "BasicNoAnno.to_str2"))
(e-lambda
(args
(p-assign (ident "test")))
(e-dot-access (field "to_str")
(receiver
(e-lookup-local
(p-assign (ident "test"))))
(args))))
(s-nominal-decl
(ty-header (name "BasicNoAnno"))
(ty-tag-union
@ -200,20 +200,20 @@ main = (helper1(val), helper2(val))
~~~clojure
(inferred-types
(defs
(patt (type "BasicNoAnno -> Str"))
(patt (type "a -> b where [a.to_str : a -> b]"))
(patt (type "a -> b where [a.to_str : a -> b]"))
(patt (type "a -> b where [a.to_str2 : a -> b]"))
(patt (type "BasicNoAnno"))
(patt (type "(Str, Str)"))
(patt (type "BasicNoAnno -> Str"))
(patt (type "a -> b where [a.to_str : a -> b]")))
(patt (type "(Str, Str)")))
(type_decls
(nominal (type "BasicNoAnno")
(ty-header (name "BasicNoAnno"))))
(expressions
(expr (type "BasicNoAnno -> Str"))
(expr (type "a -> b where [a.to_str : a -> b]"))
(expr (type "a -> b where [a.to_str : a -> b]"))
(expr (type "a -> b where [a.to_str2 : a -> b]"))
(expr (type "BasicNoAnno"))
(expr (type "(Str, Str)"))
(expr (type "BasicNoAnno -> Str"))
(expr (type "a -> b where [a.to_str : a -> b]"))))
(expr (type "(Str, Str)"))))
~~~

View file

@ -231,6 +231,47 @@ NO CHANGE
# CANONICALIZE
~~~clojure
(can-ir
(d-let
(p-assign (ident "Container.get_value"))
(e-closure
(captures
(capture (ident "s")))
(e-lambda
(args
(p-nominal
(p-applied-tag)))
(e-lookup-local
(p-assign (ident "s")))))
(annotation
(ty-fn (effectful false)
(ty-lookup (name "Container") (local))
(ty-lookup (name "Str") (builtin)))))
(d-let
(p-assign (ident "Container.transform"))
(e-closure
(captures
(capture (ident "s")))
(e-lambda
(args
(p-nominal
(p-applied-tag))
(p-assign (ident "fn")))
(e-nominal (nominal "Container")
(e-tag (name "Box")
(args
(e-call
(e-lookup-local
(p-assign (ident "fn")))
(e-lookup-local
(p-assign (ident "s")))))))))
(annotation
(ty-fn (effectful false)
(ty-lookup (name "Container") (local))
(ty-parens
(ty-fn (effectful false)
(ty-lookup (name "Str") (builtin))
(ty-lookup (name "Str") (builtin))))
(ty-lookup (name "Container") (local)))))
(d-let
(p-assign (ident "extract"))
(e-lambda
@ -351,47 +392,6 @@ NO CHANGE
(ty-lookup (name "Str") (builtin))
(ty-lookup (name "Str") (builtin))
(ty-lookup (name "Str") (builtin)))))
(d-let
(p-assign (ident "Container.get_value"))
(e-closure
(captures
(capture (ident "s")))
(e-lambda
(args
(p-nominal
(p-applied-tag)))
(e-lookup-local
(p-assign (ident "s")))))
(annotation
(ty-fn (effectful false)
(ty-lookup (name "Container") (local))
(ty-lookup (name "Str") (builtin)))))
(d-let
(p-assign (ident "Container.transform"))
(e-closure
(captures
(capture (ident "s")))
(e-lambda
(args
(p-nominal
(p-applied-tag))
(p-assign (ident "fn")))
(e-nominal (nominal "Container")
(e-tag (name "Box")
(args
(e-call
(e-lookup-local
(p-assign (ident "fn")))
(e-lookup-local
(p-assign (ident "s")))))))))
(annotation
(ty-fn (effectful false)
(ty-lookup (name "Container") (local))
(ty-parens
(ty-fn (effectful false)
(ty-lookup (name "Str") (builtin))
(ty-lookup (name "Str") (builtin))))
(ty-lookup (name "Container") (local)))))
(s-nominal-decl
(ty-header (name "Container"))
(ty-tag-union
@ -402,6 +402,8 @@ NO CHANGE
~~~clojure
(inferred-types
(defs
(patt (type "Container -> Str"))
(patt (type "Container, Str -> Str -> Container"))
(patt (type "a -> Str where [a.get_value : a -> Str]"))
(patt (type "a, Str -> Str -> a where [a.transform : a, Str -> Str -> aa.transform : a, Str -> Str -> a]"))
(patt (type "Container"))
@ -409,13 +411,13 @@ NO CHANGE
(patt (type "Str"))
(patt (type "Str"))
(patt (type "Container"))
(patt (type "(Str, Str, Str)"))
(patt (type "Container -> Str"))
(patt (type "Container, Str -> Str -> Container")))
(patt (type "(Str, Str, Str)")))
(type_decls
(nominal (type "Container")
(ty-header (name "Container"))))
(expressions
(expr (type "Container -> Str"))
(expr (type "Container, Str -> Str -> Container"))
(expr (type "a -> Str where [a.get_value : a -> Str]"))
(expr (type "a, Str -> Str -> a where [a.transform : a, Str -> Str -> aa.transform : a, Str -> Str -> a]"))
(expr (type "Container"))
@ -423,7 +425,5 @@ NO CHANGE
(expr (type "Str"))
(expr (type "Str"))
(expr (type "Container"))
(expr (type "(Str, Str, Str)"))
(expr (type "Container -> Str"))
(expr (type "Container, Str -> Str -> Container"))))
(expr (type "(Str, Str, Str)"))))
~~~