diff options
author | Araq <rumpf_a@web.de> | 2015-08-02 01:17:23 +0200 |
---|---|---|
committer | Araq <rumpf_a@web.de> | 2015-08-02 02:56:00 +0200 |
commit | 41e8c9b9acc16f65166648aaba38408dad42e7bc (patch) | |
tree | ad2c09fce6777e7dcb4759a783036e3e02f7e286 /compiler | |
parent | 5e325bc9f9be68841ce1aef6b64aada2aeb52918 (diff) | |
download | Nim-41e8c9b9acc16f65166648aaba38408dad42e7bc.tar.gz |
fixes #3158
Diffstat (limited to 'compiler')
-rw-r--r-- | compiler/sem.nim | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/compiler/sem.nim b/compiler/sem.nim index d23dd1543..041524f84 100644 --- a/compiler/sem.nim +++ b/compiler/sem.nim @@ -171,11 +171,15 @@ proc newSymS(kind: TSymKind, n: PNode, c: PContext): PSym = result = newSym(kind, considerQuotedIdent(n), getCurrOwner(), n.info) proc newSymG*(kind: TSymKind, n: PNode, c: PContext): PSym = + proc `$`(kind: TSymKind): string = substr(system.`$`(kind), 2).toLower + # like newSymS, but considers gensym'ed symbols if n.kind == nkSym: # and sfGenSym in n.sym.flags: result = n.sym - internalAssert result.kind == kind + if result.kind != kind: + localError(n.info, "cannot use symbol of kind '" & + $result.kind & "' as a '" & $kind & "'") # when there is a nested proc inside a template, semtmpl # will assign a wrong owner during the first pass over the # template; we must fix it here: see #909 |