fixes #16325 [backport:1.4] (#18784)

This commit is contained in:
Andreas Rumpf 2021-09-02 17:15:11 +02:00 • committed by GitHub
commit a7cae2bda2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 21 additions and 2 deletions

View file

@ -595,8 +595,7 @@ proc procParamTypeRel(c: var TCandidate, f, a: PType): TTypeRelation =
# if f is metatype. # if f is metatype.
result = typeRel(c, f, a) result = typeRel(c, f, a)
# v--- is this correct? if result <= isSubrange or inconsistentVarTypes(f, a):
if result <= isIntConv or inconsistentVarTypes(f, a):
result = isNone result = isNone
#if result == isEqual: #if result == isEqual:

View file

@ -0,0 +1,20 @@
discard """
errormsg: "got <B, proc (b: B){.closure, gcsafe, locks: 0.}>"
line: 20
"""
type
A = ref object of RootObj
B = ref object of A
P = proc (a: A)
# bug #16325
proc doThings(a: A, p: P) =
p(a)
var x = proc (b: B) {.closure.} =
echo "B"
doThings(B(), x)