Commit Graph

1541 Commits

Author SHA1 Message Date
Harlan Haskins
2893d96927 [ModuleInterfaces] Escape Type and Protocol when module-qualifying
If we see `MyModule.Type`, the parser thinks this is a metatype type.
Escape the name `Type` so the parser can recognize it's a type name.

Fixes [SR-11422](https://bugs.swift.org/browse/SR-11422) rdar://55094784
2019-09-09 17:20:27 -07:00
Mike Ash
f5e7ab866c Merge branch 'master' into master-next 2019-09-09 12:11:25 -04:00
swift-ci
397ff4ce05 Merge remote-tracking branch 'origin/master' into master-rebranch 2019-09-06 23:23:36 -07:00
Slava Pestov
01e65e18c4 SIL: Share TypeConverter between SILModules in batch mode 2019-09-06 21:50:15 -04:00
Jordan Rose
eefb0d0644 Merge remote-tracking branch 'origin/master' into master-next 2019-09-04 14:01:43 -07:00
swift-ci
0eaa4e1ad9 Merge remote-tracking branch 'origin/master' into master-rebranch 2019-09-04 11:23:50 -07:00
Saleem Abdulrasool
9c9f0bd440 Merge pull request #26918 from xiaobai/sur-la-tablegen
[CMake][SourceKit] SwiftLang should depend on clang-tablegen-targets
2019-09-04 11:15:53 -07:00
swift-ci
f1318a890a Merge remote-tracking branch 'origin/master' into master-next 2019-08-29 14:10:41 -07:00
swift-ci
86bdfeb467 Merge remote-tracking branch 'origin/master' into master-rebranch 2019-08-29 14:04:23 -07:00
Doug Gregor
d8f7c9e72c [Parser] Introduce a request for parsing type and extension members.
Ensure that lazy parsing of the members of nominal type definitions
and extensions is handled through a request. Most of the effort here
is in establishing a new request zone for parser requests.
2019-08-28 21:39:56 -07:00
Alex Langford
f5355d19ca [CMake][SourceKit] SwiftLang should depend on clang-tablegen-targets
SwiftLang relies on some clang headers that rely on clang tablegen targets.
2019-08-28 14:37:51 -07:00
swift-ci
217265aa51 Merge remote-tracking branch 'origin/master' into master-rebranch 2019-08-22 16:43:52 -07:00
swift-ci
b503ced230 Merge remote-tracking branch 'origin/master' into master-next 2019-08-22 16:29:14 -07:00
Slava Pestov
2dbeeb0d3f AST: Make SubstFlags::UseErrorType the default behavior
We've fixed a number of bugs recently where callers did not expect
to get a null Type out of subst(). This occurs particularly often
in SourceKit, where the input AST is often invalid and the types
resulting from substitution are mostly used for display.

Let's fix all these potential problems in one fell swoop by changing
subst() to always return a Type, possibly one containing ErrorTypes.

Only a couple of places depended on the old behavior, and they were
easy enough to change from checking for a null Type to checking if
the result responds with true to hasError().

Also while we're at it, simplify a few call sites of subst().
2019-08-22 01:07:50 -04:00
swift-ci
d28622d4ac Merge remote-tracking branch 'origin/master' into master-rebranch 2019-08-19 21:43:25 -07:00
swift-ci
c97950d7da Merge remote-tracking branch 'origin/master' into master-next 2019-08-19 21:30:00 -07: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
Jonas Devlieghere
5c5041235b Merge Swift & Clang VFS in the ClangImporter
The clang importer has to deal with two virtual file systems, one coming
from clang, and one coming from swift. Currently, if both are set, we
emit a diagnostic that we'll pick the swift one.

This commit changes that, by merging the two virtual file systems. The
motivation for this change is the reproducer infrastructure in LLDB,
which adds a third virtual file system to the mix.

(cherry picked from commit 94ef5431ff)
2019-08-19 16:53:03 -07:00
Jonas Devlieghere
b4d268e9e1 Migrate llvm::make_unique to std::make_unique
Now that we've moved to C++14, we no longer need the llvm::make_unique
implementation from STLExtras.h. This patch is a mechanical replacement
of (hopefully) all the llvm::make_unique instances in the swift repo.
2019-08-15 11:32:39 -07:00
swift-ci
032def3316 Merge remote-tracking branch 'origin/master' into master-next 2019-08-14 11:50:24 -07:00
Adrian Prantl
c08a62764a Move DWARFImporterDelegate into ClangImporter and remove DWARFImporter.
This refactors DWARFImporter to become a part of ClangImporter, since
it needs access to many of its implementation details anyway. The
DWARFImporterDelegate is just another mechanism for deserializing
Clang ASTs and once we have a Clang AST, the processing is effectively
the same.
2019-08-14 10:28:50 -07:00
swift-ci
e91e54091c Merge remote-tracking branch 'origin/master' into master-next 2019-07-26 15:29:13 -07:00
Argyrios Kyrtzidis
348fa2145e Merge pull request #26371 from akyrtzi/swift-indent
Rename the `swift-format` utility to `swift-indent`
2019-07-26 15:19:36 -07:00
Argyrios Kyrtzidis
0135e01d02 Rename the swift-format utility to swift-indent
This is to distinguish the C++ indenting functionality from the new formatter that is written in Swift.
2019-07-26 11:40:54 -07:00
swift-ci
49223cae98 Merge remote-tracking branch 'origin/master' into master-next 2019-07-24 14:29:59 -07:00
Xi Ge
b6e6f69e80 IDE+Evaluator: converge multiple type relation checks into a single sema request, NFC
From libIDE, the utility functions will invoke the request in the implementation.
2019-07-24 12:53:10 -07:00
swift-ci
5af069b59f Merge remote-tracking branch 'origin/master' into master-next 2019-07-24 09:49:59 -07:00
Nathan Hawes
71c4c16b38 Merge pull request #26270 from nathawes/53313197-syntaxmodel-crash
[IDE] Fix SyntaxModel crash due to out-of-order walking of EnumElementDecls
2019-07-24 09:45:28 -07:00
swift-ci
956cb34ac5 Merge remote-tracking branch 'origin/master' into master-next 2019-07-23 18:29:56 -07:00
Slava Pestov
8561407dc3 SourceKit: Register type checker request functions
Some requests are implemented in lib/Sema/, even if they don't require a
LazyResolver. Be sure to register their request functions in SourceKit so
that these requests can be kicked off when needed.
2019-07-23 16:13:28 -04:00
Nathan Hawes
f23c24fe03 [SourceKit] Return a default UID in getUIDForSyntaxNodeKind()
Assert 0 and return a default kind, rather than calling unreachable
as a defensive fix for rdar://problem/53343735.
2019-07-23 11:14:14 -07:00
swift-ci
fd1bfd12ec Merge remote-tracking branch 'origin/master' into master-next 2019-07-22 18:29:42 -07:00
Xi Ge
1cb746b47c IDE+Evaluator: refactor resolveProtocolName to using the request evaluator, NFC 2019-07-22 15:35:14 -07:00
swift-ci
9cbb87abb2 Merge remote-tracking branch 'origin/master' into master-next 2019-07-22 14:09:39 -07:00
Xi Ge
77ba3a21b4 IDE+Evaluator: refactor the implementation of two type checker utilities to evaluator requests. NFC
IDE functionality needs some internal type checking logics, e.g. checking
whether an extension is applicable to a concrete type. We used to directly
expose an header from sema called IDETypeChecking.h so that IDE functionalities
could invoke these APIs. The goal of the commit and following commits is to
expose evaluator requests instead of directly exposing function entry points from
sema so that we could later move IDETypeChecking.h to libIDE and implement these functions
by internally evaluating these requests.
2019-07-22 12:49:36 -07:00
swift-ci
2608be787b Merge remote-tracking branch 'origin/master' into master-next 2019-07-19 14:29:42 -07:00
Xi Ge
4d57590fa9 IDE+Evaluator: refactor the implementation of two common IDE utilities to the evaluator model
These APIs are 'canDeclProvideDefaultImplementationFor' and 'collectAllOverriddenDecls'.
2019-07-19 11:14:21 -07:00
Jonas Devlieghere
94ef5431ff Merge Swift & Clang VFS in the ClangImporter
The clang importer has to deal with two virtual file systems, one coming
from clang, and one coming from swift. Currently, if both are set, we
emit a diagnostic that we'll pick the swift one.

This commit changes that, by merging the two virtual file systems. The
motivation for this change is the reproducer infrastructure in LLDB,
which adds a third virtual file system to the mix.
2019-07-18 16:29:08 -07:00
marcrasi
a98bfd69e0 Merge pull request #26168 from marcrasi/vfs-attempt-2
[apple/swift] [sourcekit] Add an optional virtual file system per request and/or open document
2019-07-17 15:24:57 -07:00
Xi Ge
8f1a9b4789 IDE+Evaluator: refactor range info resolver to an IDE evaluator request. NFC 2019-07-17 12:20:09 -07:00
Marc Rasi
8c993a3543 fix lldb test failure 2019-07-16 21:42:57 -07:00
Marc Rasi
ccd2f2ab56 make re-opening a file update its vfs 2019-07-16 14:24:37 -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
75278d8e78 Remove some unnecessary changes 2019-07-16 10:19:25 -07:00
Ben Langmuir
3b652bfeb5 Add VFS support to codecomplete.open, codecomplete.update 2019-07-16 10:19:25 -07:00
Ben Langmuir
6e2a7e5a3a Allow passing key.sourcetext to provide in-memory-vfs contents
For testing, passing `-vfs-files=source=@target` with an '@' on the
target file will pass it as source text.
2019-07-16 10:19:24 -07:00
Ben Langmuir
8784a7b96d Migrate to OptionsDictionary to pass arguments to FileSystemProvider 2019-07-16 10:19:24 -07:00
Ben Langmuir
0c2b6b63c7 Rename testvfs to in-memory-vfs 2019-07-16 10:19:24 -07:00
Ben Langmuir
205371c886 Move storage for VFS into editor document
The invocation options are not an appropriate place to put this state,
since it can change between requests. This moves it to the editor
document, allowing us to change the specific VFS instance without
causing a rebuild (unless the contents/timestamps for a dependency
change).
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