diff options
author | metagn <metagngn@gmail.com> | 2024-01-18 16:50:36 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-01-18 14:50:36 +0100 |
commit | 322433755058eae481f4e92b2070e886f097bd9f (patch) | |
tree | 0a758c0b1709a96ec477ea931898695d39579b6b /tests/vm | |
parent | 473f259268d03f87874c674c08c74cf32da11d4a (diff) | |
download | Nim-322433755058eae481f4e92b2070e886f097bd9f.tar.gz |
give typedesc param nodes type T not typedesc[T] [backport:2.0] (#23115)
fixes https://github.com/nim-lang/Nim/issues/23112, fixes a mistake in https://github.com/nim-lang/Nim/pull/22581 This makes `getType(t)` where `t` is a typedesc param with value `T` equal to `getType(T)`.
Diffstat (limited to 'tests/vm')
-rw-r--r-- | tests/vm/ttypedesc.nim | 13 | ||||
-rw-r--r-- | tests/vm/tvmmisc.nim | 3 |
2 files changed, 14 insertions, 2 deletions
diff --git a/tests/vm/ttypedesc.nim b/tests/vm/ttypedesc.nim index a112584c5..d799e5adb 100644 --- a/tests/vm/ttypedesc.nim +++ b/tests/vm/ttypedesc.nim @@ -16,3 +16,16 @@ block: # issue #15760 doAssert x[SpecialBanana]() == "SpecialBanana" doAssert y(SpecialBanana) == "SpecialBanana" + +import macros + +block: # issue #23112 + type Container = object + foo: string + + proc canBeImplicit(t: typedesc) {.compileTime.} = + let tDesc = getType(t) + doAssert tDesc.kind == nnkObjectTy + + static: + canBeImplicit(Container) diff --git a/tests/vm/tvmmisc.nim b/tests/vm/tvmmisc.nim index cade68577..f277c20d8 100644 --- a/tests/vm/tvmmisc.nim +++ b/tests/vm/tvmmisc.nim @@ -4,8 +4,7 @@ import os # bug #4462 block: proc foo(t: typedesc) {.compileTime.} = - assert sameType(getType(t), getType(typedesc[int])) - assert sameType(getType(t), getType(type int)) + assert sameType(getType(t), getType(int)) static: foo(int) |