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

Error: undeclared identifier: '|' when using | inside a runnableExamples: #8694

Closed
timotheecour opened this issue Aug 20, 2018 · 0 comments · Fixed by #9131
Closed

Error: undeclared identifier: '|' when using | inside a runnableExamples: #8694

timotheecour opened this issue Aug 20, 2018 · 0 comments · Fixed by #9131

Comments

@timotheecour
Copy link
Member

timotheecour commented Aug 20, 2018

when defined(case1):
  # Error: undeclared identifier: '|'
  proc bar[T](t:T): bool =
    runnableExamples:
      type Foo = int | float
    true
  echo bar(0)

when defined(case2):
  # ok
  proc bar(t:int): bool =
    runnableExamples:
      type Foo = int | float
    true
  echo bar(0)

when defined(case3):
  # Error: undeclared identifier: '|'
  proc bar(t:typedesc): bool =
    runnableExamples:
      type Foo = int | float
    true
  echo bar(int)

EDIT : fixed case3 test
EDIT: verified it all works!

@Araq Araq closed this as completed in 4cf704b Sep 2, 2018
LemonBoy added a commit to LemonBoy/Nim that referenced this issue Sep 30, 2018
The examples should not enter the generic analysis at all.
The regression was introduced in 4cf704b as a fix for nim-lang#8694.

Fixes nim-lang#9130
Fixes nim-lang#8694
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant