blob: d799e5adb04e69de5a5584a0b5db7e3ae094d966 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
block: # issue #15760
type
Banana = object
SpecialBanana = object
proc getName(_: type Banana): string = "Banana"
proc getName(_: type SpecialBanana): string = "SpecialBanana"
proc x[T](): string =
const n = getName(T) # this one works
result = n
proc y(T: type): string =
const n = getName(T) # this one failed to compile
result = n
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)
|