diff options
-rw-r--r-- | compiler/ccgtypes.nim | 2 | ||||
-rw-r--r-- | tests/method/tmethod_issues.nim | 8 |
2 files changed, 9 insertions, 1 deletions
diff --git a/compiler/ccgtypes.nim b/compiler/ccgtypes.nim index 16768685b..654e266ba 100644 --- a/compiler/ccgtypes.nim +++ b/compiler/ccgtypes.nim @@ -1280,7 +1280,7 @@ proc genTypeInfo2Name(m: BModule; t: PType): Rope = var it = t while it != nil: it = it.skipTypes(skipPtrs) - if it.sym != nil: + if it.sym != nil and tfFromGeneric notin it.flags: var m = it.sym.owner while m != nil and m.kind != skModule: m = m.owner if m == nil or sfSystemModule in m.flags: diff --git a/tests/method/tmethod_issues.nim b/tests/method/tmethod_issues.nim index 07d4635f6..daaa46522 100644 --- a/tests/method/tmethod_issues.nim +++ b/tests/method/tmethod_issues.nim @@ -160,3 +160,11 @@ proc main() = main() +block: # bug #20391 + type Container[T] = ref object of RootRef + item: T + + let a = Container[int]() + + doAssert a of Container[int] + doAssert not (a of Container[string]) |