diff options
Diffstat (limited to 'tests/alias')
-rw-r--r-- | tests/alias/t19349.nim | 19 | ||||
-rw-r--r-- | tests/alias/talias.nim | 8 |
2 files changed, 23 insertions, 4 deletions
diff --git a/tests/alias/t19349.nim b/tests/alias/t19349.nim new file mode 100644 index 000000000..1e1e58264 --- /dev/null +++ b/tests/alias/t19349.nim @@ -0,0 +1,19 @@ +discard """ + action: "compile" +""" + +type + Vec3[T: SomeNumber] = object + arr: array[3, T] + +var + cfloatArr: array[3, array[3, cfloat]] + cfloatSeq = newSeq[Vec3[cfloat]]() +for row in cfloatArr: + cfloatSeq.add(Vec3[float32](arr: [row[0], row[1], row[2]])) + +var + cuintArr: array[3, array[3, cuint]] + cuintSeq = newSeq[Vec3[cuint]]() +for row in cuintArr: + cuintSeq.add(Vec3[uint32](arr: [row[0], row[1], row[2]])) diff --git a/tests/alias/talias.nim b/tests/alias/talias.nim index 810ea2095..a8f1b0dd0 100644 --- a/tests/alias/talias.nim +++ b/tests/alias/talias.nim @@ -8,17 +8,17 @@ proc isPartOf*[S, T](a: S, b: T): TAnalysisResult {. magic: "IsPartOf", noSideEffect.} ## not yet exported properly. -template compileTimeAssert(cond: expr) = +template compileTimeAssert(cond) = when not cond: {.compile: "is false: " & astToStr(cond).} -template `<|` (a, b: expr) = +template `<|` (a, b) = compileTimeAssert isPartOf(a, b) == arYes -template `!<|` (a, b: expr) = +template `!<|` (a, b) = compileTimeAssert isPartOf(a, b) == arNo -template `?<|` (a, b: expr) = +template `?<|` (a, b) = compileTimeAssert isPartOf(a, b) == arMaybe type |