diff options
author | Pylgos <43234674+Pylgos@users.noreply.github.com> | 2023-12-14 17:55:04 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-12-14 09:55:04 +0100 |
commit | 1b7b0d69db41b3c5a27cca643d66c0acabbe41df (patch) | |
tree | 641aa944f06fd429fc9179386b7325897b9fef6a /tests/generics | |
parent | a3739751a8439908624815b02d8242515cb5e178 (diff) | |
download | Nim-1b7b0d69db41b3c5a27cca643d66c0acabbe41df.tar.gz |
fixes #9381; Fix double evaluation of types in generic objects (#23072)
fixes https://github.com/nim-lang/Nim/issues/9381
Diffstat (limited to 'tests/generics')
-rw-r--r-- | tests/generics/tgenerics_various.nim | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/generics/tgenerics_various.nim b/tests/generics/tgenerics_various.nim index b6ace4e7d..53661236e 100644 --- a/tests/generics/tgenerics_various.nim +++ b/tests/generics/tgenerics_various.nim @@ -238,3 +238,17 @@ block: # issue #8390 $y.type doAssert x(@[1.0]) == $1.0.type + + +block: # issue #9381 + var evalCount {.compileTime.} = 0 + + macro test(t: typed): untyped = + inc evalCount + t + + type GenericObj[T] = object + f: test(T) + + var x: GenericObj[int] + static: doAssert evalCount == 1 |