mirror of
https://github.com/nim-lang/Nim.git
synced 2026-04-19 05:50:30 +00:00
fixes #5517
This commit is contained in:
@@ -939,6 +939,8 @@ proc genAsgnAux(p: PProc, x, y: PNode, noCopyNeeded: bool) =
|
||||
if y.kind == nkCall:
|
||||
let tmp = p.getTemp(false)
|
||||
lineF(p, "var $1 = $4; $2 = $1[0]; $3 = $1[1];$n", [tmp, a.address, a.res, b.rdLoc])
|
||||
elif b.typ == etyBaseIndex:
|
||||
lineF(p, "$# = $#;$n", [a.res, b.rdLoc])
|
||||
else:
|
||||
internalError(x.info, "genAsgn")
|
||||
else:
|
||||
|
||||
@@ -52,3 +52,18 @@ input.add(nil)
|
||||
input.add(new string)
|
||||
input[1][] = "~"
|
||||
echo input[1][]
|
||||
|
||||
# bug #5517
|
||||
type
|
||||
TypeA1 = object of RootObj
|
||||
a_impl: int
|
||||
b_impl: string
|
||||
c_impl: pointer
|
||||
|
||||
proc initTypeA1(a: int; b: string; c: pointer = nil): TypeA1 =
|
||||
result.a_impl = a
|
||||
result.b_impl = b
|
||||
result.c_impl = c
|
||||
|
||||
let x = initTypeA1(1, "a")
|
||||
doAssert($x == "(a_impl: 1, b_impl: a, c_impl: ...)")
|
||||
|
||||
Reference in New Issue
Block a user