Files
Toy/scripts/test/types.toy

26 lines
554 B
Plaintext

//basic types
var t: type = int;
var u: t = 42;
assert t == int, "types are not first class";
assert u == 42, "first-class types are screwing with values";
//differentiate by the "type" value
var v: type = astype [int];
var w = [int];
var x = v;
assert w == [int], "defining an array of types failed";
assert x == astype [int], "re-assigning a type value failed";
//complex type
var complex: type = astype [string : [int]];
var dict: complex = [
"first array": [1, 2, 3],
"second array": [4, 5, 6],
"third array": [7, 8, 9]
];
print "All good";