Skip to content

[CSDiag] Add a new diagnostic for @propertyWrapper implicit init call missing arguments #26219

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

Merged
merged 7 commits into from
Jul 19, 2019
Merged

Conversation

theblixguy
Copy link
Collaborator

@theblixguy theblixguy commented Jul 18, 2019

We were emitting the fix-it in the wrong location for an implicitly generated @propertyWrapper initializer call expression, because missingArgument() was not handling it correctly.

class Foo {
  @Bar var property: Int = 1234
                               ^
                                , string: <#String#>
}

@propertyWrapper
struct Bar {
  var wrappedValue: Int

  init(wrappedValue: Int, string: String) {
    self.wrappedValue = wrappedValue
  }
}

Since emitting the correct fix-it is a bit tricky, this PR adds a new tailored diagnostic for this scenario.

Resolves SR-11060.
Resolves rdar://problem/52593306

@theblixguy
Copy link
Collaborator Author

cc @xedin @DougGregor

@xedin xedin self-requested a review July 18, 2019 20:40
Copy link
Contributor

@xedin xedin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@theblixguy theblixguy changed the title [CSDiag] Fix @propertyWrapper fix-it location for implicit initializer [CSDiag] Add a new diagnostic for @propertyWrapper implicit init call missing arguments Jul 18, 2019
@xedin
Copy link
Contributor

xedin commented Jul 18, 2019

@swift-ci please test

@swift-ci
Copy link
Contributor

Build failed
Swift Test Linux Platform
Git Sha - df699d55e83ef5c976282b8b995c2c4d6bd5be18

@swift-ci
Copy link
Contributor

Build failed
Swift Test OS X Platform
Git Sha - df699d55e83ef5c976282b8b995c2c4d6bd5be18

@theblixguy
Copy link
Collaborator Author

Linux failure is unrelated

@xedin
Copy link
Contributor

xedin commented Jul 19, 2019

@swift-ci please test Linux platform

@theblixguy
Copy link
Collaborator Author

Thank you! I think this should be cherry-picked to 5.1 as well.

@xedin xedin merged commit 5fe29a7 into swiftlang:master Jul 19, 2019
@xedin
Copy link
Contributor

xedin commented Jul 19, 2019

@theblixguy Sorry, at this point there are only critical fixes taken in into 5.1 branch.

@theblixguy theblixguy deleted the fix/SR-11060 branch July 19, 2019 16:48
@theblixguy
Copy link
Collaborator Author

ah okay no problem!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants