summary refs log tree commit diff stats
path: root/compiler/sempass2.nim
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/sempass2.nim')
-rw-r--r--compiler/sempass2.nim7
1 files changed, 6 insertions, 1 deletions
diff --git a/compiler/sempass2.nim b/compiler/sempass2.nim
index a4e1dcf00..86149330e 100644
--- a/compiler/sempass2.nim
+++ b/compiler/sempass2.nim
@@ -1083,7 +1083,12 @@ proc track(tracked: PEffects, n: PNode) =
     for i in 0..<n.safeLen: track(tracked, n[i])
 
 proc subtypeRelation(g: ModuleGraph; spec, real: PNode): bool =
-  result = safeInheritanceDiff(g.excType(real), spec.typ) <= 0
+  if spec.typ.kind == tyOr:
+    for t in spec.typ.sons:
+      if safeInheritanceDiff(g.excType(real), t) <= 0:
+        return true
+  else:
+    return safeInheritanceDiff(g.excType(real), spec.typ) <= 0
 
 proc checkRaisesSpec(g: ModuleGraph; spec, real: PNode, msg: string, hints: bool;
                      effectPredicate: proc (g: ModuleGraph; a, b: PNode): bool {.nimcall.}) =