-
Notifications
You must be signed in to change notification settings - Fork 10.5k
More correct implementation of SE-0110 #6133
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
More correct implementation of SE-0110 #6133
Conversation
@@ -14,7 +14,7 @@ func test0() { | |||
func testAndReturnError() throws { | |||
try ErrorProne.fail() | |||
try ErrorProne.go() | |||
try ErrorProne.tryAndReturnError() // collides with 'try' keyword | |||
try ErrorProne.tryAndReturnError(()) // collides with 'try' keyword |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ooh, this is actually a change. We shouldn't be adding a dummy argument here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You mean it's a clang importer bug? I thought so...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We add a dummy argument when there's a naming conflict with another method, but we shouldn't when there's a conflict with a keyword.
@jrose-apple Yeah I'll definitely take a look at those. This is still a work in progress, it needs the staging flag before going in and in fact some of our libraries don't even build yet due to some other Sema bug I haven't figured out. So the language changes definitely are not final, I just wanted to see an approximation thereof. |
18d5cb6
to
a74495a
Compare
Here is a new version where the corrected logic is conditionalized on the Swift 3 flag. Note that unfortunately even without the fix, the behavior in master already diverged from Swift 3 in incompatible ways. I'm going to try to reconcile this. |
FWIW the plan is for Swift 3 mode to support a superset of what the real Swift 3 supported. Also obviously I'm not going to try to simulate the old nonsense diagnostics and crashes... |
a74495a
to
d8910ae
Compare
@swift-ci Please smoke test |
(Expecting a couple of failures in Compatibility/tuple_arguments) |
Here are the source breaks I'm aware of so far with master vs Swift 3. These typecheck in Swift 3 but not master (with Swift 3 mode both on or off):
These diagnose in master but not in Swift 3:
|
This reverts commit e172383. There were two problems with this commit: - This was a source-breaking change and should have been feature-gated. - It only addressed one narrow case of SE-0110. Fixes <rdar://problem/28621719>.
Fix matchTypes() to be more careful about stripping off ParenType sugar, in order to match the behavior outlined in SE-0110. Note that the new logic only executes in Swift 4 mode; there's no functional change here in Swift 3 mode. This makes a second copy of the tuple_arguments test: - Compatibility/tuple_arguments is a test for Swift 3, updated to note differences with Swift 3. - Constraints/tuple_arguments has been updated for the new Swift 4 mode behavior. Fixes <rdar://problem/27383557>.
There's a general problem where a SubscriptExpr has an argument that's a LoadExpr loading a tuple from an lvalue. For some reason we don't construct the ParenExpr in this case, which confused CSDiag. Also, in Swift 3 mode, add a total hack to fudge things in matchCallArguments() in the case where we erroneously lost ParenType sugar.
d8910ae
to
dbb9d31
Compare
@swift-ci Please smoke test |
Uses the `-swift-version 4` command-line option.
Uses the `-swift-version 4` command-line option.
Related radars: