Commit Graph

414 Commits

Author SHA1 Message Date
Nathan Hawes
d4c0acf3e9 [ASTMangler] Don't verify the USR mangling for invalid decls
USRs generated for the index store and sourcekit requests for invalid decls are
best-effort – we don't need to guarantee they can be de- or re-mangled.
2019-11-20 16:57:51 -08:00
Daniel Rodríguez Troitiño
a1a891e47a [windows] Use the temporal directory for root of VFS tests.
The VFS tests were using Unix absolute paths, which does not play well
when Windows see them as relative to the current drive letter.

By using the temporal directory, both Windows and Unix can use the same
paths and avoid the problem.

Additionally, a couple of inputs have to be transformed into the native
path format, because sourcekitd-test compares the inputs as strings, and
they need to match exactly. So the source file and the name of the VFS
entries are transformed into native using the helper from LLVM support.
2019-11-15 15:20:01 -08:00
Nathan Hawes
1218613e27 [IDE] Fix CursorInfo crash on arg label when the called 'function' is actually a module decl. 2019-11-07 13:49:27 -08:00
Robert Widmann
1233cdf596 Update SourceKit for getInterfaceType() changes 2019-09-23 17:24:18 -07:00
Harlan Haskins
d3b8ce7ae2 [test] Update ParseableInterface to ModuleInterface
Also remove uses of -emit-parseable-module-interface from tests
2019-09-13 14:55:48 -07:00
Gwen Mittertreiner
25ceaab96d Merge pull request #26203 from gmittert/Symlinks
[Windows] Create symlinks properly in sema_symlink.swift
2019-09-06 16:15:45 -07:00
Robert Widmann
2d836f45be Drop a superfluous NULL write
Storing NULL here on failure is brittle and was only necessary when the
typechecker was leaking type variables in expressions.  Now that we're
better about this, it's best to preserve the damaged AST.
2019-09-03 13:01:30 -07:00
Doug Gregor
b4e80cfd90 [Constraint graph] Enable one-way constraints in function builders.
Enable one-way constraints by default for function builders, finishing
rdar://problem/50150793.
2019-08-19 22:49:15 -07:00
Gwen Mittertreiner
30788eca59 [Windows] Create symlinks properly in lit tests
The mingw `ln -s` doesn't make a proper symlink on Windows. Instead add a
script to use `cmd.exe /C mklink ...` on Windows.
2019-08-14 16:07:25 -07:00
Holly Borla
d022c4a8f6 Sema: don't change the init kind of a ConstructorDecl when type checking its body. 2019-07-26 15:08:18 -07:00
Marc Rasi
3b44b27b30 propagate vfs to more places, remove vfs arg
Propagates the VFS to the SemanticInfo that gets used when then
original editor.open is syntactic only.

Removes unnecessary filesystem arg (get filesystem from class field
instead).

Adds test for the VFS being propagated into the SemanticInfo.

Refactors test/SourceKit/CursorInfo/injected_vfs.swift to use
-print-raw-response for all its tests, for consistency.
2019-07-16 11:39:00 -07:00
Ben Langmuir
2e268a512d Fix new VFS tests that use modules to pass the target consistently
Prevent mismatch between compiling and loading the module.
2019-07-16 10:19:25 -07:00
Ben Langmuir
4787730b51 Add additional VFS tests
* VFS attached to open document, persists after edit
* VFS reset after re-opening document
* VFS override for cursor_info
2019-07-16 10:19:24 -07:00
Ben Langmuir
78a7d95f07 Factor getting the filesystem into a method with error handling 2019-07-16 10:19:24 -07:00
Marc Rasi
7e15723805 add custom fs to editor.open and cursorinfo 2019-07-16 10:19:24 -07:00
Doug Gregor
e2df49e5d6 Fix SourceKit test for property wrappers init(initialValue:) rename. 2019-07-11 10:26:37 -07:00
Nathan Hawes
e08a6c1994 [IDE][Index][test] Update sourcekit/indexing support for latest property wrapper changes
The backing property for 'foo' is now '_foo', and the projected value '$foo'.
This updates Indexing to report occurrences of foo within both $foo and
_foo occurrences (rather than just $foo - the old _foo).

FindRelatedIdents was similarlar updated, so it reports 'foo' ranges in both
_foo and $foo.

CursorInfo now reports the USR, documentation, and location of foo when invoked
occurrences of $foo or _foo, but now leaves the name, type, and annotated
declaration of _foo/$foo as is. Having the same USR ensures rename invoked on
any of them will still rename via foo. Reporting foo's documentation comment
instead is just to present something more useful to the user.
2019-06-28 10:15:00 -07:00
Nathan Hawes
c547e6885e [test] Add more index/refactoring/cursor-info tests for property wrappers
Make sure they handle the case when a property wrapper type's constructor is
called with the first argument coming from the var initializer, and the rest
from the custom attribute's argument.
2019-06-26 18:37:47 -07:00
Nathan Hawes
91e2e35a77 [IDE] Update CursorInfo and FindRelatedIdents to treat property wrapper backing properties as the underlying property
This is the final piece to get rename and findRelatedIdents to include all foo
and $foo occurrences, for example, in the set of occurrences to be renamed or
shown, regardless of whether they were initiated on a foo or $foo.

