summary refs log tree commit diff stats
path: root/compiler
diff options
context:
space:
mode:
authorAndreas Rumpf <rumpf_a@web.de>2013-10-21 15:37:45 -0700
committerAndreas Rumpf <rumpf_a@web.de>2013-10-21 15:37:45 -0700
commita74a93d885de0027b576c7363036e89cf1f42d91 (patch)
tree6b6b252cd25d1263c1878491e5a3571bca79e19d /compiler
parentd94a870de4d58879a080f11ea89eb215d73ca900 (diff)
parent01e43fbe83608d4ed3ed529c995fa73e8c70bbe2 (diff)
downloadNim-a74a93d885de0027b576c7363036e89cf1f42d91.tar.gz
Merge pull request #628 from mflamer/master
fix for Issue #626 - Distinct and generics not working together
Diffstat (limited to 'compiler')
-rw-r--r--compiler/types.nim8
1 files changed, 6 insertions, 2 deletions
diff --git a/compiler/types.nim b/compiler/types.nim
index f9c40e201..f5fb6555b 100644
--- a/compiler/types.nim
+++ b/compiler/types.nim
@@ -622,6 +622,8 @@ proc initSameTypeClosure: TSameTypeClosure =
   # we do the initialization lazily for performance (avoids memory allocations)
   nil
 
+
+
 proc containsOrIncl(c: var TSameTypeClosure, a, b: PType): bool =
   result = not IsNil(c.s) and c.s.contains((a.id, b.id))
   if not result:
@@ -750,9 +752,11 @@ template IfFastObjectTypeCheckFailed(a, b: PType, body: stmt) {.immediate.} =
 
 proc sameObjectTypes*(a, b: PType): bool =
   # specialized for efficiency (sigmatch uses it)
-  IfFastObjectTypeCheckFailed(a, b):
+  IfFastObjectTypeCheckFailed(a, b):     
     var c = initSameTypeClosure()
     result = sameTypeAux(a, b, c)
+ 
+    
 
 proc sameDistinctTypes*(a, b: PType): bool {.inline.} =
   result = sameObjectTypes(a, b)
@@ -837,7 +841,7 @@ proc SameTypeAux(x, y: PType, c: var TSameTypeClosure): bool =
       result = sameObjectStructures(a, b, c) and sameFlags(a, b)
   of tyDistinct:
     CycleCheck()
-    if c.cmp == dcEq: result = sameDistinctTypes(a, b) and sameFlags(a, b)
+    if c.cmp == dcEq: result = sameTypeAux(a, b, c) and sameFlags(a, b)
     else: result = sameTypeAux(a.sons[0], b.sons[0], c) and sameFlags(a, b)
   of tyEnum, tyForward, tyProxy:
     # XXX generic enums do not make much sense, but require structural checking