Skip to content

Commit

Permalink
declaredlocs followup: handle cannot instantiate errors
Browse files Browse the repository at this point in the history
  • Loading branch information
timotheecour committed Apr 16, 2021
1 parent 8e474fb commit 9243d2b
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions compiler/semtypes.nim
Original file line number Diff line number Diff line change
Expand Up @@ -1463,9 +1463,9 @@ proc semGeneric(c: PContext, n: PNode, s: PSym, prev: PType): PType =
matches(c, n, copyTree(n), m)

if m.state != csMatch:
let err = "cannot instantiate " & typeToString(t) & "\n" &
"got: <" & describeArgs(c, n) & ">\n" &
"but expected: <" & describeArgs(c, t.n, 0) & ">"
var err = "cannot instantiate "
err.addTypeHeader(c.config, t)
err.add "\ngot: <$1>\nbut expected: <$2>" % [describeArgs(c, n), describeArgs(c, t.n, 0)]
localError(c.config, n.info, errGenerated, err)
return newOrPrevType(tyError, prev, c)

Expand Down

0 comments on commit 9243d2b

Please sign in to comment.