Commit Graph

2426 Commits

Author SHA1 Message Date
Vlasov Anton
904bd0bf63 SR-5740 Refactoring action to convert if statement to switch 2020-02-02 12:44:48 +03:00
swift-ci
81a6a266aa Merge remote-tracking branch 'origin/master' into master-rebranch 2020-01-27 18:23:23 -08:00
David Ungar
a2df6b98f5 Merge pull request #29463 from davidungar/PBP-2-21-ICNR-on
[DNM, Incremental: Type-body-fingerprints on-by-default]
2020-01-27 18:03:38 -08:00
swift-ci
36849ea21b Merge remote-tracking branch 'origin/master' into master-rebranch 2020-01-27 16:43:23 -08:00
David Ungar
d61f6f2f66 Changes to support per-type-body fingerprints. 2020-01-27 15:14:46 -08:00
Robert Widmann
6ec3ab94d2 [NFC] Define SILGen Request Zone and GenerateSIL Request
Define a high-level request for SILGen and switch the high-level
entrypoint to vector through it.
2020-01-26 13:43:52 -08:00
swift-ci
de08f556fe Merge remote-tracking branch 'origin/master' into master-rebranch 2020-01-23 10:23:53 -08:00
Rintaro Ishizaki
7b4466f400 [CodeCompletion] Ignore implicit decl when finding equivalent decl
TypeChecker sometimes (e.g. property wrappers) inserts implicit decls
(e.g. 'PatternBindingDecl's and 'VarDecl's) between decls in the AST.
This used to confuse 'getEquivalentDeclContextFromSourceFile()'. It
canceled fast-completion, caused crashes, or completed in a wrong
context.

Ignore implicit decls in the AST so that we can find the correct decl
context.

rdar://problem/58665268
2020-01-22 22:28:33 -08:00
swift-ci
df197066cf Merge remote-tracking branch 'origin/master' into master-rebranch 2020-01-21 18:02:52 -08:00
Rintaro Ishizaki
afd3be9559 [CodeCompletion] Improve context type analysis for ternary expressions
This improves code-completion for non-type-checked ternary expressions.
2020-01-21 15:30:08 -08:00
swift-ci
74e66dcd1f Merge remote-tracking branch 'origin/master' into master-rebranch 2020-01-19 13:03:49 -08:00
David Zarzycki
ed15a9e939 [QoI] Fix -Wmisleading-indentation warnings 2020-01-19 13:31:16 -05:00
swift-ci
6ae739e419 Merge remote-tracking branch 'origin/master' into master-rebranch 2020-01-17 10:04:25 -08:00
Rintaro Ishizaki
9eeb96c5ba [CodeCompletion] Handle cases where PersistentParserState is not created
For example, if stdlib is not found, CompilerInstance simply returns
before creating PersistentParserState. In such cases, completion should
just return empty result.

Previously, it caused SourceKit crash.

rdar://problem/58663066
2020-01-17 00:10:50 -08:00
swift-ci
68292a5dc0 Merge remote-tracking branch 'origin/master' into master-rebranch 2020-01-16 20:43:32 -08:00
Rintaro Ishizaki
95f12afb7c [CodeCompletion] Improve context type analysis for dictionary literal
- Analyze the type of the literal in the context
- If ':' is missing in the literal, treat the expression as a key
  expression
- If the parent expression is TupleExpr, analyze the context type of the
  tuple first, then return the element type of the position

rdar://problem/57096392
2020-01-16 15:52:48 -08:00
swift-ci
60b9f1edc6 Merge remote-tracking branch 'origin/master' into master-rebranch 2020-01-16 09:24:13 -08:00
Rintaro Ishizaki
13e865c11c Merge pull request #29245 from rintaro/ide-completion-fastaccessor-rdar58632889
[CodeCompletion] Enable fast completion within accessors
2020-01-16 09:08:12 -08:00
Rintaro Ishizaki
9b1212b4fb [CodeCompletion] Make getEquivalentDeclContextFromSourceFile() safe
Gracefully give up finding equivalent decl contxt if something goes wrong.
2020-01-15 21:38:36 -08:00
Rintaro Ishizaki
3018b55914 [CodeCompletion] Enable fast completion within accessors
'getEquivalentDeclContextFromSourceFile()' didn't work for accessors
because DeclContext hierarchy and AST hierarhy are not the same.

