summary refs log tree commit diff stats
path: root/compiler/sem.nim
diff options
context:
space:
mode:
authorJacek Sieka <arnetheduck@gmail.com>2016-04-26 21:25:57 +0800
committerJacek Sieka <arnetheduck@gmail.com>2016-04-26 21:25:57 +0800
commitba1a52614b3feccaadadebf45cf897192902ed4d (patch)
treecd66f3d4ba01d25499aa452e68cd34c192804e9c /compiler/sem.nim
parenta2501321c39a89fb0bad52dcb8ef7c974d4ae5d2 (diff)
parente31ec746b96ef185d9f5fa6276518949fa889e5a (diff)
downloadNim-ba1a52614b3feccaadadebf45cf897192902ed4d.tar.gz
Merge remote-tracking branch 'origin/devel' into malloc-store-size
Diffstat (limited to 'compiler/sem.nim')
-rw-r--r--compiler/sem.nim5
1 files changed, 4 insertions, 1 deletions
diff --git a/compiler/sem.nim b/compiler/sem.nim
index e09d49f88..97a20a4da 100644
--- a/compiler/sem.nim
+++ b/compiler/sem.nim
@@ -67,9 +67,12 @@ template semIdeForTemplateOrGeneric(c: PContext; n: PNode;
 
 proc typeMismatch(n: PNode, formal, actual: PType) =
   if formal.kind != tyError and actual.kind != tyError:
+    let named = typeToString(formal)
+    let desc = typeToString(formal, preferDesc)
+    let x = if named == desc: named else: named & " = " & desc
     localError(n.info, errGenerated, msgKindToString(errTypeMismatch) &
         typeToString(actual) & ") " &
-        `%`(msgKindToString(errButExpectedX), [typeToString(formal)]))
+        `%`(msgKindToString(errButExpectedX), [x]))
 
 proc fitNode(c: PContext, formal: PType, arg: PNode): PNode =
   if arg.typ.isNil: