This commit is contained in:
araq
2026-05-29 07:50:21 +02:00
parent f4dd00c4cc
commit 0aa623fcf7
2 changed files with 7 additions and 2 deletions

View File

@@ -791,8 +791,12 @@ proc procParamTypeRel(c: var TCandidate; f, a: PType): TTypeRelation =
# different C types (size_t vs unsigned long long).
let fCheck = concreteType(c, f)
let aCheck = concreteType(c, a)
# `tfVarIsPtr` is an internal lowering artifact set during a proc's body
# analysis; a `proc` type literal's `var`/`lent` return never carries it,
# so `IgnoreFlags` keeps it from blocking matching `var T` against `var T`.
# The var/lent consistency itself is handled by `inconsistentVarTypes` below.
if fCheck != nil and aCheck != nil and
not sameBackendTypePickyAliases(fCheck, aCheck):
not sameBackendTypePickyAliases(fCheck, aCheck, {IgnoreFlags}):
result = isNone
if result <= isSubrange or inconsistentVarTypes(f, a):

View File

@@ -1069,9 +1069,10 @@ proc sameBackendTypeIgnoreRange*(x, y: PType): bool =
c.cmp = dcEqIgnoreDistinct
result = sameTypeAux(x, y, c)
proc sameBackendTypePickyAliases*(x, y: PType): bool =
proc sameBackendTypePickyAliases*(x, y: PType, flags: TTypeCmpFlags = {}): bool =
var c = initSameTypeClosure()
c.flags.incl {IgnoreTupleFields, IgnoreRangeShallow, PickyCAliases, PickyBackendAliases}
c.flags.incl flags
c.cmp = dcEqIgnoreDistinct
result = sameTypeAux(x, y, c)