summary refs log tree commit diff stats
path: root/compiler
diff options
context:
space:
mode:
Diffstat (limited to 'compiler')
-rw-r--r--compiler/types.nim27
1 files changed, 14 insertions, 13 deletions
diff --git a/compiler/types.nim b/compiler/types.nim
index ec310e248..a441b0ea2 100644
--- a/compiler/types.nim
+++ b/compiler/types.nim
@@ -1250,18 +1250,18 @@ proc sameTypeAux(x, y: PType, c: var TSameTypeClosure): bool =
     b = skipTypes(b.last, aliasSkipSet)
   assert(a != nil)
   assert(b != nil)
-  if a.kind != b.kind:
-    case c.cmp
-    of dcEq: return false
-    of dcEqIgnoreDistinct:
-      let distinctSkipSet = maybeSkipRange({tyDistinct, tyGenericInst})
-      a = a.skipTypes(distinctSkipSet)
-      b = b.skipTypes(distinctSkipSet)
-      if a.kind != b.kind: return false
-    of dcEqOrDistinctOf:
-      let distinctSkipSet = maybeSkipRange({tyDistinct, tyGenericInst})
-      a = a.skipTypes(distinctSkipSet)
-      if a.kind != b.kind: return false
+  case c.cmp
+  of dcEq:
+    if a.kind != b.kind: return false
+  of dcEqIgnoreDistinct:
+    let distinctSkipSet = maybeSkipRange({tyDistinct, tyGenericInst})
+    a = a.skipTypes(distinctSkipSet)
+    b = b.skipTypes(distinctSkipSet)
+    if a.kind != b.kind: return false
+  of dcEqOrDistinctOf:
+    let distinctSkipSet = maybeSkipRange({tyDistinct, tyGenericInst})
+    a = a.skipTypes(distinctSkipSet)
+    if a.kind != b.kind: return false
 
   #[
     The following code should not run in the case either side is an generic alias,
@@ -1269,7 +1269,8 @@ proc sameTypeAux(x, y: PType, c: var TSameTypeClosure): bool =
     objects ie `type A[T] = SomeObject`
   ]#
   # this is required by tunique_type but makes no sense really:
-  if x.kind == tyGenericInst and IgnoreTupleFields notin c.flags and tyDistinct != y.kind:
+  if c.cmp == dcEq and x.kind == tyGenericInst and
+      IgnoreTupleFields notin c.flags and tyDistinct != y.kind:
     let
       lhs = x.skipGenericAlias
       rhs = y.skipGenericAlias
3'>153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169
pre>
1
2
3
4
5
6
7
8
9