Commit Graph

34 Commits

Author SHA1 Message Date
Slava Pestov
375363a473 AST: Move global conformance lookup entry points to ConformanceLookup.h 2024-08-08 23:35:58 -04:00
Slava Pestov
ca9c09f8a1 Remove some unused variables 2024-07-06 12:05:47 -04:00
Slava Pestov
3fcda140bb AST: ModuleDecl::checkConformance() is a static method 2024-07-06 12:05:46 -04:00
Slava Pestov
fae01d9776 AST: Remove ModuleDecl parameter from more places 2024-07-06 12:05:46 -04: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
Slava Pestov
3bd568716f IDE: Better archetype etiquette in ConformingMethodListCallbacks::getMatchingMethods() 2024-01-18 16:15:02 -05:00
Slava Pestov
e39dd6a5da IDE: Tidy up some GenericEnvironment usages 2024-01-17 21:15:36 -05:00
Slava Pestov
14d1fcb51a AST: TypeChecker::conformsToProtocol() => ModuleDecl::checkConformance() 2024-01-16 17:08:00 -05:00
Alex Hoppen
928a03a2e0 [CodeCompletion] Migrate conforming methods list to solver-based 2023-07-07 19:51:01 +02:00
Alex Hoppen
00eaed3af9 [CodeCompletion] Migrate postfix expr completion to solver-based 2023-07-07 19:51:01 +02:00
Holly Borla
706411d2e6 [CodeCompletion] Plumb source locations through code completion name lookup. 2023-06-11 23:10:43 -07:00
Alex Hoppen
8a2cd86deb Split IDEInspectionCallbacks into CodeCompletionCallbacks and DoneParsingCallback
Cursor info only cares about the `doneParsing` callback and not about all the `complete` functions that are now defined in `CodeCompletionCallbacks`. To make the design clearer, split `IDEInspectionCallbacks`.

rdar://105120332
2023-03-17 10:31:13 -07:00
Alex Hoppen
fe2ae72ad2 [IDE] Rename CodeCompletion to IDEInspection in cases where the code path no longer exclusively applies to code completion
The code completio infrastructure is also being used for cursor info now, so it should no longer be called code completion.

rdar://103251187
2022-12-13 11:41:05 +01:00
Alex Hoppen
44262a3da8 [IDE] Pass SourceFile in doneParsing callback
This will be necessary to make cursor info completion like to inspect the just parsed source file because the callback from parsing the code completion token won’t be called.
2022-12-01 12:11:39 +01:00
Alex Hoppen
9dbd5829de [CodeCompletion] Support type checking attributes even if they are not part of the AST
The code completion might occur inside an attriubte that isn’t part of the AST because it’s missing a `VarDecl` that it could be attached to. In these cases, record the `CustomAttr` and type check it standalone, pretending it was part of a `DeclContext`.

This also fixes a few issues where code completion previously wouldn’t find the attribute constructor call and thus wasn’t providing code completion inside the property wrapper.

rdar://92842803
2022-05-07 08:58:52 +02:00
Alex Hoppen
974829e290 [swift-ide-test] Use dedicated method for conformingMethodList on CompletionInstance instead of generic performOperation 2021-10-28 11:10:30 +02:00
Hamish Knight
7302792506 [IDE] Use method result type for getTypeOfMember call
Previously we were defaulting to the method's
interface type, which could lead to calling `subst`
with a GenericFunctionType. Instead, pass the
result type only, as that's all we want anyway.

rdar://77259607
2021-07-20 14:11:30 +01:00
Robert Widmann
318f772e91 Check The DeclContext When Retrieving Conforming Decls
Checking for staticness is not enough because top-level decls count as
non-static yet do not have a sufficient curry level to satisfy this
check. Make sure we're looking for decls that reside inside of types.

