mirror of
https://github.com/nim-lang/Nim.git
synced 2026-04-19 14:00:35 +00:00
fixes #1275
This commit is contained in:
@@ -714,11 +714,12 @@ proc genFieldCheck(p: BProc, e: PNode, obj: PRope, field: PSym) =
|
||||
assert(it.sons[0].kind == nkSym)
|
||||
let op = it.sons[0].sym
|
||||
if op.magic == mNot: it = it.sons[1]
|
||||
assert(it.sons[2].kind == nkSym)
|
||||
let disc = it.sons[2].skipConv
|
||||
assert(disc.kind == nkSym)
|
||||
initLoc(test, locNone, it.typ, OnStack)
|
||||
initLocExpr(p, it.sons[1], u)
|
||||
initLoc(v, locExpr, it.sons[2].typ, OnUnknown)
|
||||
v.r = ropef("$1.$2", [obj, it.sons[2].sym.loc.r])
|
||||
initLoc(v, locExpr, disc.typ, OnUnknown)
|
||||
v.r = ropef("$1.$2", [obj, disc.sym.loc.r])
|
||||
genInExprAux(p, it, u, v, test)
|
||||
let id = nodeTableTestOrSet(p.module.dataCache,
|
||||
newStrNode(nkStrLit, field.name.s), gBackendId)
|
||||
|
||||
@@ -20,3 +20,15 @@ type
|
||||
|
||||
var a = Bar(y: 100, x: 200) # works
|
||||
var b = Bar(x: 100, y: 200) # used to fail
|
||||
|
||||
# bug 1275
|
||||
|
||||
type
|
||||
Graphic = object of TObject
|
||||
case kind: range[0..1]
|
||||
of 0:
|
||||
radius: float
|
||||
of 1:
|
||||
size: tuple[w, h: float]
|
||||
|
||||
var d = Graphic(kind: 1, size: (12.9, 6.9))
|
||||
|
||||
Reference in New Issue
Block a user