diff options
author | Zahary Karadjov <zahary@gmail.com> | 2020-04-01 04:01:25 +0300 |
---|---|---|
committer | Andreas Rumpf <rumpf_a@web.de> | 2020-04-01 19:38:44 +0200 |
commit | 08afa030756cd3209520f6db596605116bc246ac (patch) | |
tree | a239fdbd5768012790bbaba781ead07e545ae37b /compiler/sempass2.nim | |
parent | be95f8fdfac9ceb559f77b55630ca9e285fa9a2d (diff) | |
download | Nim-08afa030756cd3209520f6db596605116bc246ac.tar.gz |
The raises list can now use expressions referencing the generic params
Diffstat (limited to 'compiler/sempass2.nim')
-rw-r--r-- | compiler/sempass2.nim | 7 |
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.}) = |