You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Using sum types with module specifiers typechecks inconsistently.
Example
module z:
type
A*=objectdiscard
B*=objectdiscard
C*= A | B
module z2 (or any other name, probably):
import z
whentrue:
# These work fine.discarddefault(z.A)
procf1(x: z.A) =discarddiscarddefault(z.B)
procf2(x: z.B) =discarddiscarddefault(A)
procf3(x: A) =discarddiscarddefault(B)
procf4(x: B) =discardprocf5(x: C) =discardprocf6(x: z.C | C) =discard# Doesn't compile.procf(x: z.C) =discard
Current Output
z2.nim(17, 7) Error: invalid type: 'typeof(C)' in this context: 'proc (x: typeof(C))' for proc
Tested on 1.2.12, 1.4.2, and current head:
Nim Compiler Version 1.2.12 [Linux: amd64]
Compiled at 2021-05-25
Copyright (c) 2006-2020 by Andreas Rumpf
git hash: 121628357ec7fae91335bd392f03b0e6dd249319
active boot switches: -d:release
Nim Compiler Version 1.4.2 [Linux: amd64]
Compiled at 2021-05-13
Copyright (c) 2006-2020 by Andreas Rumpf
active boot switches: -d:release
Nim Compiler Version 1.5.1 [Linux: amd64]
Compiled at 2021-05-25
Copyright (c) 2006-2021 by Andreas Rumpf
git hash: 478f717377c4cd60cfce112b8b21d58031b118b4
active boot switches: -d:release
Expected Output
Successful compilation.
The text was updated successfully, but these errors were encountered:
Using sum types with module specifiers typechecks inconsistently.
Example
module
z
:module
z2
(or any other name, probably):Current Output
z2.nim(17, 7) Error: invalid type: 'typeof(C)' in this context: 'proc (x: typeof(C))' for proc
Tested on 1.2.12, 1.4.2, and current head:
Expected Output
Successful compilation.
The text was updated successfully, but these errors were encountered: