Commit Graph

1924 Commits

Author SHA1 Message Date
Michael Spencer
b2640e15e4 [test] Rename all module.map files to module.modulemap
`module.map` as a module map name has been discouraged since 2014, and
Clang will soon warn on its usage. This patch renames all instances of
`module.map` in the Swift tests to `module.modulemap` in preparation
for this change to Clang.

rdar://106123303
2023-08-21 15:58:59 -07:00
Nishith Shah
8e2e625543 [Diagnostics] Use imperative msg for protocol conformance & switch-case fixits
This commit changes fixit messages from a question/suggestion to an
imperative message for protocol conformances and switch-case. Addresses
https://github.com/apple/swift/issues/67510.
2023-08-13 22:34:26 -07:00
Alex Hoppen
bba2f476ab Merge pull request #67613 from barinsim/my-main
[SourceKit] Report cursor info information for literals
2023-08-08 20:54:00 -07:00
Simon Barinka
9342e78e3e [SourceKit] Fix support for interpolated strings 2023-08-08 23:36:16 +02:00
Hamish Knight
c0e2d5ecbb Merge pull request #67015 from skrtks/sk-fix-incorrect-optional-types 2023-08-03 19:44:29 +01:00
Simon Barinka
06af7494e9 [SourceKit] Report type decl info instead of hidden inits 2023-08-02 23:40:08 +02:00
Simon Barinka
b7ee6e4c1d [SourceKit] Remove unnecessary open request 2023-08-01 19:16:41 +02:00
Simon Barinka
944a81836c [SourceKit] Remove sourcekit-test_plain 2023-08-01 19:13:20 +02:00
Alex Hoppen
b92530f50b Merge pull request #67500 from ahoppen/ahoppen/accessor-refactoring
Adjustments for refactoring of representation of Accessors in SwiftSyntax
2023-08-01 06:34:24 -07:00
Simon Barinka
d0cf2e4bf3 [SourceKit] Fix formatting issues 2023-08-01 13:26:14 +02:00
Simon Barinka
e32a20a55c [SourceKit] Report init info instead of the type decl info
Addresses PR review comments.
2023-08-01 12:51:39 +02:00
Alex Hoppen
cf81bab67d [Macros] Adjust test case because accessors are only separated by a single line 2023-07-31 21:53:24 -07:00
Simon Barinka
fcd084f9dd [SourceKit] Report cursor info information for literals
Adds literals support for the CursorInfo request.
Previously CursorInfo just returned error for literals.
Implements issue #57725
2023-07-30 14:22:08 +02:00
Alex Hoppen
992398b211 Merge pull request #67584 from ahoppen/ahoppen/de-duplicate-cursor-info-results
[CursorInfo] De-duplicate reported cursor info results
2023-07-28 07:33:52 -07:00
Alex Hoppen
862e14e084 [CursorInfo] De-duplicate reported cursor info results
The constraint system might produce multiple solutions that all reference the same declaration. We should only report the declaration once in those cases instead of multiple times.

rdar://111814276
2023-07-27 16:48:28 -07:00
Ben Barham
7e8a33097e Merge pull request #67488 from bnbarham/better-note-locations
[Diagnostics] Improve diagnostics involving macros
2023-07-26 17:48:02 -07:00
Ben Barham
18cb5f4f3d [Diagnostics] Update in_macro_expansion note for attached macros
Use the attached atttribute's location as the location of the macro,
rather than the location of the declaration it's attached to. Also add
the kind and name of that declaration to the note itself.
2023-07-25 16:03:52 -07:00
Kavon Farvardin
b5e0f95a18 eliminate pipes in favor of shlex
This solves deprecation warnings in build-script:

```
DeprecationWarning: 'pipes' is deprecated and slated for removal in Python 3.13
```

This change assumes that the minimum version
of Python3 is 3.3, which has `shlex.quote`.

