Commit Graph

13 Commits

Author SHA1 Message Date
Tim Kientzle
1098054291 Merge branch 'main' into tbkka-assertions2 2024-06-18 17:52:00 -07:00
Hamish Knight
30af99e47e [Completion] Better handle merging of lookup base types
For unresolved member completion, we were preferring
the more general type, when we ought to be preferring
the more specific type. Additionally, for both
unresolved member and postfix completion we were
opening archetypes, which doesn't work as expected
since we don't compare requirements. Factor out
the logic that deals with merging base types for
lookup, and have it prefer either the subtype, or
the optional type in the case of optional promotion.

rdar://126168123
2024-06-07 10:04:31 +01:00
Tim Kientzle
1d961ba22d Add #include "swift/Basic/Assertions.h" to a lot of source files
Although I don't plan to bring over new assertions wholesale
into the current qualification branch, it's entirely possible
that various minor changes in main will use the new assertions;
having this basic support in the release branch will simplify that.
(This is why I'm adding the includes as a separate pass from
rewriting the individual assertions)
2024-06-05 19:37:30 -07:00
Hamish Knight
d7fc22aaca [IDE] Simplify isImplicitSingleExpressionReturn
Use the generalized implied result logic, and
rename to `isImpliedResult` since that's really
what we're querying here, and it needs to handle
implicit-last-exprs if enabled.
2024-02-07 18:14:23 +00:00
Alex Hoppen
72cadecf21 [CodeCompletion] Split result delivery into a result colleciton and consumer phase
This will allow us to run two different completion kinds and deliver results from both of them.

Also: Compute a unified type context for global lookup. Previously, we always used the expected type context of the last lookup. But really, we should be considering all possible types from all constraint system solutions when computing code completion results from the cache.
2023-08-24 15:41:36 -07:00
Alex Hoppen
6cec68e302 [IDE] Ignore score kinds that represent implicit conversions when solving 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.
2023-07-07 19:50:46 +02:00
Alex Hoppen
56ea3341f5 [CodeCompletion] Migrate ForEachSequence and PostfixExprBeginning to solver-based 2022-03-23 13:03:56 +01:00
Alex Hoppen
3597652960 [CodeCompletion] Make sawSolution non-final and override sawSolutionImpl from subclasses
This eliminates a source of bugs if subclasses of `TypeCheckCompletionCallback` forget to call the superclass’s implementation of `sawSolution` from their overridden method.
2022-03-21 23:41:26 +01:00
Alex Hoppen
03d819f442 [CodeCompletion] Check whether surrounding context supports async in all solver-based completion kinds 2022-03-21 20:04:32 +01:00
Alex Hoppen
17eb6ea1a2 [CodeCompletion] Unify logic to retrieve completion expr type for all completion callbacks 2022-03-21 20:04:32 +01:00
Alex Hoppen
1baa1f4d9c [CodeCompletion] Extract common implementation of sawSolution and fallbackTypeCheck to TypeCheckCompletionCallback 2022-03-01 09:36:57 +01:00
Alex Hoppen
5bfa9ca026 [CodeCompletion] Make deliver*Result functions members on their TypeCheckCompletionCallback 2022-02-28 11:55:25 +01:00
Alex Hoppen
c8aba81978 [CodeCompletion] Move solver-based unresolved member completion to its own file 2022-02-23 17:08:27 +01:00