v4 / vlib / v / checker / tests / cast_to_byte_err.vv
23 lines · 19 sloc · 352 bytes · 173e6a943b43c332c1ead547e165b55ad4b74622
Raw
1type SAlias = string
2
3type CAlias = char
4type IAlias = int
5type UAlias = u32
6type FAlias = f32
7
8fn main() {
9 // should be errors:
10 _ := u8('hello')
11 _ := u8(SAlias('hello'))
12
13 // should be allowed:
14 _ := u8(char(1))
15 _ := u8(int(1))
16 _ := u8(u32(1))
17 _ := u8(f32(1.0))
18
19 _ := u8(CAlias(1))
20 _ := u8(IAlias(1))
21 _ := u8(UAlias(1))
22 _ := u8(FAlias(1))
23}
24