Commit Graph

128 Commits

Author SHA1 Message Date
Hamish Knight
f26d1e7bd3 [Index] Mark accessors as implicit in modules
These won't have bodies in generated interfaces,
and generally aren't useful things to jump to. The
property ought to be used instead.

rdar://130775560
2024-07-05 16:28:33 +01:00
Hamish Knight
d98cb9e2b3 [Mangler] Mangle function type for invalid enum element
Previously we would mangle a single ErrorType as
the type for the element, but that would fail to
demangle since we expect a function type. Use the
same logic as AbstractFunctionDecl, mangling a
function type of ErrorType. While here, also
handle SubscriptDecls and check for error types
rather than `isInvalid()`.

rdar://129065620
2024-06-11 21:24:11 +01:00
Sam Kortekaas
c84ab103be [SourceKit] Don't duplicate coverage in test/Index for indexing local symbols 2024-01-11 17:13:12 +01:00
Simon Barinka
4c7e02d80a [SourceKit] Fix test 2023-12-23 08:02:12 +01:00
Simon Barinka
23cde9b2e0 [SourceKit] Move the option to IndexToStore request 2023-10-20 12:55:41 +02:00
Simon Barinka
b918345910 [SourceKit] Add tests 2023-10-09 21:09:25 +02:00
David Goldman
bce6490e44 Fix indexstore test paths on Windows 2023-07-11 17:14:52 -04:00
David Goldman
af81adb63c sourcekitd source.request.index_to_store fixes - new test and minor changes 2023-06-30 15:55:43 -04:00
David Goldman
d618233166 Add source.request.index_to_store to sourcekitd
This requests performs an index store index of the given file using the
given index store path and index unit output path. All other options are
derived from the index store related compiler flags.

This will allow IDEs like Xcode to index the file directly inside of
sourcekitd and potentially reuse an already built AST.
2023-06-28 14:24:20 -04:00
Keith Smiley
5e2c7a9d47 Revert "Fix RelBase indexing with composite types"
This crashes with typealiases referenced across files. I will resubmit
with a fix. See also https://github.com/apple/swift/pull/65545

This reverts commit 7a5e9dcf19.
2023-05-01 11:24:32 -07:00
Keith Smiley
7a5e9dcf19 Fix RelBase indexing with composite types
Previously the index data differed when using `Foo, Bar` vs `Foo & Bar`.

