summary refs log tree commit diff stats
path: root/compiler
diff options
context:
space:
mode:
Diffstat (limited to 'compiler')
-rw-r--r--compiler/sem.nim5
-rw-r--r--compiler/sigmatch.nim2
2 files changed, 5 insertions, 2 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:
diff --git a/compiler/sigmatch.nim b/compiler/sigmatch.nim
index 88fdbbf17..82f878932 100644
--- a/compiler/sigmatch.nim
+++ b/compiler/sigmatch.nim
@@ -1027,7 +1027,7 @@ proc typeRel(c: var TCandidate, f, aOrig: PType, doBind = true): TTypeRelation =
   of tyCompositeTypeClass:
     considerPreviousT:
       let roota = a.skipGenericAlias
-      let rootf = f.lastSon
+      let rootf = f.lastSon.skipGenericAlias
       if a.kind == tyGenericInst and roota.base == rootf.base:
         for i in 1 .. rootf.sonsLen-2:
           let ff = rootf.sons[i]