-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[IDE] Ignore score kinds that represent implicit conversions when solving for code completion #63855
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
[IDE] Ignore score kinds that represent implicit conversions when solving for code completion #63855
Conversation
Type BaseTy; | ||
|
||
/// The we were able to determine it, the decl that we are completing on. |
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.
Comment needs some adjustment :)
|
||
/// If the expression we are completing on statically refers to a metatype, | ||
/// that is if it's something like 'MyType'. In such cases we want to offer | ||
/// constructor call pattern completions and don't want to suggested |
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.
suggest*
@@ -927,6 +927,9 @@ enum ScoreKind: unsigned int { | |||
/// A reference to an @unavailable declaration. | |||
SK_Unavailable, | |||
/// A reference to an async function in a synchronous context. | |||
/// | |||
/// \note Any score kind after thisis considered a conversion that doesn't |
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.
this is*
lib/Sema/CSRanking.cpp
Outdated
default: | ||
break; | ||
} | ||
if (isForCodeCompletion() && kind >= SK_SyncInAsync) { |
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.
Should this be done locally only for locations that involve code completion token in some way (calls with code completion in argument or member references with code completion token?
It's bad that we didn't use SK_NonDefaultLiteral
unconditionally today because expressions like 1 + 2 + #^COMPLETE^#
- would produce all possible permutations of non-default types like Int32, UInt16, Double
etc. even for the first +
which degrades performances significantly for filtering.
bool ExpectsNonVoid; | ||
bool BaseIsStaticMetaType; | ||
|
||
/// If the code completion expression occurrs as a single statement in a |
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.
occurs*
9dbf865
to
4cedc37
Compare
593e52e
to
dbe9cec
Compare
…ving for code completion Ignore conversion score increases during code completion to make sure we don't filter solutions that might start receiving the best score based on a choice of the code completion token.
dbe9cec
to
3481ac1
Compare
@swift-ci Please smoke test |
@swift-ci Please SourceKit stress test |
This PR cases failures on its own and seems to require some of the changes in #63717. Merging the changes here as part of that PR. |
Ignore conversion score increases during code completion to make sure we don't filter solutions that might start receiving the best score based on a choice of the code completion token.