about summary refs log tree commit diff
path: root/boot/tests/parse/type_modifiers.cskt
blob: 3c639b3c115d44edeba5c612abfde3ecbd6bd903 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
checks for various type modifier combinations.
&...? should always combine into an optional reference to a type.
1-tuples should always decay into their inner element type,
allowing for usage as a group.

<<<

var a &int? = nil
var b &(int?) = nil
var c (int) = 0
var d (int, bool) = nil
var e &&int = nil
var f &&int? = nil

>>>

(variable (declaration a (type maybe (type reference to (type name int))) (initializer (expr (name nil)))))
(variable (declaration b (type reference to (type maybe (type name int))) (initializer (expr (name nil)))))
(variable (declaration c (type name int) (initializer (expr 0))))
(variable (declaration d (type tuple (type name int) (type name bool)) (initializer (expr (name nil)))))
(variable (declaration e (type reference to (type reference to (type name int))) (initializer (expr (name nil)))))
(variable (declaration f (type maybe (type reference to (type reference to (type name int)))) (initializer (expr (name nil)))))