diff options
author | Timothee Cour <timothee.cour2@gmail.com> | 2020-03-18 05:43:32 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-03-18 13:43:32 +0100 |
commit | ed263e174e7f9a7bce1863dc57979c1a752d2e66 (patch) | |
tree | d40b6cd68e9dff8abc0738109d95d19f648da4d5 /tests/generics/t13525.nim | |
parent | a87062393a7acef21b911dbd356b675061a671ab (diff) | |
download | Nim-ed263e174e7f9a7bce1863dc57979c1a752d2e66.tar.gz |
fix #13524 astToStr now works inside generics (#13681)
Diffstat (limited to 'tests/generics/t13525.nim')
-rw-r--r-- | tests/generics/t13525.nim | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/tests/generics/t13525.nim b/tests/generics/t13525.nim new file mode 100644 index 000000000..d1b8df78c --- /dev/null +++ b/tests/generics/t13525.nim @@ -0,0 +1,6 @@ +# https://github.com/nim-lang/Nim/issues/13524 +template fun(field): untyped = astToStr(field) +proc test1(): string = fun(nonexistant1) +proc test2[T](): string = fun(nonexistant2) # used to cause: Error: undeclared identifier: 'nonexistant2' +doAssert test1() == "nonexistant1" +doAssert test2[int]() == "nonexistant2" |