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 =
1234
1234
else:
1235
1235
allPathsInBranch(n[i].lastSon)
1236
1236
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
1238
1240
result = InitRequired
1239
1241
else:
1240
1242
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