AST hierarchy:
    (TypeDecl or SourceFile) > AbstractStorageDecl > AccessorDecl
DeclContext hierarchy:
    (TypeDecl or SourceFile) > AccessorDecl

Handle them specially.

rdar://problem/58632889
2020-01-15 21:33:49 -08:00
Rintaro Ishizaki
951b85359a [SourceKit] Disable module system headers validation
in all SourceKit requests.
This validation may call many stat(2). Since we don't expect system files
are edited. Disable it for SourceKit requests. Even if they are edited,
manual builds can validates and updates them.

rdar://problem/58550697
2020-01-14 13:06:57 -08:00
Rintaro Ishizaki
ec70a40205 [CodeCompletion] Disable module system headers validation
This validation may call many `stat(2)`. Since we don't expect system
files are edited. Disable it for code completion, even if they are
edited, they are validated when the user manually build the project.

rdar://problem/58550697
2020-01-13 17:47:47 -08:00
swift-ci
18b6a8a71e Merge remote-tracking branch 'origin/master' into master-rebranch 2020-01-13 17:04:07 -08:00
Rintaro Ishizaki
70ad17a932 Merge pull request #28904 from rintaro/ide-completion-rdar58119719
[CodeCompletion] Reduce accumulating memory per fast completion
2020-01-13 16:49:51 -08:00
Rintaro Ishizaki
7bb01ed271 Merge pull request #28896 from rintaro/ide-completion-rdar58098222
[CodeCompletion] Always look into decls to find the parsed expression
2020-01-13 16:48:34 -08:00
swift-ci
5dcb80b599 Merge remote-tracking branch 'origin/master' into master-rebranch 2020-01-10 15:24:32 -08:00
Rintaro Ishizaki
ac7ba746f6 [CodeCompletion] Stop printing underlined keyword in override completion
e.g. `__consuming`. Now, conformance completion for
Sequence.makeIterator() is:

  struct MySequence: Sequence {
    func makeIterator() -> some IteratorProtocol {
      <#code#>
    }
  }

rdar://problem/56963545
2020-01-10 13:03:42 -08:00
Arnold Schwaighofer
0c99cd9734 Merge remote-tracking branch 'origin/master' into master-rebranch 2020-01-10 08:00:41 -08:00
Rintaro Ishizaki
b9f1e58b37 [CodeCompletion] Use GenericSignature methods to get associatedtype reqs 2020-01-08 21:35:49 -08:00
Rintaro Ishizaki
1dd6fe5688 [CodeCompletion] Stop suggesting opaque result type for generic function
in override completion. As per SE-0244:

> Associated type inference can only infer an opaque result type for a
> non-generic requirement, because the opaque type is parameterized by
> the function's own generic arguments
2020-01-08 17:37:42 -08:00
Rintaro Ishizaki
e388c4a381 [CodeCompletion] Get associatedtype constraints from ProtocolDecl::getRequirementSignature()
instead of AssociatedTypeDecl::getInherited() when checking if the
return type should be suggested as "opaque result type" in override
completion.

AssociatedTypeDecl::getInherited() is not serialized. So if the protocol
is declared in a module, it was never suggested as 'some' result.

