-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix incorrect inheritance penalty for some objects #24144
Conversation
compiler/sigmatch.nim
Outdated
@@ -1528,7 +1528,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 tfInheritable in f.flags: 0 else: -1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tfInheritable
isn't always defined for objects with inheritance, but tfFinal
is for objects without inheritance. Checking this instead should work.
Thanks for your hard work on this PR! Hint: mm: orc; opt: speed; options: -d:release |
This fixes a logic error in nim-lang#23870 The inheritance penalty should be -1 if there is no inheritance relationship. Not sure how to write a test case for this one honestly. --------- Co-authored-by: Andreas Rumpf <[email protected]>
This fixes a logic error in #23870 The inheritance penalty should be -1 if there is no inheritance relationship. Not sure how to write a test case for this one honestly. --------- Co-authored-by: Andreas Rumpf <[email protected]> (cherry picked from commit 37dba85)
This fixes a logic error in #23870
The inheritance penalty should be -1 if there is no inheritance relationship. Not sure how to write a test case for this one honestly.