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-4834] Static should be attribute.builtin #47411

Closed
masters3d opened this issue May 9, 2017 · 6 comments
Closed

[SR-4834] Static should be attribute.builtin #47411

masters3d opened this issue May 9, 2017 · 6 comments
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior.

Comments

@masters3d
Copy link
Contributor

Previous ID SR-4834
Radar None
Original Reporter @masters3d
Type Bug
Status Closed
Resolution Done
Environment

Welcome to Apple Swift version 3.1 (swiftlang-802.0.51 clang-802.0.41). Type :help for assistance.

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

md5: 8727462403ffc22f9f6eeaa352343c60

Issue Description:

AFAICT, All modifiers are represented in Sourcekit as source.lang.swift.syntaxtype.attribute.builtin except static.
static comes up as source.lang.swift.syntaxtype.keyword
This seems to be a bug since static seems to be just another modifier in this list. https://developer.apple.com/library/content/documentation/Swift/Conceptual/Swift_Programming_Language/Declarations.html#//apple_ref/swift/grammar/declaration-modifiers

@akyrtzi
Copy link
Member

akyrtzi commented May 11, 2017

This is because `static` is a language keyword while the others are not, for example:

let override­ = 1 // works
let static = 1 // error: keyword 'static' cannot be used as an identifier here

@masters3d
Copy link
Contributor Author

I can understand class being a keyword because class variables also use the word class as a modifier. Maybe I am missing something but static doesn't seem to have the same requirements as the word class so I don't know why it must be a keyword.

@akyrtzi
Copy link
Member

akyrtzi commented May 11, 2017

That is an interesting question that I'd suggest bringing up on swift-dev, but I'd like to clarify that what sourcekitd reports is expected behavior, based on the language keywords, not a bug.

@masters3d
Copy link
Contributor Author

I did. Nobody responded.
https://lists.swift.org/pipermail/swift-dev/Week-of-Mon-20170501/004536.html
Perhaps it is not a sourcekit bug but I am not sure how else to file it. A a user, the only way I can interact with the syntax information is SourceKit.

@akyrtzi
Copy link
Member

akyrtzi commented May 11, 2017

In the email you ask 'why sourceKit is reporting `static` as a "source.lang.swift.syntaxtype.keyword"', and the answer is because 'static' is a language keyword, as I mentioned here. If you think it should not be a keyword, then that is a different question, targeted towards the language rules.

@masters3d
Copy link
Contributor Author

thats fair. Closing.

@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