rdar://75299825, SR-14327
2021-03-11 14:26:38 -08:00
Nathan Hawes
cf60b2fe61 [CodeCompletion] Pass the CodeCompletionExpr rather than just the base expression to the DotExpr completion callback. 2020-08-28 22:24:22 -07:00
David Zarzycki
1e940c2c7e [NFC] Fix -Wsuggest-override warnings
LLVM, as of 77e0e9e17daf0865620abcd41f692ab0642367c4, now builds with
-Wsuggest-override. Let's clean up the swift sources rather than disable
the warning locally.
2020-08-13 16:17:46 -04:00
Rintaro Ishizaki
e6ce361042 [CodeCompletion] Rename typeCheckContextUntil to typeCheckContextAt 2020-06-01 12:36:39 -07:00
Rintaro Ishizaki
3e200b7783 [CodeCompletion] Skip typechecking unrelated statements in func bodies
rdar://problem/58687608
2020-05-29 14:45:04 -07:00
Rintaro Ishizaki
ab7ba4ce79 [CodeCompletion] Don't show protocol extension only members in override
Protocol extension only members are not customization point. Code
completion should not suggest them in override/conformance completion.

rdar://problem/53591636
2020-04-27 11:52:27 -07:00
Anthony Latsis
74252028ca AST: Rename getFullName -> getName on ValueDecl & MissingMemberDecl 2020-04-23 05:16:55 +03:00
Anthony Latsis
41fe367a7e [CodeCompletion] Don't skip derived conformance members on override completion lookup 2020-03-28 23:59:18 +03:00
Slava Pestov
80ccbe5116 AST: Stop passing around a LazyResolver in name lookup
Note that in all cases it was either nullptr or ctx.getLazyResolver().
While passing in nullptr might appear at first glance to mean something
("don't type check anything"), in practice we would check for a nullptr
value and pull out ctx.getLazyResolver() instead. Furthermore, with
the lazy resolver going away (at least for resolveDeclSignature() calls),
it won't make sense to do that anymore anyway.
2019-08-19 23:00:57 -04:00
Xi Ge
1cb746b47c IDE+Evaluator: refactor resolveProtocolName to using the request evaluator, NFC 2019-07-22 15:35:14 -07:00
Rintaro Ishizaki
5ff4b0cfcd [TypeContextInfo/ConformingMethods] Map type out of context
To print mangling names.

rdar://problem/51198887
rdar://problem/51227338
2019-05-30 10:59:32 -07:00
Ben Langmuir
34da079aa6 Pass DynamicLookupInfo through VisibleDeclConsumers NFC
This commit adds a new type DynamicLookupInfo that provides information
about how a dynamic member lookup found a particular Decl. This is
needed to correctly handle KeyPath dynamic member lookups, but for now
just plumb it through everywhere.
2019-05-06 10:02:39 -07:00
Slava Pestov
3095c36585 IDE: Remove prepareForRetypechecking() 2019-04-02 01:51:57 -04:00
Xi Ge
35b17d7a6c SourceKit: allow expression type request to specify a list of protocol USRs for filtering
The client usually cares about a subset of all expressions. A way to differentiate
them is by the protocols these expressions' types conform to. This patch allows
the request to add a list of protocol USRs so that the response only includes those
interested expressions that conform to any of the input protocols.

We also add a field to the response for each expression type to indicate the
conforming protocols names that were originally in the input list.

When an empty list of protocol USRs are given, we report all expressions' types
in the file like the old behavior.

rdar://35199889
2019-03-13 14:07:33 -07:00
Rintaro Ishizaki
bbf288b53f [IDE] Use 'Demangle::getTypeForMangling()' instead of 'getDeclFromMangledSymbolName()' 2019-02-08 14:43:59 -08:00
Rintaro Ishizaki
7837130ae1 [IDE] Give default implementation for completion callbacks 2019-02-08 14:09:00 -08:00
Rintaro Ishizaki
1d845d6e3f [IDE/SourceKit] New SourceKit request for filtered method list
`source.request.conformingmethods` is a new SourceKit request which
receives a source position and a list of protocol namses, returns a list
of methods whose return type conforms to the requested protocols.

rdar://problem/44699573
2019-02-08 12:56:58 -08:00