Since our build bots currently use 3.6 as their
Python version, we can't yet use `shlex.join`
to further simplify some of the code using
quote.
2023-07-25 15:24:54 -07:00
Sam Kortekaas
c210a08afb [SourceKit] Don't report types for implicit expressions
Fixes incorrectly reporting an optional type for an expression when the contextual type is optional.

fixes #66882
rdar://111462279
2023-07-25 10:12:14 +02:00
Holly Borla
61e5811d73 [NFC] Update IDE, Index, ModuleInterface, and SourceKit tests to remove
conformance macros.
2023-07-19 12:38:52 -07:00
QuietMisdreavus
2565925f88 [SymbolGraphGen] allow cursor symbol graphs from function params (#67267)
rdar://105516823
2023-07-13 13:48:12 -06:00
Ben Barham
6e93ac1627 Merge pull request #66958 from DavidGoldman/main
Add source.request.index_to_store to sourcekitd
2023-07-12 13:53:33 -07:00
David Goldman
bce6490e44 Fix indexstore test paths on Windows 2023-07-11 17:14:52 -04:00
Alex Hoppen
c7e0bfae02 [IDE] Adjust test cases for migrating all completion kinds to solver-based 2023-07-07 19:51:01 +02:00
Holly Borla
67b30a406a [NFC] Fix formatting of expanded extensions in SourceKit tests. 2023-06-30 22:54:22 -07: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
Ben Barham
ab95dba720 [CursorInfo] Pass primary path to allow comparing previous ASTs
Update the cursor requests to also pass in their primary file. Snapshots
should be compared using this file, not the input buffer name. This
fixes AST re-use when the AST is usable with snapshots.

Resolves rdar://110344363.
2023-06-23 20:00:19 -07:00
Ben Barham
037ddc92ee [CursorInfo] Re-use already built ASTs ahead of currently building ones
Resolves rdar://110344363.
2023-06-22 14:12:48 -07:00
Kim de Vos
28df294e00 Remove spacing 2023-06-21 10:56:57 +02:00
Hamish Knight
a9f9bd1394 [SourceKit] Record module loading errors when generating interfaces
Record up to two errors emitted when we fail to
load a module for interface generation, and include
these errors in the message we pass back to the
editor. This should help us better pin down the
reason why interface generation failed.

rdar://109511099
2023-06-15 23:55:07 +01:00
QuietMisdreavus
e45c9df2a3 always use the argNames constructor for macro DeclNames (#66497)
rdar://110179186
2023-06-12 09:10:02 -06:00
Alex Hoppen
78d6822840 Merge pull request #66458 from ahoppen/ahoppen/consume-borrow-highlighting
[SourceKit] Highlight `consuming` and `borrowing` as keywords
2023-06-08 16:58:40 -07:00
Alex Hoppen
2ff585d6ff [SourceKit] Highlight consuming and borrowing as keywords 2023-06-08 10:59:42 -07:00
Rintaro Ishizaki
c3d1304345 [SourceKit] Add request to expand macros syntactically
Expand macros in the specified source file syntactically (without any
module imports, nor typechecking).

Request would look like:
```
{
  key.compilerargs: [...]
  key.sourcefile: <file name>
  key.sourcetext: <source text> (optional)
  key.expansions: [<expansion specifier>...]
}
```
`key.compilerargs` are used for getting plugins search paths. If
`key.sourcetext` is not specified, it's loaded from the file system.
Each `<expansion sepecifier>` is
```
{
  key.offset: <offset>
  key.modulename: <plugin module name>
  key.typename: <macro typename>
  key.macro_roles: [<macro role UID>...]
}
```
Clients have to provide the module and type names because that's
semantic.

Response is a `CategorizedEdits` just like (semantic) "ExpandMacro"
refactoring. But without `key.buffer_name`. Nested expnasions are not
supported at this point.
2023-06-07 14:26:40 -07:00
Doug Gregor
1ddecc00cc Merge pull request #66403 from DougGregor/remove-option-set 2023-06-07 06:49:39 -07:00
Doug Gregor
feb5c09d93 Remove OptionSet macro from the standard library. 2023-06-06 23:37:38 -07:00
Doug Gregor
70820749df Update mangled names in test case 2023-06-06 23:22:01 -07:00
Kim de Vos
d0b412e3eb Merge pull request #66106 from kimdv/kimdv/remove-newline-from-swift-syntax-code-gen
[SwiftSyntax] Remove `requiresLeadingNewline` from basic format
2023-05-30 21:32:50 +02:00
QuietMisdreavus
60ef958116 don't break a doc comment with a regular comment (#66136)
rdar://95307936
2023-05-30 08:44:02 -06:00
Kim de Vos
8140efb616 [SwiftSyntax] Remove requiresLeadingNewline from basic format 2023-05-30 09:53:33 +02:00
Richard Wei
7502f3ce83 [Macros] Fix existential diagnostics for declaration macro expansions
`TypeChecker::checkExistentialTypes` has decl-specific logic and backs out without invoking `ExistentialTypeVisitor` on `TypeDecl`s, but `MacroExpansionDecl` isn't a type decl and would fall into `ExistentialTypeVisitor` which will visit its expansion. The caller of `checkExistentialTypes` already visits auxiliary decls, so here we should only visit arguments and generic arguments of a macro.

Fixes a case where a declaration macro produces a type that conforms to a PAT. We now also run existential diagnostics on generic arguments on a `MacroExpansionDecl` that was previously not handled.

Note: I tried bailing out in `walkToDeclPre` but we should really visit macro arguments and generic arguments. Not walking expansions in `ExistentialTypeVisitor` is also not the right fix because we need to be able to visit macro expansions in arguments.

rdar://109779928
2023-05-25 23:25:58 -07:00
Doug Gregor
cfda29ccd4 [SE-0397] Enable freestanding declaration macros by default.
This proposal has been accepted. Move the feature flag from "experimental"
to "always enabled". Tracked by rdar://108637367.
2023-05-24 09:16:55 -07:00
Hamish Knight
5dd258f99f [Diags] Avoid emitting fix-its for generated code
Drop fix-its produced in generated buffers, such
as for macro expansions, as these aren't directly
actionable by the user.

rdar://108231633
2023-05-23 11:37:40 +01:00
Ben Barham
f97d1f2824 Merge pull request #65963 from bnbarham/change-member-attr-mangling
[AST] Use a different operator for member attribute macros
2023-05-18 23:21:39 -07:00
Ben Barham
515d22a486 [AST] Use a different operator for member attribute macros
Macro expansions are currently written to disk using the mangled name of
the macro. Do not use operators that only differ in case-sensitivity to
avoid issues on case-insensitive filesystems.

Resolves rdar://109371653.
2023-05-17 11:25:37 -07:00
Anthony Latsis
3f629315a9 Merge pull request #65731 from AnthonyLatsis/always-print-any
ASTPrinter: Turn on explicit `any` printing for everything and remove the option to disable it
2023-05-16 03:27:36 +03:00
Anthony Latsis
7f6d3bcd41 ASTPrinter: Turn on explicit any printing for everything and remove the option to disable it 2023-05-13 02:55:49 +03:00
Ben Barham
d0c892297c [Test] Avoid verifying SILGen in cursor info test
Verifying SILGen causes `loadAllMembers` to be run, which in turn ends
up actually creating the parent PBD of each `VarDecl` in this test.
Without verification, we never deserialize that PBD and thus end up with
`class` instead of `static` as we should. That's incorrect, but it's an
existing failure (rdar://105239467).

Resolves rdar://109037827.
2023-05-09 13:29:32 -07:00
Ben Barham
01086bc8b5 Merge pull request #65688 from bnbarham/swap-cursor-info-order
[CursorInfo] Prefer AST based results over solver based
2023-05-05 16:54:25 -07:00