Open Wh1teDuke opened 5 years ago
Regression?
Not that I'm aware of. Const block inside a proc doesn't play well
proc test =
const TEST = block:
let i = 0 # Error here too
i
see also duplicate issue that involves templates (the more common case where you'll encounter this bug) but it's the same problem
https://github.com/nim-lang/Nim/issues/13795
raising to medium priority, it keeps arising in various forms (mostly via templates, eg toSeq)
import strutils
proc example =
# ... imagine lots of code ...
# suddenly, a long string!
when true:
# some indentation levels
const str = """
This is an example.
It's indented to look nice.
<-- but no spaces, please.
""".dedent
echo str
when false:
discard # more code
example()
It's disappointing that this requires a let
Just bumped into this. It's a bit annoying as this prevents limiting the scope of a constant.
Test
Error