X-Git-Url: https://git.xandkar.net/?a=blobdiff_plain;f=compiler%2Fsrc%2Flib%2Ftiger%2Ftiger_test_cases.ml;h=788c3b795d4c7289bd6a77ffca98286cb3050599;hb=4f2aaee3ef5f70f7769931032fd50af0403c51ae;hp=4902017737b0dd020b42a64fea5805a03975b76b;hpb=155073e21824373c21dacbd75a61623c9d37fff2;p=tiger.ml.git diff --git a/compiler/src/lib/tiger/tiger_test_cases.ml b/compiler/src/lib/tiger/tiger_test_cases.ml index 4902017..788c3b7 100644 --- a/compiler/src/lib/tiger/tiger_test_cases.ml +++ b/compiler/src/lib/tiger/tiger_test_cases.ml @@ -230,6 +230,38 @@ let micro = [ID "f"; LPAREN; STRING "a"; COMMA; INT 3; COMMA; ID "foo"; RPAREN] ~is_error_expected_semant:Error.is_unknown_id ) + ; ( let code = + "let \ + type a = int \ + type b = a \ + type c = b \ + var i : a := 2 \ + var j : c := 3 \ + in \ + i := j \ + end \ + " + in + Test.case + "Type aliases" + ~code + ) + ; ( let code = + "let \ + type a = {x:int, y:int} \ + type b = {x:int, y:int} /* new type generated */ \ + var foo : a := a {x = 1, y = 2} \ + var bar : b := b {x = 1, y = 2} \ + in \ + foo = bar /* incompatible types */ \ + end \ + " + in + Test.case + code + ~code + ~is_error_expected_semant:Error.is_wrong_type (* TODO: Be more specific *) + ) ] let all =