Skip to content
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

[Parser] Fix-it for declaration attributes being applied to parameter types (SR-215) #673

Merged
merged 4 commits into from Jan 13, 2016

Conversation

SquaredTiki
Copy link
Contributor

As described in SR-215, previously the fix-it was suggesting that declaration attributes applied to parameter types be moved to before the function func declaration itself.

This pull request fixes this so that it is instead moved to before the parameter name.

@SquaredTiki SquaredTiki changed the title Fix-it for declaration attributes being applied to parameter types (SR-215) [Parser] Fix-it for declaration attributes being applied to parameter types (SR-215) Dec 19, 2015
/*escaping=*/false));
} else {
// Fix for SR215
Copy link
Collaborator

Choose a reason for hiding this comment

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

We usually don't leave references to bug numbers in C++ sources.

@gribozavr
Copy link
Collaborator

Please also add tests. test/NameBinding/import-specific-fixits.swift shows how to test fixits.

@SquaredTiki
Copy link
Contributor Author

@gribozavr Thanks for the comments. I've added a test and removed the reference to the bug number.

@gribozavr
Copy link
Collaborator

@SquaredTiki Thank you! Sorry for the delayed response, but would you mind rebasing and resolving conflicts with master?

@SquaredTiki
Copy link
Contributor Author

@gribozavr No worries! I've rebased and resolved conflicts.

// Check if attribute is invalid type attribute
// and actually a declaration attribute
if (TypeAttributes::getAttrKindFromString(nextToken.getText()) == TAK_Count
&& DeclAttribute::getAttrKindFromString(nextToken.getText()) != TAK_Count) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should it say DAK_Count?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Quite right, let me fix that now.

gribozavr added a commit that referenced this pull request Jan 13, 2016
[Parser] Fix-it for declaration attributes being applied to parameter types (SR-215)
@gribozavr gribozavr merged commit 72fdaff into apple:master Jan 13, 2016
@gribozavr
Copy link
Collaborator

@SquaredTiki Sorry, this PR caused test failures, so I reverted it.

swift/test/attr/attr_noescape.swift:5:131: error: expected fix-it not seen; actual fix-its: {{1-1=@noescape }} {{23-33=}}
func appliedToType(g: @noescape ()->Void) { g() }  // expected-error {{attribute can only be applied to declarations, not types}} {{20-20=@noescape }} {{23-33=}}
                                                                                                                                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                                                                                                                                  {{1-1=@noescape }} {{23-33=}}

swift/test/attr/attributes.swift:57:120: error: expected fix-it not seen; actual fix-its: {{11-11=@_transparent }} {{14-28=}}
func zoom(x: @_transparent () -> ()) { } // expected-error{{attribute can only be applied to declarations, not types}} {{1-1=@_transparent }} {{14-28=}}
                                                                                                                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                                                                                                                       {{11-11=@_transparent }} {{14-28=}}

@gribozavr
Copy link
Collaborator

@SquaredTiki Please run build-script -RT, fix the failures, and re-submit the PR.

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.

None yet

2 participants