Skip to content

Commit

Permalink
fix #15405
Browse files Browse the repository at this point in the history
  • Loading branch information
cooldome committed Sep 24, 2020
1 parent 496e9f7 commit 47eee1b
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 0 deletions.
3 changes: 3 additions & 0 deletions compiler/ccgtypes.nim
Original file line number Diff line number Diff line change
Expand Up @@ -1351,6 +1351,9 @@ proc genTypeInfoV2Impl(m: BModule, t, origType: PType, name: Rope; info: TLineIn
name, destroyImpl, getTypeDesc(m, t), typeName,
traceImpl, disposeImpl])

if t.kind == tyObject and t.len > 0:
discard genTypeInfoV1(m, origType, info)

proc genTypeInfoV2(m: BModule, t: PType; info: TLineInfo): Rope =
let origType = t
var t = skipTypes(origType, irrelevantForBackend + tyUserTypeClasses)
Expand Down
31 changes: 31 additions & 0 deletions tests/arc/tarcmisc.nim
Original file line number Diff line number Diff line change
Expand Up @@ -347,3 +347,34 @@ var data = {

# For ARC listVal is empty for some reason
doAssert data["examples"]["values"].listVal[0].strVal == "test"




###############################################################################
# bug #15405
import parsexml
const test_xml_str = "<A><B>value</B></A>"
var stream = newStringStream(test_xml_str)
var xml: XmlParser
open(xml, stream, "test")
var xml2 = deepCopy(xml)

proc text_parser(xml: var XmlParser) =
var test_passed = false
while true:
xml.next()
case xml.kind
of xmlElementStart:
if xml.elementName == "B":
xml.next()
if xml.kind == xmlCharData and xml.charData == "value":
test_passed = true

of xmlEof: break
else: discard
xml.close()
doAssert(test_passed)

text_parser(xml)
text_parser(xml2)

0 comments on commit 47eee1b

Please sign in to comment.