mirror of
https://github.com/nim-lang/Nim.git
synced 2025-12-31 10:22:15 +00:00
* fix #7658
* more
(cherry picked from commit 17f08b2939)
This commit is contained in:
@@ -1110,9 +1110,12 @@ proc singlePragma(c: PContext, sym: PSym, n: PNode, i: var int,
|
||||
else:
|
||||
sym.typ.kind = tyUncheckedArray
|
||||
of wUnion:
|
||||
noVal(c, it)
|
||||
if sym.typ == nil: invalidPragma(c, it)
|
||||
else: incl(sym.typ.flags, tfUnion)
|
||||
if c.config.backend == backendJs:
|
||||
localError(c.config, it.info, "`{.union.}` is not implemented for js backend.")
|
||||
else:
|
||||
noVal(c, it)
|
||||
if sym.typ == nil: invalidPragma(c, it)
|
||||
else: incl(sym.typ.flags, tfUnion)
|
||||
of wRequiresInit:
|
||||
noVal(c, it)
|
||||
if sym.kind == skField:
|
||||
|
||||
7
tests/js/tunion.nim
Normal file
7
tests/js/tunion.nim
Normal file
@@ -0,0 +1,7 @@
|
||||
discard """
|
||||
errormsg: "`{.union.}` is not implemented for js backend."
|
||||
"""
|
||||
|
||||
type Foo {.union.} = object
|
||||
as_bytes: array[8, int8]
|
||||
data: int64
|
||||
Reference in New Issue
Block a user