mirror of
https://github.com/nim-lang/Nim.git
synced 2026-04-20 14:25:23 +00:00
@@ -1086,8 +1086,12 @@ proc typeRel(c: var TCandidate, f, aOrig: PType, doBind = true): TTypeRelation =
|
||||
of tyBuiltInTypeClass:
|
||||
considerPreviousT:
|
||||
let targetKind = f.sons[0].kind
|
||||
if targetKind == a.skipTypes({tyRange, tyGenericInst, tyBuiltInTypeClass, tyAlias}).kind or
|
||||
(targetKind in {tyProc, tyPointer} and a.kind == tyNil):
|
||||
let effectiveArgType = a.skipTypes({tyRange, tyGenericInst,
|
||||
tyBuiltInTypeClass, tyAlias})
|
||||
let typeClassMatches = targetKind == effectiveArgType.kind and
|
||||
not effectiveArgType.isEmptyContainer
|
||||
if typeClassMatches or
|
||||
(targetKind in {tyProc, tyPointer} and effectiveArgType.kind == tyNil):
|
||||
put(c, f, a)
|
||||
return isGeneric
|
||||
else:
|
||||
|
||||
16
tests/errmsgs/t4756.nim
Normal file
16
tests/errmsgs/t4756.nim
Normal file
@@ -0,0 +1,16 @@
|
||||
discard """
|
||||
errormsg: "type mismatch: got (string, arr: seq[empty])"
|
||||
line: 15
|
||||
"""
|
||||
|
||||
# https://github.com/nim-lang/Nim/issues/4756
|
||||
|
||||
type
|
||||
Test* = ref object
|
||||
name*: string
|
||||
|
||||
proc newTest(name: string, arr: seq): Test =
|
||||
result = Test(name: name)
|
||||
|
||||
let test = newTest("test", arr = @[])
|
||||
|
||||
Reference in New Issue
Block a user