mirror of
https://github.com/nim-lang/Nim.git
synced 2026-02-26 12:55:06 +00:00
fixes #4658
This commit is contained in:
@@ -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")
|
||||
Reference in New Issue
Block a user