diff options
author | Vindaar <basti90@gmail.com> | 2018-08-27 08:35:07 +0200 |
---|---|---|
committer | Andreas Rumpf <rumpf_a@web.de> | 2018-08-27 08:35:07 +0200 |
commit | 52f03fabc12f7f0cd9ed41b55d8c03fb5319f971 (patch) | |
tree | 6a0d1688ab85d5e255ddec22597e92b27e666ddb /compiler | |
parent | 238809f50686f63206210e6e923c59243914b1e3 (diff) | |
download | Nim-52f03fabc12f7f0cd9ed41b55d8c03fb5319f971.tar.gz |
fixes #8781 by appending "_U" instead of 'U' (#8787)
Diffstat (limited to 'compiler')
-rw-r--r-- | compiler/ccgtypes.nim | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/compiler/ccgtypes.nim b/compiler/ccgtypes.nim index 59fbfc3e1..dd79f4846 100644 --- a/compiler/ccgtypes.nim +++ b/compiler/ccgtypes.nim @@ -449,7 +449,9 @@ proc genRecordFieldsAux(m: BModule, n: PNode, of nkRecCase: if n.sons[0].kind != nkSym: internalError(m.config, n.info, "genRecordFieldsAux") add(result, genRecordFieldsAux(m, n.sons[0], accessExpr, rectype, check)) - let uname = rope(mangle(n.sons[0].sym.name.s) & 'U') + # prefix mangled name with "_U" to avoid clashes with other field names, + # since identifiers are not allowed to start with '_' + let uname = rope("_U" & mangle(n.sons[0].sym.name.s)) let ae = if accessExpr != nil: "$1.$2" % [accessExpr, uname] else: uname var unionBody: Rope = nil |