mirror of
https://github.com/nim-lang/Nim.git
synced 2025-12-31 10:22:15 +00:00
* Remove NaN/Inf/NegInf magic * Make range checks in semConv * fix the failing line * fix `firstOrd` and `lastOrd` * fix `localError` * remove debug comment * Cleanup, fix failing test * make tests green
44 lines
514 B
Nim
44 lines
514 B
Nim
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)
|