summary refs log tree commit diff stats
path: root/compiler
diff options
context:
space:
mode:
Diffstat (limited to 'compiler')
-rwxr-xr-xcompiler/evals.nim4
-rwxr-xr-xcompiler/types.nim18
2 files changed, 14 insertions, 8 deletions
diff --git a/compiler/evals.nim b/compiler/evals.nim
index 40f1f8e01..3ef2f4f3b 100755
--- a/compiler/evals.nim
+++ b/compiler/evals.nim
@@ -898,7 +898,7 @@ proc evalTemplate*(n: PNode, sym: PSym): PNode =
  
 proc evalTypeTrait*(n: PNode, context: PSym): PNode =
   ## XXX: This should be pretty much guaranteed to be true
-  # by the type traits procs' signitures, but until the
+  # by the type traits procs' signatures, but until the
   # code is more mature it doesn't hurt to be extra safe
   internalAssert n.sons.len >= 2 and
                  n.sons[1].sym.typ.kind == tyTypeDesc
@@ -906,7 +906,7 @@ proc evalTypeTrait*(n: PNode, context: PSym): PNode =
   let typ = n.sons[1].sym.typ.skipTypes({tyTypeDesc})
   case n.sons[0].sym.name.s
   of "name":
-    result = newStrNode(nkStrLit, typ.typeToString)
+    result = newStrNode(nkStrLit, typ.typeToString(preferExported))
     result.typ = newType(tyString, context)
     result.info = n.info
 
diff --git a/compiler/types.nim b/compiler/types.nim
index 8005ba806..3a9352a0d 100755
--- a/compiler/types.nim
+++ b/compiler/types.nim
@@ -17,7 +17,7 @@ proc lastOrd*(t: PType): biggestInt
 proc lengthOrd*(t: PType): biggestInt
 type 
   TPreferedDesc* = enum 
-    preferName, preferDesc
+    preferName, preferDesc, preferExported
 
 proc TypeToString*(typ: PType, prefer: TPreferedDesc = preferName): string
 proc getProcHeader*(sym: PSym): string
@@ -404,14 +404,14 @@ proc TypeToString(typ: PType, prefer: TPreferedDesc = preferName): string =
   if t == nil: return 
   if prefer == preferName and t.sym != nil and sfAnon notin t.sym.flags:
     if t.kind == tyInt and isIntLit(t):
-      return t.sym.Name.s & "(" & $t.n.intVal & ")"
+      return t.sym.Name.s & " literal(" & $t.n.intVal & ")"
     return t.sym.Name.s
   case t.Kind
   of tyInt:
-    if not isIntLit(t):
+    if not isIntLit(t) or prefer == preferExported:
       result = typeToStr[t.kind]
     else:
-      result = "intLit(" & $t.n.intVal & ")"
+      result = "int literal(" & $t.n.intVal & ")"
   of tyGenericBody, tyGenericInst, tyGenericInvokation:
     result = typeToString(t.sons[0]) & '['
     for i in countup(1, sonsLen(t) -1 -ord(t.kind != tyGenericInvokation)):
@@ -667,7 +667,13 @@ proc sameTuple(a, b: PType, c: var TSameTypeClosure): bool =
   if sonsLen(a) == sonsLen(b): 
     result = true
     for i in countup(0, sonsLen(a) - 1): 
-      result = SameTypeAux(a.sons[i], b.sons[i], c)
+      var x = a.sons[i]
+      var y = b.sons[i]
+      if c.ignoreTupleFields:
+        x = skipTypes(x, {tyRange})
+        y = skipTypes(y, {tyRange})
+      
+      result = SameTypeAux(x, y, c)
       if not result: return 
     if a.n != nil and b.n != nil and not c.ignoreTupleFields: 
       for i in countup(0, sonsLen(a.n) - 1): 
@@ -746,7 +752,7 @@ proc SameTypeAux(x, y: PType, c: var TSameTypeClosure): bool =
     # increases bootstrapping time from 2.4s to 3.3s on my laptop! So we cheat
     # again: Since the recursion check is only to not get caught in an endless
     # recursion, we use a counter and only if it's value is over some 
-    # threshold we perform the expansive exact cycle check:
+    # threshold we perform the expensive exact cycle check:
     if c.recCheck < 3:
       inc c.recCheck
     else: