File tree Expand file tree Collapse file tree 4 files changed +22
-9
lines changed Expand file tree Collapse file tree 4 files changed +22
-9
lines changed Original file line number Diff line number Diff line change @@ -4043,10 +4043,10 @@ generateForEachStmtConstraints(
4043
4043
// `.next()`. `next()` is called on each iteration of the loop.
4044
4044
{
4045
4045
auto *nextRef = UnresolvedDotExpr::createImplicit (
4046
- ctx,
4047
- new (ctx) DeclRefExpr (makeIteratorVar, DeclNameLoc (),
4048
- /* Implicit=*/ true ),
4049
- ctx.Id_next , /* labels=*/ ArrayRef<Identifier>());
4046
+ ctx,
4047
+ new (ctx) DeclRefExpr (makeIteratorVar, DeclNameLoc (stmt-> getForLoc () ),
4048
+ /* Implicit=*/ true ),
4049
+ ctx.Id_next , /* labels=*/ ArrayRef<Identifier>());
4050
4050
nextRef->setFunctionRefKind (FunctionRefKind::SingleApply);
4051
4051
4052
4052
Expr *nextCall = CallExpr::createImplicitEmpty (ctx, nextRef);
Original file line number Diff line number Diff line change @@ -1775,9 +1775,6 @@ class Context {
1775
1775
void diagnoseUnhandledThrowSite (DiagnosticEngine &Diags, ASTNode E,
1776
1776
bool isTryCovered,
1777
1777
const PotentialEffectReason &reason) {
1778
- if (E.isImplicit ())
1779
- return ;
1780
-
1781
1778
switch (getKind ()) {
1782
1779
case Kind::PotentiallyHandled:
1783
1780
if (IsNonExhaustiveCatch) {
Original file line number Diff line number Diff line change @@ -9,7 +9,10 @@ func missingAsync<T : AsyncSequence>(_ seq: T) throws {
9
9
10
10
@available ( SwiftStdlib 5 . 1 , * )
11
11
func missingThrows< T : AsyncSequence > ( _ seq: T ) async {
12
- for try await _ in seq { } // expected-error{{error is not handled because the enclosing function is not declared 'throws'}}
12
+ for try await _ in seq { }
13
+ // expected-error@-1 {{error is not handled because the enclosing function is not declared 'throws'}}
14
+ // expected-error@-2 {{call can throw, but the error is not handled}}
15
+ // expected-note@-3 {{call is to 'rethrows' function, but a conformance has a throwing witness}}
13
16
}
14
17
15
18
@available ( SwiftStdlib 5 . 1 , * )
@@ -27,7 +30,9 @@ func missingThrowingInBlock<T : AsyncSequence>(_ seq: T) {
27
30
@available ( SwiftStdlib 5 . 1 , * )
28
31
func missingTryInBlock< T : AsyncSequence > ( _ seq: T ) {
29
32
executeAsync {
30
- for await _ in seq { } // expected-error{{call can throw, but the error is not handled}}
33
+ for await _ in seq { }
34
+ // expected-error@-1 2{{call can throw, but the error is not handled}}
35
+ // expected-note@-2 {{call is to 'rethrows' function, but a conformance has a throwing witness}}
31
36
}
32
37
}
33
38
Original file line number Diff line number Diff line change @@ -279,3 +279,14 @@ struct FunctionHolder {
279
279
}
280
280
}
281
281
282
+ // https://github.com/apple/swift/issues/61368
283
+
284
+ @propertyWrapper
285
+ struct Wrapper {
286
+ var wrappedValue : Int ?
287
+ init ( ) throws { }
288
+ }
289
+
290
+ struct Repro {
291
+ @Wrapper var x // expected-error {{call can throw, but errors cannot be thrown out of a property initializer}}
292
+ }
You can’t perform that action at this time.
0 commit comments