Commit Graph

4 Commits

Author SHA1 Message Date
Alex Hoppen
32eff21977 [IDE] Remove "Begin completions" and "End completions" from test cases
These test lines weren't actually providing any value and were annoying to write. Let's jut remove them.
2023-03-22 09:07:17 -07:00
Alex Hoppen
5d01a097e1 [CodeCompletion] Don't distinguish convertible and idenical type relation
I think that preferring identical over convertible makes sense in e.g. C++ where we have implicit user-defined type conversions but since we don’t have them in Swift, I think the distinction doesn’t make too much sense, because if we have a `func foo(x: Int?)`, want don’t really want to  prioritize variables of type `Int?` over `Int` Similarly if we have `func foo(x: View)`, we don’t want to prioritize a variable of type `View` over e.g. `Text`.

rdar://91349364
2022-04-13 08:28:17 +02:00
Rintaro Ishizaki
6dd5d9482f [CodeCompletion] Introduce "Flair" in code completion
To describe fine grained priorities.

Introduce 'CodeCompletionFlair' that is a set of more descriptive flags for
prioritizing completion items. This aims to replace '
SemanticContextKind::ExpressionSpecific' which was a "catch all"
prioritization flag.
2021-06-07 17:25:01 -07:00
Alex Hoppen
7e2898c4e4 [CodeComplete] Fix cyclic dependency error during code completion
In the added test case, we were hitting a cyclic dependency error in the request evaluator during code completion, that’s caued as follows:
– To complete at `#^COMPLETE^#`, we need to get the `NamingPattern` of `start`.
– Retrieving the `NamingPattern` of `start` causes the entire `if`-condition to be type checked, including `end`
– Type checking `end` requires getting the `NamingPattern` of `start`
=> Cyclic dependency

To resolve the issue, I added a special case to `NamingPatternRequest` that only type-checks the `StmtConditionElement` that actually defines the `VarDecl`.

Fixes rdar://75200217
2021-03-25 22:13:52 +01:00