File tree Expand file tree Collapse file tree 2 files changed +16
-0
lines changed Expand file tree Collapse file tree 2 files changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -3104,6 +3104,8 @@ class CheckEffectsCoverage : public EffectsHandlingWalker<CheckEffectsCoverage>
3104
3104
3105
3105
if (auto thrownError = TypeChecker::canThrow (Ctx, E->getSubExpr ())) {
3106
3106
E->setThrownError (*thrownError);
3107
+ } else {
3108
+ E->setThrownError (Ctx.getNeverType ());
3107
3109
}
3108
3110
3109
3111
scope.preserveCoverageFromOptionalOrForcedTryOperand ();
@@ -3123,6 +3125,8 @@ class CheckEffectsCoverage : public EffectsHandlingWalker<CheckEffectsCoverage>
3123
3125
3124
3126
if (auto thrownError = TypeChecker::canThrow (Ctx, E->getSubExpr ())) {
3125
3127
E->setThrownError (*thrownError);
3128
+ } else {
3129
+ E->setThrownError (Ctx.getNeverType ());
3126
3130
}
3127
3131
3128
3132
scope.preserveCoverageFromOptionalOrForcedTryOperand ();
Original file line number Diff line number Diff line change @@ -37,3 +37,15 @@ func throwsAnything() throws {
37
37
// CHECK: optional_try_expr{{.*}}thrown_error="MyError"
38
38
try ? printOrFail ( " ssshhhhh " )
39
39
}
40
+
41
+ func doesNotThrow( ) { }
42
+
43
+ func throwsNothing( ) {
44
+ // CHECK-LABE: func_decl{{.*}}"throwsNothing()"
45
+
46
+ // CHECK: force_try_expr{{.*}}thrown_error="Never"
47
+ try ! doesNotThrow ( )
48
+
49
+ // CHECK: optional_try_expr{{.*}}thrown_error="Never"
50
+ try ? doesNotThrow ( )
51
+ }
You can’t perform that action at this time.
0 commit comments