Skip to content

Conversation

nkcsgexi
Copy link
Contributor

This another fixit I found useful when helping developers migrate. When an expected argument is of type [T] or UnsafePointer, however the developer feeds an expression of Type T, the fixit adds brackets to the expression.

Resolved bug number: (SR-)


Before merging this pull request to apple/swift repository:

  • Test pull request on Swift continuous integration.

Triggering Swift CI

The swift-ci is triggered by writing a comment on this PR addressed to the GitHub user @swift-ci. Different tests will run depending on the specific comment that you use. The currently available comments are:

Smoke Testing

Platform Comment
All supported platforms @swift-ci Please smoke test
All supported platforms @swift-ci Please smoke test and merge
OS X platform @swift-ci Please smoke test OS X platform
Linux platform @swift-ci Please smoke test Linux platform

Validation Testing

Platform Comment
All supported platforms @swift-ci Please test
All supported platforms @swift-ci Please test and merge
OS X platform @swift-ci Please test OS X platform
OS X platform @swift-ci Please benchmark
Linux platform @swift-ci Please test Linux platform

Lint Testing

Language Comment
Python @swift-ci Please Python lint

Note: Only members of the Apple organization can trigger swift-ci.

… UnsafePointer.

@nkcsgexi
Copy link
Contributor Author

@swift-ci Please test and merge

@gribozavr
Copy link
Contributor

Isn't inserting just '&' simpler?

@nkcsgexi
Copy link
Contributor Author

I think in that case we need separate paths for UnsafePointer and Array. Any advantage of using &?

@gribozavr
Copy link
Contributor

Any advantage of using &?

It does not allocate an array on the heap.

@nkcsgexi
Copy link
Contributor Author

@swift-ci Please test and merge

@nkcsgexi
Copy link
Contributor Author

@gribozavr Sounds reasonable. I have changed [] to & for the UnsafePointer case.

return true;
}
}
} else if (contextDecl == CS->TC.Context.getUnsafePointerDecl()) {
Copy link
Contributor

Choose a reason for hiding this comment

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

What about UnsafeMutablePointer?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Can we fix that in the same way?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes.

@nkcsgexi
Copy link
Contributor Author

@swift-ci Please test and merge

@swift-ci swift-ci merged commit 79f9840 into swiftlang:master Jun 21, 2016
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