blob: f7d15b0b574640352379d3c8e6403f8242d33b8f (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
|
template reject(x) =
static: assert(not compiles(x))
reject:
const x = int8(300)
reject:
const x = int64(NaN)
type
R = range[0..10]
reject:
const x = R(11)
reject:
const x = R(11.0)
reject:
const x = R(NaN)
reject:
const x = R(Inf)
type
FloatRange = range[0'f..10'f]
reject:
const x = FloatRange(-1'f)
reject:
const x = FloatRange(-1)
reject:
const x = FloatRange(NaN)
block:
const x = float32(NaN)
type E = enum a, b, c
reject:
const e = E(4)
block: # issue 3766
type R = range[0..2]
reject:
type
T[n: static[R]] = object
V = T[3.R]
reject:
proc r(x: static[R]) =
echo x
r 3.R
|