Resolves rdar://problem/51695783.
2019-06-26 18:37:47 -07:00
David Ungar
aac3a3d2ae Add a test & don’t look for a module with a special name. 2019-06-20 11:19:12 -07:00
Rintaro Ishizaki
319d386f75 [SourceKit] Extend opaque type results test case 2019-06-17 17:50:28 -07:00
Argyrios Kyrtzidis
b3be8ae772 [ASTPrinter] Make sure to print some as a keyword
rdar://50073494
2019-06-14 17:22:30 -07:00
Rintaro Ishizaki
5cc5b933dc [SourceKit] Function builder: Add cursor-info test cases
rdar://problem/50074156
2019-06-11 17:34:45 -07:00
David Goldman
7b6f9499b7 Comment and sourcekitd-test fixes 2019-05-28 04:36:29 -04:00
David Goldman
1b1756cb55 Add InternalDiagnostic to CursorInfoData and NameTranslatingInfo 2019-05-28 04:24:25 -04:00
David Goldman
176cd6cce1 Fail requests when an error occurs
Previously, requests would fail silently by returning an empty struct
in the response.

With this change, responses will properly report fail with the internal
error.
2019-05-28 04:24:25 -04:00
Joe Groff
7d54810b92 Revert "[SourceKit] Fail requests when an error occurs" 2019-05-22 15:18:28 -07:00
Argyrios Kyrtzidis
729a9558e8 Merge pull request #24124 from DavidGoldman/master
[SourceKit] Fail requests when an error occurs
2019-05-22 10:49:42 -07:00
David Goldman
1c819820fa Comment and sourcekitd-test fixes 2019-05-21 10:40:22 -04: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
David Goldman
a3a4d2d22b Add InternalDiagnostic to CursorInfoData and NameTranslatingInfo 2019-05-03 11:01:22 -04:00
David Goldman
10ecea6269 [SourceKit] Fail requests when an error occurs
Previously, requests would fail silently by returning an empty struct
in the response.

With this change, responses will properly report fail with the internal
error.
2019-05-03 11:01:21 -04:00
Gwen Mittertreiner
7da91d5aeb Fix SourceKit/CursorInfo Tests on Windows 2019-04-22 15:55:55 -07:00
Ben Langmuir
40df0c4c5a Remove unnecessary check from cursor info keypath member lookup test
This test baked in an incorrect USR from a bug that has since been
fixed. But we don't really need to check this anyway, so remove it.
2019-04-17 09:36:40 -07:00
Ben Langmuir
effab8c522 Handle dynamic member lookup in annotation and cursor info
Ensure the various entity walkers handle the implicit subscript
reference correctly (usually by ignoring it) and fall through to the
underlying declarations.

rdar://49028895
2019-04-16 15:37:32 -07:00
Michael Gottesman
7b0d8455ca [ast][silgen] Wire up the case body var decls and use them in SILGenPattern emission to fix the evil fallthrough bug.
rdar://47467128
2019-04-03 23:51:06 -07:00
Slava Pestov
75673f1d90 AST: Fix mangling of entities in subscript context
For now, this means USRs of ParamDecls. Soon, default argument generators
for subscripts will need this too.

Fixes <https://bugs.swift.org/browse/SR-8660>, <rdar://problem/44435221>.
2019-04-02 19:51:41 -04:00
Nathan Hawes
20733bad08 Merge pull request #23144 from nathawes/cursorinfo-parseable-interface-tests
[sourcekitd][test] Test CursorInfo works correctly with modules loaded via a parseable interface
2019-03-22 18:29:48 -07:00
Nathan Hawes
6150fbea67 [sourcekitd][test] Test CursorInfo works correctly with modules loaded via a parseable interface 2019-03-22 11:02:17 -07:00
Nathan Hawes
e568d97e72 [sourcekitd][CursorInfo] Make sure we handle the implict VarDelcs being introduced in CastStmt bodies
When CursorInfo finds a reference to a VarDecl that's implicit but has a parent
VarDecl (according to VarDecl::getParentVarDecl), act as if we found the parent
instead.
2019-03-20 14:38:08 -07:00
Xi Ge
1625bcfbba ASTPrinter: skip underscored keyword when printing for quick helps.
rdar://47777848
2019-03-13 17:53:51 -07:00
Slava Pestov
3dc5ae36a6 SourceKit: Use Demangle::getTypeDeclForUSR() to implement 'CursorInfo for USR' request
Fixes <rdar://problem/47819208>.
2019-02-22 16:13:03 -05:00
Xi Ge
2cc3a2704b [test] Add -target %target-triple to sourcekitd-test invocation 2019-02-15 12:28:16 -08:00
Xi Ge
b4c224966b Re-apply "sourcekitd/test: add an interface grouping test for user module." 2019-02-15 11:20:01 -08:00
Ben Langmuir
f1803c87a9 Revert "sourcekitd/test: add an interface grouping test for user module." 2019-02-15 08:26:41 -08:00
Xi Ge
38691236aa sourcekitd/test: add test for cursor-info returning group name for user modules 2019-02-14 14:03:57 -08:00
Slava Pestov
d0c7b1547e ASTMangler: Mangle sugared types for the debugger
Fixes <rdar://problem/48004306>.
2019-02-13 19:17:25 -05:00
Nathan Hawes
c3723fd4d7 [sourcekitd][AST] Fix CursorInfo crash on method with unresolved default value
When printing its annotated decl, we would would assume the param's default
value is present if the default value kind was "Normal". The type checker
explicitly sets the default value to nullptr if it doesn't type check though, so
we were crashing for that case. Added the check.

Resolves rdar://problem/46694149
2018-12-21 18:13:53 -08:00
Ben Cohen
ae6f5dd604 [stdlib] Add consuming/owned annotations to Collection implementations (#19360)
* Add consuming/owned annotations to Collection implementations

* Update SILOptimizer tests

* Fix access_marker_verify test

* XFAIL reconstruct_type_from_mangled_name
2018-09-21 12:06:56 -07:00
Erik Eckstein
39bb14b094 change mangling prefix from $S to $s
This is the final ABI mangling prefix

rdar://problem/38471478
2018-09-19 13:55:11 -07:00