mirror of
https://github.com/nim-lang/Nim.git
synced 2026-04-18 13:30:33 +00:00
fixes, test
This commit is contained in:
@@ -1902,7 +1902,7 @@ proc skipGenericOwner*(s: PSym): PSym =
|
||||
|
||||
proc originatingModule*(s: PSym): PSym =
|
||||
result = s
|
||||
while result.kind != skModule: result = result.owner
|
||||
while result != nil and result.kind != skModule: result = result.owner
|
||||
|
||||
proc isRoutine*(s: PSym): bool {.inline.} =
|
||||
result = s.kind in skProcKinds
|
||||
|
||||
@@ -2622,8 +2622,8 @@ proc semProcAux(c: PContext, n: PNode, kind: TSymKind,
|
||||
proc determineType(c: PContext, s: PSym) =
|
||||
if s.typ != nil: return
|
||||
#if s.magic != mNone: return
|
||||
if s.ast.isNil and sfForward notin s.flags:
|
||||
globalError(c.config, s.info, errIllFormedAstX, "symbol of kind " & $s.kind)
|
||||
if s.ast.isNil and sfForward notin s.flags:
|
||||
globalError(c.config, s.info, errIllFormedAstX, "symbol of kind " & $s.kind & " has no implementation")
|
||||
discard semProcAux(c, s.ast, s.kind, {})
|
||||
|
||||
proc semIterator(c: PContext, n: PNode): PNode =
|
||||
|
||||
@@ -2184,7 +2184,7 @@ proc rawExecute(c: PCtx, start: int, tos: PStackFrame): TFullReg =
|
||||
else: regs[rc].node.strVal
|
||||
if k < 0 or k > ord(high(TSymKind)):
|
||||
internalError(c.config, c.debug[pc], "request to create symbol of invalid kind")
|
||||
var sym = newSym(k.TSymKind, getIdent(c.cache, name), c.idgen, c.module, c.debug[pc])
|
||||
var sym = newSym(k.TSymKind, getIdent(c.cache, name), c.idgen, c.module.owner, c.debug[pc])
|
||||
incl(sym.flags, sfGenSym)
|
||||
regs[ra].node = newSymNode(sym)
|
||||
regs[ra].node.flags.incl nfIsRef
|
||||
|
||||
12
tests/errmsgs/tundeclaredgensym.nim
Normal file
12
tests/errmsgs/tundeclaredgensym.nim
Normal file
@@ -0,0 +1,12 @@
|
||||
# issue #15097
|
||||
|
||||
import macros
|
||||
|
||||
macro foo: untyped =
|
||||
result = newStmtList()
|
||||
let tmp = genSym(nskProc, "tmp") #[tt.Error
|
||||
^ illformed AST: symbol of kind skProc has no implementation]#
|
||||
result.add quote do:
|
||||
let bar = `tmp`()
|
||||
|
||||
foo()
|
||||
Reference in New Issue
Block a user