From 584fd7d436c02183e1164808c81f3013d3b3d1f0 Mon Sep 17 00:00:00 2001 From: Ryan McConnell Date: Fri, 20 Sep 2024 02:05:34 -0400 Subject: [PATCH 1/3] edge case --- compiler/sigmatch.nim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler/sigmatch.nim b/compiler/sigmatch.nim index a48e79b7c6ea3..708d2da5ee71e 100644 --- a/compiler/sigmatch.nim +++ b/compiler/sigmatch.nim @@ -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 result = isEqual # elif tfHasMeta in f.flags: result = recordRel(c, f, a) elif trIsOutParam notin flags: From 7ee213dfbf54e55e2bebd7a22d5473cd387401a4 Mon Sep 17 00:00:00 2001 From: Andreas Rumpf Date: Fri, 20 Sep 2024 14:53:38 +0200 Subject: [PATCH 2/3] Update compiler/sigmatch.nim --- compiler/sigmatch.nim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler/sigmatch.nim b/compiler/sigmatch.nim index 708d2da5ee71e..0ed3f60c0f5ba 100644 --- a/compiler/sigmatch.nim +++ b/compiler/sigmatch.nim @@ -1528,7 +1528,7 @@ proc typeRel(c: var TCandidate, f, aOrig: PType, reduceToBase(a) if effectiveArgType.kind == tyObject: if sameObjectTypes(f, effectiveArgType): - c.inheritancePenalty = if tfInheritable in f.flags: 0 else: -1 + c.inheritancePenalty = if tfFinal in f.flags: 0 else: -1 result = isEqual # elif tfHasMeta in f.flags: result = recordRel(c, f, a) elif trIsOutParam notin flags: From ab1ce6e379e09096a25155066eeff4ad8a3fa602 Mon Sep 17 00:00:00 2001 From: Ryan McConnell Date: Fri, 20 Sep 2024 09:43:24 -0400 Subject: [PATCH 3/3] swap terms --- compiler/sigmatch.nim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler/sigmatch.nim b/compiler/sigmatch.nim index 0ed3f60c0f5ba..ce202bebf55b0 100644 --- a/compiler/sigmatch.nim +++ b/compiler/sigmatch.nim @@ -1528,7 +1528,7 @@ proc typeRel(c: var TCandidate, f, aOrig: PType, reduceToBase(a) if effectiveArgType.kind == tyObject: if sameObjectTypes(f, effectiveArgType): - c.inheritancePenalty = if tfFinal in f.flags: 0 else: -1 + 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: