Join GitHub today
GitHub is home to over 36 million developers working together to host and review code, manage projects, and build software together.Sign up
Error: undeclared identifier: '|' #9540
This error is raised sometimes depending on the number of imports.
Taken from here:
import sugar proc foo[T]: seq[int] = return lc[x | (x <- 1..10, x mod 2 == 0), int] doAssert foo[float32]() == @[2, 4, 6, 8, 10]
(Found out about it when I was doing this PR.)
Now change just the first line to:
Ok, it must be one of the three new imports. Let's find out which one:
Once again, only when all four imports are present there is the error:
import sugar, typetraits, tables, macros proc foo[T]: seq[int] = return lc[x | (x <- 1..10, x mod 2 == 0), int] # Error: undeclared identifier: '|' doAssert foo[float32]() == @[2, 4, 6, 8, 10]
Compile without an error.
I personally don't use it. But the example posted is in the tests, and depending on the number of the imports it fails.