-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[SourceKit] Don't report type for InjectIntoOptionalExpr
#67015
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
[SourceKit] Don't report type for InjectIntoOptionalExpr
#67015
Conversation
lib/IDE/IDETypeChecking.cpp
Outdated
// We should not report a type for InjectIntoOptionalExpr | ||
if (isa<InjectIntoOptionalExpr>(E)) | ||
return false; |
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.
Cursor-info ignores all isImplicit()
expressions including InjectIntoOptionalExpr
. Could you try:
// We should not report a type for InjectIntoOptionalExpr | |
if (isa<InjectIntoOptionalExpr>(E)) | |
return false; | |
if (E->isImplict()) | |
return false; |
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.
Yes, that works, but I think we should add an exception for OptionalEvaluationExpr
, right?
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.
Also, currently, in case of an implicit DotSyntaxCallExpr
like in let a = 1 + 2
, we expect the type of +
to be (Int, Int) -> Int
. With your suggested change that becomes (Int.Type) -> (Int, Int) -> Int
. Is that correct, or do you think we should also opt in for reporting types of implicit DotSyntaxCallExpr
?
// CHECK: (395, 398): String? | ||
// CHECK: (418, 423): String | ||
// CHECK: (457, 458): String |
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.
Would you mind adding the other type here? Not sure if it's the "Hey"
, "Bye"
or c
😅
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.
No problem :)
Fixes incorrectly reporting an optional type for an expression when the contextual type is optional. fixes swiftlang#66882 rdar://111462279
1dec944
to
c210a08
Compare
@swift-ci please 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.
Thanks! LGTM
@swift-ci please test |
Fixes incorrectly reporting an optional type for an expression when the contextual type is optional.
fixes #66882
rdar://111462279