File tree Expand file tree Collapse file tree 2 files changed +25
-1
lines changed Expand file tree Collapse file tree 2 files changed +25
-1
lines changed Original file line number Diff line number Diff line change @@ -1234,7 +1234,9 @@ proc allPathsAsgnResult(p: BProc; n: PNode): InitResultEnum =
12341234 else :
12351235 allPathsInBranch (n[i].lastSon)
12361236 of nkCallKinds:
1237- if canRaiseDisp (p, n[0 ]):
1237+ if canRaiseDisp (p, n[0 ]) or
1238+ (n[0 ].kind == nkSym and sfNoReturn in n[0 ].sym.flags):
1239+ # requires initializations when encountering unreachable code
12381240 result = InitRequired
12391241 else :
12401242 for i in 0 ..< n.safeLen:
Original file line number Diff line number Diff line change 1+ discard """
2+ exitcode: 1
3+ output: '''
4+ t24974.nim(22) t24974
5+ t24974.nim(19) d
6+ t24974.nim(16) s
7+ assertions.nim(41) failedAssertImpl
8+ assertions.nim(36) raiseAssert
9+ fatal.nim(53) sysFatal
10+ Error: unhandled exception: t24974.nim(16, 26) `false` [AssertionDefect]
11+ '''
12+ """
13+
14+
15+ type B = seq [array [1 , byte ]]
16+ proc s (_: var B): bool = doAssert false
17+ proc d (): B =
18+ var k: B
19+ if s (k): discard
20+ quit 0
21+ k
22+ for _ in [0 ]: discard d ()
You can’t perform that action at this time.
0 commit comments