-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[CodeCompletion] Escape declaration base name if needed #23372
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
[CodeCompletion] Escape declaration base name if needed #23372
Conversation
935ce76
to
e7cf5cc
Compare
@swift-ci Please smoke test |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mostly LGTM
lib/IDE/CodeCompletion.cpp
Outdated
// e.g. 'func `init`()' should be 'expe.`init`()'. | ||
(!ExprType || NameStr == "init") && | ||
// 'self' and 'Self' are special | ||
NameStr != "self" && NameStr != "Self"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't see any error writing x.Self as a property reference.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
foo.self
, foo.Self
, self
and Self
are all valid. We don't have to escape self
and Self
at use-site.
class C {
func foo() {
var `self` = 12
let `Self` = 42
self += Self
print(self)
}
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, I was wrong.
class C {
var `self` = 12
}
print(C().self) // C
print(C().`self`) // 12
I will update this part to clarify the intent.
e7cf5cc
to
e8652bc
Compare
@swift-ci Please smoke test |
@swift-ci Please smoke test OS X platform |
2 similar comments
@swift-ci Please smoke test OS X platform |
@swift-ci Please smoke test OS X platform |
There should be escaped identifiers in code completion: - As primary expression: Any keyword name except for `self` and `Self`. - After dot: Something named `init`. rdar://problem/16232627
e8652bc
to
df473f6
Compare
@swift-ci Please smoke test |
These should be escaped identifiers in code completion:
self
andSelf
.`init`
.rdar://problem/16232627