rdar://problem/57245073
2020-01-08 17:37:42 -08:00
swift_jenkins
8a3c5c753b Merge remote-tracking branch 'origin/master' into master-next 2020-01-08 09:57:24 -08:00
Varun Gandhi
d919bfa1eb Merge pull request #29049 from varungandhi-apple/vg-v4-clang-types-in-swiftinterface
Re-land parsing and printing for Clang function types.
2020-01-08 09:41:17 -08:00
Arnold Schwaighofer
43c24be5cd Merge remote-tracking branch 'upstream/master' into master-next 2020-01-08 06:41:34 -08:00
David Zarzycki
89c5c0e4cc Merge pull request #29013 from davezarzycki/pr29013
NFC: Fix -Wdeprecated-copy warnings
2020-01-07 21:29:10 -05:00
Varun Gandhi
afc6ccdeb5 Re-land parsing and printing for Clang function types.
This reverts commit e805fe486e, which reverted
the change earlier. The problem was caused due to a simultaneous change to some
code by the PR with parsing and printing for Clang function types (#28737)
and the PR which introduced Located<T> (#28643).

This commit also includes a small change to make sure the intersecting region
is fixed: the change is limited to using the fields of Located<T> in the
`tryParseClangType` lambda.
2020-01-07 15:58:32 -08:00
David Zarzycki
3d1739fa86 NFC: Fix -Wdeprecated-copy warnings 2020-01-07 16:09:00 -05:00
Nathan Hawes
49b49f3250 Merge pull request #25141 from Regno/feature/vlasov/SR-5741
[Source Tooling] Refactoring action to convert to computed property
2020-01-07 10:34:05 -08:00
Robert Widmann
19f0d52eca Merge pull request #28995 from CodaFi/absolutely-path-ological
[NFC] Hide SourceFile::Decls
2020-01-06 18:48:55 -08:00
Saleem Abdulrasool
e805fe486e Revert "Clang function types v2: Electric Boogaloo (parsing + printing)" 2020-01-06 16:26:08 -08:00
Varun Gandhi
4a1a17d029 Merge pull request #28737 from varungandhi-apple/vg-v3-clang-types-in-swiftinterface
Clang function types v2: Electric Boogaloo (parsing + printing)
2020-01-06 15:42:30 -08:00
Varun Gandhi
022314a640 Merge pull request #28643 from kitaisreal/using-located-instead-of-pair
[Compiler]: Using Located<T> instead of std::pair<SourceLoc, T>
2020-01-06 14:22:29 -08:00
Varun Gandhi
96604470ae [AST] Add printing for Clang function types in the AST. 2020-01-06 13:00:04 -08:00
Robert Widmann
96b3b9f0f4 [NFC] Hide SourceFile::Decls
In preparation for installing some stable paths infrastructure here,
hide access to the array of top-level decls.
2020-01-03 14:14:00 -08:00
Rintaro Ishizaki
108b9c3a25 [CodeCompletion] Open virtual file for fast completion buffers
This improves diangostics message for completion traces
2020-01-02 14:13:16 -08:00
Rintaro Ishizaki
8f38105bc3 [CodeCompletion] Reduce leaking memory per fast completion
For each fast completion, the memory grows for the source buffer and the
AST of the function body in memory. They are kept until the next slow
completion.

To mitigate the memory consumption per completion, use sliced source
text which is actually required for the second pass.

rdar://problem/58119719
2020-01-02 14:04:11 -08:00
swift_jenkins
51b1e043db Merge remote-tracking branch 'origin/master' into master-next 2019-12-20 11:39:15 -08:00
Rintaro Ishizaki
ab0475178a [CodeCompletion] Eliminate CodeCompletionCallbacks::completeExpr()
Well, this does nothing. It just set the parser position twice and calls
the consumer's 'handleResults()' without any reason.
It seems it was intended to be a "fallback" completion, but it was never
implemented properly. So just remove it for now.

rdar://problem/58102910
2019-12-20 09:39:02 -08:00
swift_jenkins
2ebc382226 Merge remote-tracking branch 'origin/master' into master-next 2019-12-20 08:39:15 -08:00
Kita, Maksim
ea6a2dc094 SR-11889: Fixed code review issues
1. Updated Located field names with Pascal Case
2. Updated Located constuctor
3. Formatted lines with more than 80 symbols
2019-12-20 17:18:59 +03:00