Prevent crash on pragma templates w/ generics (#10685)

* Prevent crash on pragma templates w/ generics

* Remove incorrect call to pragma reconversion

`semOverloadedCall` may return a node with more elements than the
original nkCall node had (implicit and/or explicit generics).
This commit is contained in:
LemonBoy
2019-02-18 12:17:00 +01:00
committed by Andreas Rumpf
parent 8b39551fca
commit cf32d61fa5
3 changed files with 26 additions and 11 deletions

View File

@@ -233,3 +233,10 @@ block:
doAssert ps.first == ps[0] and ps.first == "one"
doAssert ps.second == ps[1] and ps.second == 2
doAssert ps.third == ps[2] and ps.third == 3.0
# pragma with implicit&explicit generic types
block:
template fooBar[T](x: T; c: static[int] = 42; m: char) {.pragma.}
var e {.fooBar("foo", 123, 'u').}: int
doAssert(hasCustomPragma(e, fooBar))
doAssert(getCustomPragmaVal(e, fooBar).c == 123)