This commit is contained in:
parent
268a1f7cfd
commit
0d8a503e45
2 changed files with 16 additions and 3 deletions
|
|
@ -51,10 +51,10 @@ template macroToExpand(s): untyped =
|
||||||
s.kind in {skMacro, skTemplate} and (s.typ.len == 1 or sfAllUntyped in s.flags)
|
s.kind in {skMacro, skTemplate} and (s.typ.len == 1 or sfAllUntyped in s.flags)
|
||||||
|
|
||||||
template macroToExpandSym(s): untyped =
|
template macroToExpandSym(s): untyped =
|
||||||
s.kind in {skMacro, skTemplate} and (s.typ.len == 1)
|
s.kind in {skMacro, skTemplate} and (s.typ.len == 1) and not fromDotExpr
|
||||||
|
|
||||||
proc semGenericStmtSymbol(c: PContext, n: PNode, s: PSym,
|
proc semGenericStmtSymbol(c: PContext, n: PNode, s: PSym,
|
||||||
ctx: var GenericCtx): PNode =
|
ctx: var GenericCtx; fromDotExpr=false): PNode =
|
||||||
semIdeForTemplateOrGenericCheck(n, ctx.cursorInBody)
|
semIdeForTemplateOrGenericCheck(n, ctx.cursorInBody)
|
||||||
incl(s.flags, sfUsed)
|
incl(s.flags, sfUsed)
|
||||||
case s.kind
|
case s.kind
|
||||||
|
|
@ -145,7 +145,7 @@ proc fuzzyLookup(c: PContext, n: PNode, flags: TSemGenericFlags,
|
||||||
elif s.name.id in ctx.toMixin:
|
elif s.name.id in ctx.toMixin:
|
||||||
result = newDot(result, symChoice(c, n, s, scForceOpen))
|
result = newDot(result, symChoice(c, n, s, scForceOpen))
|
||||||
else:
|
else:
|
||||||
let syms = semGenericStmtSymbol(c, n, s, ctx)
|
let syms = semGenericStmtSymbol(c, n, s, ctx, fromDotExpr=true)
|
||||||
if syms.kind == nkSym:
|
if syms.kind == nkSym:
|
||||||
let choice = symChoice(c, n, s, scForceOpen)
|
let choice = symChoice(c, n, s, scForceOpen)
|
||||||
choice.kind = nkClosedSymChoice
|
choice.kind = nkClosedSymChoice
|
||||||
|
|
|
||||||
|
|
@ -14,3 +14,16 @@ proc arrayItem(a: ArrayType): auto =
|
||||||
var arr: ArrayType[int]
|
var arr: ArrayType[int]
|
||||||
echo arrayItem(arr)
|
echo arrayItem(arr)
|
||||||
|
|
||||||
|
# bug #5597
|
||||||
|
|
||||||
|
template fail() = "what"
|
||||||
|
|
||||||
|
proc g[T](x: var T) =
|
||||||
|
x.fail = 3
|
||||||
|
|
||||||
|
type
|
||||||
|
Obj = object
|
||||||
|
fail: int
|
||||||
|
|
||||||
|
var y: Obj
|
||||||
|
g y
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue