mirror of
https://github.com/nim-lang/Nim.git
synced 2026-04-21 06:45:27 +00:00
fixes #5479
This commit is contained in:
@@ -73,7 +73,7 @@ proc sameMethodBucket(a, b: PSym): MethodResult =
|
||||
bb = bb.lastSon
|
||||
else:
|
||||
break
|
||||
if sameType(aa, bb):
|
||||
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:
|
||||
@@ -83,7 +83,7 @@ proc sameMethodBucket(a, b: PSym): MethodResult =
|
||||
result = Yes
|
||||
else:
|
||||
return No
|
||||
elif diff != high(int):
|
||||
elif diff != high(int) and sfFromGeneric notin (a.flags+b.flags):
|
||||
result = Invalid
|
||||
else:
|
||||
return No
|
||||
|
||||
@@ -373,12 +373,17 @@ proc handleGenericInvocation(cl: var TReplTypeVars, t: PType): PType =
|
||||
else:
|
||||
newbody.lastSon.typeInst = result
|
||||
cl.c.typesWithOps.add((newbody, result))
|
||||
let methods = skipTypes(bbody, abstractPtrs).methods
|
||||
for col, meth in items(methods):
|
||||
# we instantiate the known methods belonging to that type, this causes
|
||||
# them to be registered and that's enough, so we 'discard' the result.
|
||||
discard cl.c.instTypeBoundOp(cl.c, meth, result, cl.info,
|
||||
attachedAsgn, col)
|
||||
let mm = skipTypes(bbody, abstractPtrs)
|
||||
if tfFromGeneric notin mm.flags:
|
||||
# bug #5479, prevent endless recursions here:
|
||||
incl mm.flags, tfFromGeneric
|
||||
let methods = mm.methods
|
||||
for col, meth in items(methods):
|
||||
# we instantiate the known methods belonging to that type, this causes
|
||||
# them to be registered and that's enough, so we 'discard' the result.
|
||||
discard cl.c.instTypeBoundOp(cl.c, meth, result, cl.info,
|
||||
attachedAsgn, col)
|
||||
excl mm.flags, tfFromGeneric
|
||||
|
||||
proc eraseVoidParams*(t: PType) =
|
||||
# transform '(): void' into '()' because old parts of the compiler really
|
||||
|
||||
Reference in New Issue
Block a user