diff options
-rw-r--r-- | compiler/cgen.nim | 2 | ||||
-rw-r--r-- | tests/concepts/tmisc_issues.nim | 15 |
2 files changed, 15 insertions, 2 deletions
diff --git a/compiler/cgen.nim b/compiler/cgen.nim index cd344f096..928d1fd22 100644 --- a/compiler/cgen.nim +++ b/compiler/cgen.nim @@ -288,7 +288,7 @@ type proc genRefAssign(p: BProc, dest, src: TLoc, flags: TAssignmentFlags) proc isComplexValueType(t: PType): bool {.inline.} = - let t = t.skipTypes(abstractInst) + let t = t.skipTypes(abstractInst + tyUserTypeClasses) result = t.kind in {tyArray, tySet, tyTuple, tyObject} or (t.kind == tyProc and t.callConv == ccClosure) diff --git a/tests/concepts/tmisc_issues.nim b/tests/concepts/tmisc_issues.nim index 662eba380..e21988c73 100644 --- a/tests/concepts/tmisc_issues.nim +++ b/tests/concepts/tmisc_issues.nim @@ -9,7 +9,8 @@ implicit generic generic false true --1''' +-1 +Meow''' """ # https://github.com/nim-lang/Nim/issues/1147 @@ -98,3 +99,15 @@ let b = B() echo b is A echo b.size() +# https://github.com/nim-lang/Nim/issues/7125 +type + Thing = concept x + x.hello is string + Cat = object + +proc hello(d: Cat): string = "Meow" + +proc sayHello(c: Thing) = echo(c.hello) + +var a: Thing = Cat() +a.sayHello() |