TypeChecker: added checks for wrap and unwrap

For user defined value types and also added a test case.
This commit is contained in:
hrkrshnn
2021-09-07 19:42:51 +02:00
parent 0647039864
commit ce75790e8d
2 changed files with 23 additions and 0 deletions
@@ -0,0 +1,16 @@
type MyInt is int;
function f() {
MyInt.wrap(5, 6, 7);
MyInt.wrap({test: 5});
MyInt.wrap();
MyInt.unwrap(5);
MyInt.unwrap({test: 5});
MyInt.unwrap(MyInt.wrap(1), MyInt.wrap(2));
}
// ----
// TypeError 6160: (38-57): Wrong argument count for function call: 3 arguments given but expected 1.
// TypeError 4974: (63-84): Named argument "test" does not match function declaration.
// TypeError 6160: (90-102): Wrong argument count for function call: 0 arguments given but expected 1.
// TypeError 9553: (121-122): Invalid type for argument in function call. Invalid implicit conversion from int_const 5 to user defined type MyInt requested.
// TypeError 4974: (129-152): Named argument "test" does not match function declaration.
// TypeError 6160: (158-200): Wrong argument count for function call: 2 arguments given but expected 1.