mirror of
https://github.com/nim-lang/Nim.git
synced 2026-05-03 20:44:46 +00:00
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)`.
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user