Skip to content

Commit

Permalink
enable "bug 9" test too
Browse files Browse the repository at this point in the history
  • Loading branch information
metagn committed Jun 11, 2023
1 parent f68e869 commit 865c7a5
Showing 1 changed file with 10 additions and 15 deletions.
25 changes: 10 additions & 15 deletions tests/lexer/tcustom_numeric_literals.nim
Original file line number Diff line number Diff line change
Expand Up @@ -162,21 +162,16 @@ template main =
doAssert fn2() == "[[-12]]"
doAssert fn3() == "[[-12]]"

when false: # xxx this fails; bug 9 from https://github.com/nim-lang/Nim/pull/17020#issuecomment-803193947
#[
possible workaround: use `genAst` (https://github.com/nim-lang/Nim/pull/17426) and this:
let a3 = `'wrap3`("-128")
]#
block:
macro metawrap(): untyped =
func wrap1(a: string): string = "{" & a & "}"
func `'wrap3`(a: string): string = "{" & a & "}"
result = quote do:
let a1 = wrap1"-128"
let a2 = -128'wrap3
metawrap()
doAssert a1 == "{-128}"
doAssert a2 == "{-128}"
block: # bug 9 from https://github.com/nim-lang/Nim/pull/17020#issuecomment-803193947
macro metawrap(): untyped =
func wrap1(a: string): string = "{" & a & "}"
func `'wrap3`(a: string): string = "{" & a & "}"
result = quote do:
let a1 {.inject.} = wrap1"-128"
let a2 {.inject.} = -128'wrap3
metawrap()
doAssert a1 == "{-128}"
doAssert a2 == "{-128}"

static: main()
main()

0 comments on commit 865c7a5

Please sign in to comment.