mirror of
https://github.com/nim-lang/Nim.git
synced 2026-01-17 18:17:11 +00:00
(cherry picked from commit a7cae2bda2)
This commit is contained in:
@@ -614,8 +614,7 @@ proc procParamTypeRel(c: var TCandidate, f, a: PType): TTypeRelation =
|
||||
# if f is metatype.
|
||||
result = typeRel(c, f, a)
|
||||
|
||||
# v--- is this correct?
|
||||
if result <= isIntConv or inconsistentVarTypes(f, a):
|
||||
if result <= isSubrange or inconsistentVarTypes(f, a):
|
||||
result = isNone
|
||||
|
||||
#if result == isEqual:
|
||||
|
||||
20
tests/overload/tproc_types_dont_like_subtypes.nim
Normal file
20
tests/overload/tproc_types_dont_like_subtypes.nim
Normal 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)
|
||||
Reference in New Issue
Block a user