fixes #4658
This commit is contained in:
parent
b9322010e9
commit
89f3e21fc8
2 changed files with 18 additions and 0 deletions
|
|
@ -1396,6 +1396,11 @@ proc semMacroDef(c: PContext, n: PNode): PNode =
|
|||
if namePos >= result.safeLen: return result
|
||||
var s = result.sons[namePos].sym
|
||||
var t = s.typ
|
||||
var allUntyped = true
|
||||
for i in 1 .. t.n.len-1:
|
||||
let param = t.n.sons[i].sym
|
||||
if param.typ.kind != tyExpr: allUntyped = false
|
||||
if allUntyped: incl(s.flags, sfAllUntyped)
|
||||
if t.sons[0] == nil: localError(n.info, errXNeedsReturnType, "macro")
|
||||
if n.sons[bodyPos].kind == nkEmpty:
|
||||
localError(n.info, errImplOfXexpected, s.name.s)
|
||||
|
|
|
|||
13
tests/generics/tlamba_in_generic.nim
Normal file
13
tests/generics/tlamba_in_generic.nim
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
discard """
|
||||
output: '''!!Hi!!'''
|
||||
"""
|
||||
# bug #4658
|
||||
import future
|
||||
|
||||
var x = 123
|
||||
|
||||
proc twice[T](f: T -> T): T -> T = (x: T) => f(f(x))
|
||||
|
||||
proc quote(s: string): string = "!" & s & "!"
|
||||
|
||||
echo twice(quote)("Hi")
|
||||
Loading…
Add table
Add a link
Reference in a new issue