From b1ca628a699153844c8806df5afaab42e0662815 Mon Sep 17 00:00:00 2001 From: Andrii Riabushenko Date: Tue, 28 Jan 2020 10:39:48 +0000 Subject: [PATCH 1/2] fixes ##13281 --- compiler/semtypes.nim | 8 ++++---- tests/ccgbugs/tcgbug.nim | 15 +++++++++++++++ 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/compiler/semtypes.nim b/compiler/semtypes.nim index 3b9cba835eed..ed59ce36a2e2 100644 --- a/compiler/semtypes.nim +++ b/compiler/semtypes.nim @@ -698,7 +698,7 @@ proc semRecordCase(c: PContext, n: PNode, check: var IntSet, pos: var int, father.add a proc semRecordNodeAux(c: PContext, n: PNode, check: var IntSet, pos: var int, - father: PNode, rectype: PType, hasCaseFields = false) = + father: PNode, rectype: PType, hasCaseFields: bool) = if n == nil: return case n.kind of nkRecWhen: @@ -727,12 +727,12 @@ proc semRecordNodeAux(c: PContext, n: PNode, check: var IntSet, pos: var int, assign(newCheck, check) var newPos = pos var newf = newNodeI(nkRecList, n.info) - semRecordNodeAux(c, it[idx], newCheck, newPos, newf, rectype) + semRecordNodeAux(c, it[idx], newCheck, newPos, newf, rectype, hasCaseFields) it[idx] = if newf.len == 1: newf[0] else: newf if c.inGenericContext > 0: father.add n elif branch != nil: - semRecordNodeAux(c, branch, check, pos, father, rectype) + semRecordNodeAux(c, branch, check, pos, father, rectype, hasCaseFields) of nkRecCase: semRecordCase(c, n, check, pos, father, rectype) of nkNilLit: @@ -741,7 +741,7 @@ proc semRecordNodeAux(c: PContext, n: PNode, check: var IntSet, pos: var int, # attempt to keep the nesting at a sane level: var a = if father.kind == nkRecList: father else: copyNode(n) for i in 0.. Date: Tue, 28 Jan 2020 10:43:20 +0000 Subject: [PATCH 2/2] add comment to test --- tests/ccgbugs/tcgbug.nim | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/ccgbugs/tcgbug.nim b/tests/ccgbugs/tcgbug.nim index 30eb961ff41d..db9c116be842 100644 --- a/tests/ccgbugs/tcgbug.nim +++ b/tests/ccgbugs/tcgbug.nim @@ -40,7 +40,8 @@ type var k = PFuture[void]() -##bug #9297 +##bug #9297 and #13281 + import strutils type