diff options
author | ringabout <43030857+ringabout@users.noreply.github.com> | 2022-09-21 16:29:39 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-09-21 10:29:39 +0200 |
commit | e0c1159fb3f1f392698f071485d3e43e1e7f1a36 (patch) | |
tree | 5c449c2d99b4402a42e0597d43c57bfbd38c7415 | |
parent | de70128fccba242af9b0c6fa0840d03d3566e58d (diff) | |
download | Nim-e0c1159fb3f1f392698f071485d3e43e1e7f1a36.tar.gz |
fixes #20391; make of operator work with generics for ORC (#20395)
-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]) |