Fixes https://github.com/apple/swift/issues/56255
2023-04-29 12:46:31 -07:00
Konrad `ktoso` Malawski
93decb6141 [Concurrency] Complement assume... APIs with the assert and precondition ones (#64062) 2023-03-04 08:03:29 +09:00
Artem Chikin
c5e1b6baa9 Adjust tests to account for presence of implicit import of '_SwiftConcurrencyShims' 2023-01-13 11:20:35 -08:00
Anthony Latsis
a8b83b4e06 Gardening: Migrate test suite to GH issues: SourceKit 2022-09-22 03:21:39 +03:00
Tony Allevato
31d1b3a6d8 Index expressible-by-literal expressions.
When a value is initialized or coerced for a type that conforms to
one of the `ExpressibleBy*Literal` protocols (or
`ExpressibleByStringInterpolation`), this change records an implicit
call to the corresponding `init(...Literal:)` in the indexstore,
located at the beginning of the literal.
2022-08-27 20:06:13 -07:00
Andrew Trick
f428b512cc [test] Disable tests until we fix _StringProcessing #59653
These are failing due to #42611.
2022-06-23 14:09:23 -07:00
Richard Wei
94e8f5393e Enable string processing by default.
Make frontend flag `-enable-experimental-string-processing` default to true.
2022-06-12 20:25:16 -07:00
Ben Barham
8889daedce [SourceKit] Add whether a property is dynamic
Properties can also be specified in a protocol/overridden by subclasses,
so they should also be classed as "dynamic" in these cases.

Removed receiver USRs when *not* dynamic, since it's not used for
anything in that case and should be equivalent to the container anyway.

Resolves rdar://92882348.
2022-05-13 15:13:49 -07:00
Alex Hoppen
74cd03b098 [Index] Consider construction of enums with associated values as a function call
For enum cases with associated values, their construction is modelled by a function. E.g. if you have
```swift
enum Foo {
  case first(associated: Int)
}
```

then `Foo.first` is a function of type `(Int) -> Foo`. But if you write `Foo.first(associated: 2)` in source code, we consider this construct as a referenced, not a call. This causes us to miss renaming of associated value labels during local refactoring.

rdar://84061868
2022-05-09 22:22:31 +02:00
Rintaro Ishizaki
6bbc651f39 [SourceKit] Report comment tags in 'indexsource' request
Comment tags weren't handled at all in SourceKit's 'request.indexsource'
request.

rdar://88728047
2022-03-04 16:14:22 -08:00
Rintaro Ishizaki
c48dc6d9c8 [SourceKit][Tests] Disable a test case while investigating
This test fails in Apple Silicon bot. Disable it while investigating.

rdar://79416986
2021-06-17 14:00:17 -07:00
Mishal Shah
23c3b15f5f Support Xcode 13 beta
* Updating availability versions
* Remove all remaining overlays in stdlib/public/Darwin/*:
   - ObjectiveC
   - Dispatch
   - CoreFoundation
   - CoreGraphics
   - Foundation
2021-06-07 12:04:31 -07:00
Doug Gregor
568e943115 Enable import of the _Concurrency module by default. 2021-04-13 23:14:06 -07:00
Arnold Schwaighofer
9286ece71c Revert "Enable import of the _Concurrency module by default." 2021-04-09 13:20:30 -07:00
Doug Gregor
ff06bb4051 Fix a few tests for implicit _Concurrency import on Linux 2021-04-06 14:19:29 -07:00
Doug Gregor
95fd3ede09 Update tests and testing tools for implicit _Concurrency import 2021-04-06 14:08:41 -07:00
Ben Barham
19f23130d0 [SourceKit/CursorInfo] Mark dynamic calls
Adds two new fields to the cursor info response:
  1. is_dynamic: whether a call is dynamic
  2. receivers: receivers of the call (USRs)

Users of the CursorInfo request can use "is_dynamic" to decide whether
to lookup overrides or not, and then the "receivers" as the starting
point of the lookup.

Resolves rdar://75385900
2021-03-20 13:57:01 +10:00
Alexis Laferrière
b87fd1230b [Index] Update test related to reporting extensions in system modules 2020-10-17 15:27:36 -07:00
Bruno Rocha
b50813a6bc Run linux only test 2020-05-29 18:59:25 +02:00
Bruno Rocha
6ebf0d554e Add a test showing local content being ignored 2020-05-29 18:59:25 +02:00
Bruno Rocha
51c0024674 Whitelist instead of blacklist 2020-05-29 18:59:25 +02:00
Bruno Rocha
9b05823c88 Remove accessors and add PW tests 2020-05-29 18:59:25 +02:00
Bruno Rocha
f000639cce Improve tests and generate the rest of the output 2020-05-29 18:59:25 +02:00
Bruno Rocha
2a48e19ff0 [SourceKit] Add Effective Scope to Index 2020-05-29 18:59:25 +02:00
Nathan Hawes
b3b7aa8ecf Merge pull request #30964 from nathawes/syntactic-rename-for-callAsFunction
[IDE][Refactoring] Handle 'callAsFunction' specially in syntactic rename
2020-04-13 11:36:53 -07:00
Bruno Rocha
160eb6cfd8 Update index test response to cover unavailable calls 2020-04-12 19:18:47 -07:00
Nathan Hawes
bce68fa4e5 [IDE][Refactoring] Handle 'callAsFunction' specially in syntactic rename.
This change makes us treat it exactly as we do 'init'. We don't allow renaming the base name,
and don't fail if the basename doesn't match for calls.

Also:
  - explicit init calls/references like `MyType.init(42)` are now reported with
    'init' as a keywordBase range, rather than nothing.
  - cursor info no longer reports rename as available on init/callAsFunction
    calls without arguments, as there's nothing to rename in that case.
  - Improved detection of when a referenced function is a call (rather than
    reference) across syntactic rename, cursor-info, and indexing.

Resolves rdar://problem/60340429
2020-04-12 17:14:15 -07:00
Rintaro Ishizaki
aee280ad65 [SourceKit/Testing] Add %diff as an alias for 'diff --strip-trailing-cr' 2020-04-08 11:23:48 -07:00
Ben Langmuir
0b93a247c6 [test] Remove now-redundant %mcp_opt from sourcekit tests
Remove `%mcp_opt` from commands that use `%sourcekitd-test` and
`%complete-test`, as they are now redundant with the lit substitution.
2020-01-22 11:12:25 -08:00
Saleem Abdulrasool
2265d6e891 tests: adjust the SourceKit tests for line endings (NFCI)
This adjusts the tests for the difference between line endings on
different platforms.  Windows uses CRLF while most Unicies use LF.  This
was exposed during the update to the new LLVM snapshot.
2020-01-14 08:05:34 -08:00
Robert Widmann
1233cdf596 Update SourceKit for getInterfaceType() changes 2019-09-23 17:24:18 -07:00
Robert Widmann
59687518e2 Reject nominal extensions (with a bit of indirection)
If the canonical type is a nominal type then we can offer a diagnostic
that rewrites to it.

Resolves rdar://54799560
2019-09-01 01:52:41 -05:00
Jordan Rose
02e1a11e35 [Index] Don't index non-public imported declarations (#25865)
Apart from mildly speeding up indexing, this also keeps the compiler
from running into issues with implementation-only imports that may not
be present while we're trying to index.

rdar://problem/52083709
2019-06-28 16:57:29 -07:00
Argyrios Kyrtzidis
3332b37d00 [Index/SourceKit] Remove the code related to calculating a module hash from the indexing walker
This has been an unnecessary code path for a long time now and should be removed particularly because it triggers wasteful `stat` calls.

rdar://51523161
2019-06-21 17:09:12 -07:00
Ben Cohen
e9d4687e31 De-underscore @frozen, apply it to structs (#24185)
* De-underscore @frozen for enums

* Add @frozen for structs, deprecate @_fixed_layout for them

* Switch usage from _fixed_layout to frozen
2019-05-30 17:55:37 -07:00
Rintaro Ishizaki
d3d30ee246 [Serialization] Support Swift only system module
Previously 'isSystemModule()' returns true only if the module is:
- Standard library
- Clang module and that is `IsSystem`
- Swift overlay for clang `IsSystem` module

Now:
- Clang module and that is `IsSystem`; or
- Swift overlay for clang `IsSystem` module
- Swift module found in either of these directories:
  - Runtime library directoris (including stdlib)
  - Frameworks in `-Fsystem` directories
  - Frameworks in `$SDKROOT/System/Library/Frameworks/` (Darwin)
  - Frameworks in `$SDKROOT/Library/Frameworks/` (Darwin)

rdar://problem/50516314
2019-05-08 17:03:06 -07:00
Nathan Hawes
9bd39355b2 Merge pull request #22793 from nathawes/add-implicit-at-objc-attributes-to-index-request-output
[sourcekitd] Report entities that are implicitly @objc as @objc in the index request responses for compatibility
2019-02-25 16:21:44 -08:00
Nathan Hawes
7680cc6b16 [sourcekitd] Report entities that are implicitly objc as objc in the index request responses for compatibility
Members of an @objcMembers context previous had implicit @objc attributes, but
now don't (possibly because of the request evaluator changes?). This updates the
output of sourcekitd's 'index' request to act as if they still had implicit
@objc attributes on them for compatibility.

Resolves rdar://problem/48140265
2019-02-22 16:35:30 -08:00
Nathan Hawes
4ced0afd9e Merge pull request #22764 from nathawes/add-implicit-to-index-request-output
[sourcekitd] Expose the 'implicit' symbol role in the 'index' request response
2019-02-21 15:17:43 -08:00
Nathan Hawes
e5e9dc6c05 [sourcekitd] Expose the 'implicit' symbol role in the 'index' request response
Resolves rdar://problem/48148270.
2019-02-20 17:12:23 -08:00