treat do with pragmas but no parens as proc (#19191)

fixes #19188
This commit is contained in:
hlaaftana 2021-12-05 08:44:22 +03:00 • committed by GitHub
commit 1ef945668d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 30 additions and 9 deletions

View file

@ -1,8 +1,12 @@
discard """
output: '''true
output: '''
true
true
true inner B'''
true
true inner B
running with pragma
ran with pragma
'''
"""
template withValue(a, b, c, d, e: untyped) =
@ -77,3 +81,14 @@ proc main2 =
echo "true inner B"
main2()
proc withPragma(foo: int, bar: proc() {.raises: [].}) =
echo "running with pragma"
bar()
withPragma(3) do {.raises: [].}:
echo "ran with pragma"
doAssert not (compiles do:
withPragma(3) do {.raises: [].}:
raise newException(Exception))