From 65319ba22db90e821c3e29091b10df8f84b3714b Mon Sep 17 00:00:00 2001 From: Araq Date: Sun, 17 Mar 2013 23:40:03 +0100 Subject: [PATCH] fixes #332 --- compiler/cgmeth.nim | 4 ++-- tests/run/tmethods1.nim | 12 ++++++++++++ 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/compiler/cgmeth.nim b/compiler/cgmeth.nim index e7bd54ef0..33bb94b38 100644 --- a/compiler/cgmeth.nim +++ b/compiler/cgmeth.nim @@ -108,8 +108,8 @@ proc methodDef*(s: PSym, fromCache: bool) = proc relevantCol(methods: TSymSeq, col: int): bool = # returns true iff the position is relevant - var t = methods[0].typ.sons[col] - if skipTypes(t, skipPtrs).kind == tyObject: + var t = methods[0].typ.sons[col].skipTypes(skipPtrs) + if t.kind == tyObject: for i in countup(1, high(methods)): let t2 = skipTypes(methods[i].typ.sons[col], skipPtrs) if not SameType(t2, t): diff --git a/tests/run/tmethods1.nim b/tests/run/tmethods1.nim index adcca9e19..f4add6af4 100644 --- a/tests/run/tmethods1.nim +++ b/tests/run/tmethods1.nim @@ -5,6 +5,18 @@ discard """ method somethin(obj: TObject) = echo "do nothing" +type + TNode* = object {.inheritable.} + PNode* = ref TNode + + PNodeFoo* = ref object of TNode + + TSomethingElse = object + PSomethingElse = ref TSomethingElse + +method foo(a: PNode, b: PSomethingElse) = nil +method foo(a: PNodeFoo, b: PSomethingElse) = nil + var o: TObject o.somethin()