Files
corelang/programs/any.kl
2022-06-19 16:01:58 +02:00

47 lines
974 B
Plaintext

main :: (argc: int, argv: **char): int
test_type()
test_any :: ()
some_int_value := 10
thing: Any = some_int_value
other_any: Any = thing
imp_any := thing
Some_Struct :: struct
thing: int
test_type :: ()
type1: Type = **[]int
type2 := []*[]*Some_Struct
type3 := Some_Struct
type4 := [32]Some_Struct
type5 := [][32]*Some_Struct
type6 := [][32]*[16][]Some_Struct
t1 := get_type_info(type1)
assert(t1.kind == Type_Info_Kind.POINTER)
t2 := get_type_info(type2)
assert(t2.kind == Type_Info_Kind.SLICE)
t3 := get_type_info(type3)
assert(t3.kind == Type_Info_Kind.STRUCT)
t4 := get_type_info(type4)
assert(t4.array_size == 32)
assert(t4.kind == Type_Info_Kind.ARRAY)
t5 := get_type_info(type5)
t51 := get_type_info(t5.base_type)
assert(t51.kind == Type_Info_Kind.ARRAY)
t6 := get_type_info(type6)
t61 := get_type_info(t6.base_type)
t62 := get_type_info(t61.base_type)
assert(t62.kind == Type_Info_Kind.POINTER)