-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[SE-0345] Support if let foo {
optional binding conditions
#40694
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@swift-ci please smoke test |
@swift-ci please built toolchain |
Could you add some tests into, e.g., |
Of course, will work on this tonight / this week. Thanks for the pointer of what tests to update! |
ee8ebc0
to
b9c2370
Compare
@DougGregor, added tests in 38e2b70 |
6cd6002
to
362234d
Compare
362234d
to
38e2b70
Compare
@swift-ci please build toolchain |
@swift-ci please build toolchain |
@swift-ci please smoke test |
Could you also add some tests for the following?
|
Updated in cc85edf |
@swift-ci please smoke test |
SE-0345 has been accepted. Kicking off CI to check that we're in a mergeable state. One thing we'll still want to add is a ChangeLog entry describing the change. That can come as a separate PR, of course |
if let foo {
optional binding conditionsif let foo {
optional binding conditions
Woohoo! Thanks for merging @DougGregor, appreciate your leadership as RM throughout the review 😄 |
The issue is that the shorthand if let syntax injects an implicit expression: swiftlang#40694 in ParseStmt and that the 'diagnoseUnhandledAsyncSite' explicitly avoids reporting errors in implicit expressions. This patch "peeks" at the expression to notice this case, however perhaps we should mark this implicit expression in ParseStmt and then detect it explicitly. Added some tests covering this as well as properly erroring out for the nonexistent syntax of shortand + awaiting which doesn't exist, and we properly error on it. Resolves rdar://126169564
The issue is that the shorthand if let syntax injects an implicit expression: swiftlang#40694 in ParseStmt and that the 'diagnoseUnhandledAsyncSite' explicitly avoids reporting errors in implicit expressions. This patch "peeks" at the expression to notice this case, however perhaps we should mark this implicit expression in ParseStmt and then detect it explicitly. Added some tests covering this as well as properly erroring out for the nonexistent syntax of shortand + awaiting which doesn't exist, and we properly error on it. Resolves rdar://126169564
The issue is that the shorthand if let syntax injects an implicit expression: swiftlang#40694 in ParseStmt and that the 'diagnoseUnhandledAsyncSite' explicitly avoids reporting errors in implicit expressions. This patch "peeks" at the expression to notice this case, however perhaps we should mark this implicit expression in ParseStmt and then detect it explicitly. Added some tests covering this as well as properly erroring out for the nonexistent syntax of shortand + awaiting which doesn't exist, and we properly error on it. Resolves rdar://126169564
The issue is that the shorthand if let syntax injects an implicit expression: swiftlang#40694 in ParseStmt and that the 'diagnoseUnhandledAsyncSite' explicitly avoids reporting errors in implicit expressions. This patch "peeks" at the expression to notice this case, however perhaps we should mark this implicit expression in ParseStmt and then detect it explicitly. Added some tests covering this as well as properly erroring out for the nonexistent syntax of shortand + awaiting which doesn't exist, and we properly error on it. Resolves rdar://126169564
The issue is that the shorthand if let syntax injects an implicit expression: swiftlang#40694 in ParseStmt and that the 'diagnoseUnhandledAsyncSite' explicitly avoids reporting errors in implicit expressions. This patch "peeks" at the expression to notice this case, however perhaps we should mark this implicit expression in ParseStmt and then detect it explicitly. Added some tests covering this as well as properly erroring out for the nonexistent syntax of shortand + awaiting which doesn't exist, and we properly error on it. Resolves rdar://126169564
The issue is that the shorthand if let syntax injects an implicit expression: swiftlang#40694 in ParseStmt and that the 'diagnoseUnhandledAsyncSite' explicitly avoids reporting errors in implicit expressions. Since the synthesized node does have proper source location, we can avoid this problem easily if we dont mark it as Implicit. Other approaches are possible but end up in a whack-a-mole between a lot of other error reporting in other situations which do rely on implicit code not being reported because they report on it already in some other specialized way. Resolves rdar://126169564 what if we always diagnose Propsing we use this shape of fix for the async if let in synchronous code This change is that we don't mark the implicit declref code emitted by the `if let prop` as implicit anymore, and this way the reporting works out as expected. Removing the if (isImplicit) return-early is actually tricky since there's quite a whack-a-mole with errors getting reported then... This change looks the safest to me.
The issue is that the shorthand if let syntax injects an implicit expression: swiftlang#40694 in ParseStmt and that the 'diagnoseUnhandledAsyncSite' explicitly avoids reporting errors in implicit expressions. Since the synthesized node does have proper source location, we can avoid this problem easily if we dont mark it as Implicit. Other approaches are possible but end up in a whack-a-mole between a lot of other error reporting in other situations which do rely on implicit code not being reported because they report on it already in some other specialized way. Resolves rdar://126169564
The issue is that the shorthand if let syntax injects an implicit expression: swiftlang#40694 in ParseStmt and that the 'diagnoseUnhandledAsyncSite' explicitly avoids reporting errors in implicit expressions. This change is that we don't mark the implicit declref code emitted by the `if let prop` as implicit anymore, and this way the reporting works out as expected. Added some tests covering this as well as properly erroring out for the nonexistent syntax of shortand + awaiting which doesn't exist, and we properly error on it. Resolves rdar://126169564
The issue is that the shorthand if let syntax injects an implicit expression: swiftlang#40694 in ParseStmt and that the 'diagnoseUnhandledAsyncSite' explicitly avoids reporting errors in implicit expressions. This change is that we don't mark the implicit declref code emitted by the `if let prop` as implicit anymore, and this way the reporting works out as expected. Added some tests covering this as well as properly erroring out for the nonexistent syntax of shortand + awaiting which doesn't exist, and we properly error on it. Resolves rdar://126169564
The issue is that the shorthand if let syntax injects an implicit expression: swiftlang#40694 in ParseStmt and that the 'diagnoseUnhandledAsyncSite' explicitly avoids reporting errors in implicit expressions. This change is that we don't mark the implicit declref code emitted by the `if let prop` as implicit anymore, and this way the reporting works out as expected. Added some tests covering this as well as properly erroring out for the nonexistent syntax of shortand + awaiting which doesn't exist, and we properly error on it. Resolves rdar://126169564
The issue is that the shorthand if let syntax injects an implicit expression: apple#40694 in ParseStmt and that the 'diagnoseUnhandledAsyncSite' explicitly avoids reporting errors in implicit expressions. This change is that we don't mark the implicit declref code emitted by the `if let prop` as implicit anymore, and this way the reporting works out as expected. Added some tests covering this as well as properly erroring out for the nonexistent syntax of shortand + awaiting which doesn't exist, and we properly error on it. Resolves rdar://126169564
This PR adds support for
if let foo {
optional binding conditions.This implements SE-0345.
For example: