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

[SR-7731] SourceKit doesn't handle tuple labels that are also keywords in function return types correctly #50271

Closed
ole opened this issue May 20, 2018 · 3 comments
Assignees
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior.

Comments

@ole
Copy link
Contributor

ole commented May 20, 2018

Previous ID SR-7731
Radar None
Original Reporter @ole
Type Bug
Status Resolved
Resolution Done
Environment
> swift --version
Apple Swift version 4.1 (swiftlang-902.0.48 clang-902.0.37.1)
Target: x86_64-apple-darwin17.5.0

I haven't had a chance to test it with a current master toolchain or 4.2 beta, sorry.

Additional Detail from JIRA
Votes 0
Component/s Source Tooling
Labels Bug
Assignee @rintaro
Priority Medium

md5: cdcd72383fc448470d51f83b2f625a32

Issue Description:

This is valid code in Swift 4.1 (note the use of the keyword in both as a parameter label and as a label in the returned tuple):

func g(in x: Int) -> (in: Int, Int) {
    return (in: x, 0)
}

The compiler doesn't require backticks (`in`) in either place here, but SourceKit seems to treat the label in the return type as a keyword (i.e. Xcode highlights it as a keyword).

Interestingly, the line:

return (in: x, 0)

is highlighted correctly, whereas in a line such as this:

let y: (in: Int, Int) = (0, 0)

the in also gets highlighted as a keyword.

@belkadan
Copy link
Contributor

Type vs. expression context, I guess? cc @nathawes, @rintaro

@rintaro
Copy link
Mannequin

rintaro mannequin commented May 22, 2018

PR #16763

@ole
Copy link
Contributor Author

ole commented May 22, 2018

@rintaro Awesome, thanks!

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior.
Projects
None yet
Development

No branches or pull requests

2 participants