Added the typeas keyword to avoid ambiguity

This commit is contained in:
2022-09-05 12:24:42 +01:00
parent 3d8871abe1
commit 82c03ecb33
7 changed files with 27 additions and 13 deletions

View File

@@ -42,7 +42,7 @@
{
import t;
assert typeof t == type type, "type retention failed";
assert typeof t == type, "type retention failed";
}
print "All good";

View File

@@ -7,15 +7,15 @@ assert u == 42, "first-class types are screwing with values";
//differentiate by the "type" value
var v: type = type [int];
var v: type = typeas [int];
var w = [int];
var x = v;
assert w == [int], "defining an array of types failed";
assert x == type [int], "re-assigning a type value failed";
assert x == typeas [int], "re-assigning a type value failed";
//complex type
var complex: type = type [string : [int]];
var complex: type = typeas [string : [int]];
var dict: complex = [
"first array": [1, 2, 3],
"second array": [4, 5, 6],