diff --git a/compiler/sigmatch.nim b/compiler/sigmatch.nim index 96cbc6359bd6d..f09fd6b69fe95 100644 --- a/compiler/sigmatch.nim +++ b/compiler/sigmatch.nim @@ -1540,7 +1540,7 @@ proc typeRel(c: var TCandidate, f, aOrig: PType, reduceToBase(a) if effectiveArgType.kind == tyObject: if sameObjectTypes(f, effectiveArgType): - c.inheritancePenalty = 0 + c.inheritancePenalty = if tfFinal in f.flags: -1 else: 0 result = isEqual # elif tfHasMeta in f.flags: result = recordRel(c, f, a) elif trIsOutParam notin flags: