fixes #1275
This commit is contained in:
parent
b119dc2f3b
commit
d02cc41596
2 changed files with 16 additions and 3 deletions
|
|
@ -714,11 +714,12 @@ proc genFieldCheck(p: BProc, e: PNode, obj: PRope, field: PSym) =
|
||||||
assert(it.sons[0].kind == nkSym)
|
assert(it.sons[0].kind == nkSym)
|
||||||
let op = it.sons[0].sym
|
let op = it.sons[0].sym
|
||||||
if op.magic == mNot: it = it.sons[1]
|
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)
|
initLoc(test, locNone, it.typ, OnStack)
|
||||||
initLocExpr(p, it.sons[1], u)
|
initLocExpr(p, it.sons[1], u)
|
||||||
initLoc(v, locExpr, it.sons[2].typ, OnUnknown)
|
initLoc(v, locExpr, disc.typ, OnUnknown)
|
||||||
v.r = ropef("$1.$2", [obj, it.sons[2].sym.loc.r])
|
v.r = ropef("$1.$2", [obj, disc.sym.loc.r])
|
||||||
genInExprAux(p, it, u, v, test)
|
genInExprAux(p, it, u, v, test)
|
||||||
let id = nodeTableTestOrSet(p.module.dataCache,
|
let id = nodeTableTestOrSet(p.module.dataCache,
|
||||||
newStrNode(nkStrLit, field.name.s), gBackendId)
|
newStrNode(nkStrLit, field.name.s), gBackendId)
|
||||||
|
|
|
||||||
|
|
@ -20,3 +20,15 @@ type
|
||||||
|
|
||||||
var a = Bar(y: 100, x: 200) # works
|
var a = Bar(y: 100, x: 200) # works
|
||||||
var b = Bar(x: 100, y: 200) # used to fail
|
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))
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue