Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion compiler/semexprs.nim
Original file line number Diff line number Diff line change
Expand Up @@ -1105,7 +1105,7 @@ proc semIndirectOp(c: PContext, n: PNode, flags: TExprFlags; expectedType: PType
let t = n[0].typ
if t != nil and t.kind in {tyVar, tyLent}:
n[0] = newDeref(n[0])
elif isSymChoice(n[0]) and nfDotField notin n.flags:
elif (isSymChoice(n[0]) or (n[0].kind == nkSym and isGenericRoutineStrict(n[0].sym))) and nfDotField notin n.flags:
# overloaded generic procs e.g. newSeq[int] can end up here
return semDirectOp(c, n, flags, expectedType)

Expand Down
13 changes: 13 additions & 0 deletions compiler/sempass2.nim
Original file line number Diff line number Diff line change
Expand Up @@ -1077,6 +1077,19 @@ proc trackCall(tracked: PEffects; n: PNode) =
if n.typ != nil:
if tracked.owner.kind != skMacro and n.typ.skipTypes(abstractVar).kind != tyOpenArray:
createTypeBoundOps(tracked, n.typ, n.info)
if tracked.c.matchedConcept == nil and a.kind == nkSym:
if a.sym.isGenericRoutineStrict() and a.sym.magic notin {mSizeOf, mZeroDefault, mTypeOf}:
# this error is likely a compiler bug

# it is not instantiated if there is an error
var hasErrorType = false
for i in 1..<n.len:
let nt = n[i].typ
if nt.kind == tyError:
hasErrorType = true
break
if not hasErrorType:
localError(tracked.config, a.info, "calling generic procedure without instantiation: $1" % a.sym.name.s)

when defined(nimsuggest):
var actualLoc = a.info
Expand Down
Loading