some test cleanups & category reorganization (#22010)

* clean up some test categories

* mention exact slice issue

* magics into system

* move trangechecks into overflow

* move tmemory to system

* try fix CI

* try fix CI

* final CI fix
This commit is contained in:
metagn
2023-06-06 07:54:07 +03:00
committed by GitHub
parent 2ab948ce53
commit b97d603cd0
134 changed files with 189 additions and 374 deletions

View File

@@ -1,48 +0,0 @@
discard """
disabled: true
"""
import typetraits
type
TRecord = (tuple) or (object)
TFoo[T, U] = object
x: int
when T is string:
y: float
else:
y: string
when U is TRecord:
z: float
E = enum A, B, C
macro m(t: typedesc): typedesc =
if t is enum:
result = string
else:
result = int
var f: TFoo[int, int]
static: doAssert(f.y.type.name == "string")
when compiles(f.z):
{.error: "Foo should not have a `z` field".}
proc p(a, b: auto) =
when a.type is int:
static: doAssert false
var f: TFoo[m(a.type), b.type]
static:
doAssert f.x.type.name == "int"
echo f.y.type.name
doAssert f.y.type.name == "float"
echo f.z.type.name
doAssert f.z.type.name == "float"
p(A, f)

View File

@@ -135,3 +135,33 @@ block:
let Q = MyObj[P](y: 2)
doAssert($Q == "(y: 2)")
block: # previously tisop.nim
type
TRecord = (tuple) or (object)
TFoo[T, U] = object
x: int
when T is string:
y: float
else:
y: string
when U is TRecord:
z: float
E = enum A, B, C
template m(t: typedesc): typedesc =
when t is enum:
string
else:
int
var f: TFoo[int, int]
static: doAssert(typeof(f.y) is string)
when compiles(f.z):
{.error: "Foo should not have a `z` field".}
proc p(a, b: auto) =
when typeof(a) is int:
static: doAssert false
var f: TFoo[m(a.typeof), b.typeof]
static:
doAssert f.x.typeof is int
doAssert f.y.typeof is float
doAssert f.z.typeof is float
p(A, f)