Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invalid "When used with a type, 'not' can be followed only by 'nil'" #23565

Open
etan-status opened this issue May 3, 2024 · 0 comments
Open
Labels

Comments

@etan-status
Copy link
Contributor

etan-status commented May 3, 2024

Description

func foo: bool =
  true

const bar = block:
  type T = int
  not foo()

echo $bar

Nim Version

% nim -v
Nim Compiler Version 2.0.5 [MacOSX: amd64]
Compiled at 2024-05-03
Copyright (c) 2006-2023 by Andreas Rumpf

git hash: fcb8461efab2ef7bdd976f82af8c7d1390f502ac
active boot switches: -d:release
% nim -v      
Nim Compiler Version 1.6.20 [MacOSX: amd64]
Compiled at 2024-04-29
Copyright (c) 2006-2023 by Andreas Rumpf

git hash: 19fdbfc173bfccb64cb64e0a963e69f52f71fc73
active boot switches: -d:release

Current Output

Error: Invalid syntax. When used with a type, 'not' can be followed only by 'nil'

Expected Output

false

Possible Solution

Do the not portion in a separate step, or put the T definition outside the block (not always possible, e.g., if when is inside block and T only works inside when).

Additional Information

No response

@metagn metagn added the Parser label May 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants