diff options
author | Andreas Rumpf <rumpf_a@web.de> | 2019-05-24 18:33:53 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-05-24 18:33:53 +0200 |
commit | ef8ddef47b6ea10c6e5e504165245ab514391056 (patch) | |
tree | aa1d68dfd81bef608f033af9b25daba96e97e613 /compiler | |
parent | d67a9f024eeeb2bc26fb38a98be9a53956003290 (diff) | |
download | Nim-ef8ddef47b6ea10c6e5e504165245ab514391056.tar.gz |
fixes #10912 (#11317)
* fixes #10912 * update the tutorial examples
Diffstat (limited to 'compiler')
-rw-r--r-- | compiler/cgmeth.nim | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/compiler/cgmeth.nim b/compiler/cgmeth.nim index db548ccc9..ab406bc4b 100644 --- a/compiler/cgmeth.nim +++ b/compiler/cgmeth.nim @@ -56,7 +56,7 @@ proc methodCall*(n: PNode; conf: ConfigRef): PNode = type MethodResult = enum No, Invalid, Yes -proc sameMethodBucket(a, b: PSym): MethodResult = +proc sameMethodBucket(a, b: PSym; multiMethods: bool): MethodResult = if a.name.id != b.name.id: return if sonsLen(a.typ) != sonsLen(b.typ): return @@ -75,7 +75,7 @@ proc sameMethodBucket(a, b: PSym): MethodResult = if sameType(a.typ.sons[i], b.typ.sons[i]): if aa.kind == tyObject and result != Invalid: result = Yes - elif aa.kind == tyObject and bb.kind == tyObject: + elif aa.kind == tyObject and bb.kind == tyObject and (i == 1 or multiMethods): let diff = inheritanceDiff(bb, aa) if diff < 0: if result != Invalid: @@ -162,7 +162,7 @@ proc methodDef*(g: ModuleGraph; s: PSym, fromCache: bool) = var witness: PSym for i in 0 ..< L: let disp = g.methods[i].dispatcher - case sameMethodBucket(disp, s) + case sameMethodBucket(disp, s, multimethods = optMultiMethods in g.config.globalOptions) of Yes: add(g.methods[i].methods, s) attachDispatcher(s, disp.ast[dispatcherPos]) |