mirror of
https://github.com/nim-lang/Nim.git
synced 2026-07-18 23:11:36 +00:00
@@ -719,6 +719,8 @@ proc getConstExpr(m: PSym, n: PNode; g: ModuleGraph): PNode =
|
||||
result.typ = n.typ
|
||||
of nkBracketExpr: result = foldArrayAccess(m, n, g)
|
||||
of nkDotExpr: result = foldFieldAccess(m, n, g)
|
||||
of nkCheckedFieldExpr:
|
||||
result = foldFieldAccess(m, n[0], g)
|
||||
of nkStmtListExpr:
|
||||
var i = 0
|
||||
while i <= n.len - 2:
|
||||
|
||||
@@ -223,3 +223,24 @@ type MyObj = object
|
||||
var a = MyObj(kind: false, x0: 1234)
|
||||
a.kind = true
|
||||
doAssert(a.x1 == "")
|
||||
|
||||
block:
|
||||
# bug #15532
|
||||
type Kind = enum
|
||||
k0, k1
|
||||
|
||||
type Foo = object
|
||||
y: int
|
||||
case kind: Kind
|
||||
of k0: x0: int
|
||||
of k1: x1: int
|
||||
|
||||
const j0 = Foo(y: 1, kind: k0, x0: 2)
|
||||
const j1 = Foo(y: 1, kind: k1, x1: 2)
|
||||
|
||||
doAssert j0.y == 1
|
||||
doAssert j0.kind == k0
|
||||
doAssert j1.kind == k1
|
||||
|
||||
doAssert j1.x1 == 2
|
||||
doAssert j0.x0 == 2
|
||||
|
||||
Reference in New Issue
Block a user