* fixes #18059
This commit is contained in:
Andreas Rumpf 2021-06-02 13:13:23 +02:00 • committed by GitHub
commit f10eef29b5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 80 additions and 3 deletions

View file

@ -385,6 +385,23 @@ proc hasEmpty(typ: PType): bool =
for s in typ.sons:
result = result or hasEmpty(s)
proc hasUnresolvedParams(n: PNode; flags: TExprFlags): bool =
result = tfUnresolved in n.typ.flags
when false:
case n.kind
of nkSym:
result = isGenericRoutineStrict(n.sym)
of nkSymChoices:
for ch in n:
if hasUnresolvedParams(ch, flags):
return true
result = false
else:
result = false
if efOperand in flags:
if tfUnresolved notin n.typ.flags:
result = false
proc makeDeref(n: PNode): PNode =
var t = n.typ
if t.kind in tyUserTypeClasses and t.isResolvedUserTypeClass:
@ -517,7 +534,8 @@ proc semVarOrLet(c: PContext, n: PNode, symkind: TSymKind): PNode =
typ = typ.lastSon
if hasEmpty(typ):
localError(c.config, def.info, errCannotInferTypeOfTheLiteral % typ.kind.toHumanStr)
elif typ.kind == tyProc and tfUnresolved in typ.flags:
elif typ.kind == tyProc and hasUnresolvedParams(def, {}):
# tfUnresolved in typ.flags:
localError(c.config, def.info, errProcHasNoConcreteType % def.renderTree)
when false:
# XXX This typing rule is neither documented nor complete enough to