Commit Graph

2971 Commits

Author SHA1 Message Date
Karoy Lorentey
1c9b0908e6 Merge remote-tracking branch 'origin/master-next'
# Conflicts:
#	include/swift/Frontend/FrontendInputsAndOutputs.h
2020-06-08 16:43:40 -07:00
Hamish Knight
1ed810653c [Frontend] Remove performParseOnly
Most clients were only using it to populate the
main module with files, which is now done by
`getMainModule`. Instead, they can now just rely
on parsing happening lazily.
2020-06-08 12:44:15 -07:00
Hamish Knight
5d72c464eb [Frontend] Remove parsing option params from performParseOnly
Lift the `DisablePoundIfEvaluation` parsing option
into `LangOptions` to subsume the need for the
`EvaluateConditionals` parameter, and sink the
computation of `CanDelayBodies` down into
`createSourceFileForMainModule`.
2020-06-08 12:44:13 -07:00
Hamish Knight
81483cc050 Merge pull request #32161 from hamishknight/pipeline-parse 2020-06-08 10:56:28 -07:00
Doug Gregor
8d0014d590 Clarify a comment 2020-06-05 09:08:18 -07:00
Doug Gregor
836bc57fe5 [AST Walker] Stop visiting the bodies of closures as expressions.
Single-expression closures have always been traversed differently
from multi-statement closures. The former were traversed as if the
expression was their only child, skipping the BraceStmt and implicit
return, while the later was traversed as a normal BraceStmt.
Unify on the latter treatment, so that traversal

There are a few places where we unintentionally relied on this
expression-as-child behavior. Clean those up to work with arbitrary
closures, which is an overall simplification in the logic.
2020-06-04 23:06:32 -07:00
Hamish Knight
60eae88fd1 Sink some parsing options into SourceFile::ParsingFlags
Sink the `BuildSyntaxTree` and
`CollectParsedTokens` bits into
`SourceFile::ParsingFlags`, with a static method
to get the parsing options from the lang opts.

Also add a parsing flag for enabling the interface
hash, which can be used instead of calling
`enableInterfaceHash`.
2020-06-03 11:03:55 -07:00
Hamish Knight
8c20bcd9d8 Merge pull request #32147 from hamishknight/modulo-module 2020-06-02 21:38:40 -07:00
Rintaro Ishizaki
f21279efad Merge pull request #32053 from rintaro/ide-completion-sself-rdar61307680
[CodeCompletion] Suggest 'Self' inside struct, enum and classe
2020-06-02 17:27:01 -07:00
Rintaro Ishizaki
65b8cf76f3 Merge pull request #32086 from rintaro/ide-completion-skipbody-rdar58687608
[CodeCompletion] Skip type checking unrelated statements in function body
2020-06-02 17:10:07 -07:00
Nathan Hawes
51bace649b [IDE][SourceKit/DocSupport] Add members of underscored protocol extensions in extensions of conforming types.
We would previously hide the protocol, its extensions and members, but the '_'
prefix really just means the protocol itself isn't intended for clients, rather
than its members.

This also adds support for 'fully_annotated_decl' entries in doc-info for
extensions to be consistent with every other decl, and removes the
'fully_annotated_generic_signature' entry we supplied as a fallback.

Also fixes several bugs with the synthesized extensions mechanism:
- The type sustitutions applied to the extension's requirements were computed
  using the extension itself as the decl context rather than the extension's
  nominal. The meant the extension's requirements themselves were assumed to
  hold when determining the substitutions, so equality constraints were always
  met. Because of this extension members were incorrectly merged with the base
  nominal or its extensions despite having additional constraints.
- Types within the requirements weren't being transformed when printed (e.g.
  'Self.Element' was printed rather than 'T') both in the interface output and
  in the requirements list. We were also incorrectly printing requirements
  that were already satisfied once the base type was subsituted in.
- If both the protocol extension and 'enabling' extension of the base nominal
  that added the protocol conformance had conditional requirements, we were
  only printing the protocol extension's requirements in the synthesized
  extension.
- The USR and annotated decl output embedded in the 'key.doc.full_as_xml'
  string for synthesized members were printed to match their original context, rather than
  the synthesized one.

Resolves rdar://problem/57121937
2020-06-02 15:38:34 -07:00
Rintaro Ishizaki
3b97b8647c [CodeCompletion] Suggest 'Self' inside struct, enum and classe
In 'protocol', 'Self' is implicitly declared as a generic parameter.
In 'struct' and 'enum', 'Self' is just an alias for the nominal type.
In 'class', 'Self' is a dynamic type and usable only in result types and
inside function bodies.

rdar://problem/61307680
2020-06-02 14:58:10 -07:00
Hamish Knight
d26f4148a9 [CodeCompletion] Replace main module instead of file
Rather than replacing the code completion file
on the `CompilerInstance` whenever we do a cached
top-level completion, let's set a new main module
instead.

This allows us to properly update the
`LoadedModules` map, and allows the retrieval of
the code completion file to be turned into a
request.
2020-06-02 14:25:28 -07:00
Hamish Knight
1bc028ece3 Merge pull request #32091 from hamishknight/standard-error 2020-06-02 14:17:05 -07:00
Nathan Hawes
67d8be7d23 Merge pull request #32087 from rockbruno/index-objcdynamic
[Index][SR-12903] Index `@objc optional` references
2020-06-02 10:23:27 -07:00
Anthony Latsis
267e32dcd8 Merge pull request #32118 from AnthonyLatsis/post-increment-cleanup
[NFC] Pre- increment and decrement where possible
2020-06-02 20:10:29 +03:00
Rintaro Ishizaki
e6ce361042 [CodeCompletion] Rename typeCheckContextUntil to typeCheckContextAt 2020-06-01 12:36:39 -07:00
Rintaro Ishizaki
ebc99c60fb [CodeCompletion] Separate TypeCheckFunctionBodyAtLocRequest
from TypeCheckFunctionBodyRequest, and only do necessary operations.
2020-06-01 12:36:39 -07:00
Anthony Latsis
9fd1aa5d59 [NFC] Pre- increment and decrement where possible 2020-06-01 15:39:29 +03:00
Varun Gandhi
c14e934563 [NFC] Remove redundant includes for llvm/ADT/SmallSet.h. 2020-05-31 13:07:45 -07:00
Bruno Rocha
286b6cbb8f Visit base first 2020-05-30 14:34:42 +02:00
Hamish Knight
ab6c15f4b3 [Frontend] Bail early if the stdlib is missing
Rather than trying to continue the compilation
with an empty main module, let's bail out early if
we expect an implicit stdlib import and fail to
load in the stdlib.
2020-05-29 16:13:42 -07:00
Rintaro Ishizaki
6c61e605f2 [CodeCompletion] Skip typechecking preceding top level decls 2020-05-29 14:45:04 -07:00
Rintaro Ishizaki
0a72d023f3 [TypeChecker] Rename 'typeCheckAbstractFunctionBodyUntil()'
to 'typeCheckAbstractFunctionBodyNodeAt()' because that only typecheck
a statement at the position.
2020-05-29 14:45:04 -07:00
Rintaro Ishizaki
3e200b7783 [CodeCompletion] Skip typechecking unrelated statements in func bodies
rdar://problem/58687608
2020-05-29 14:45:04 -07:00
Bruno Rocha
cd838963a0 Index objcdynamic 2020-05-29 23:44:42 +02:00
swift_jenkins
7406c8a983 Merge remote-tracking branch 'origin/master' into master-next 2020-05-25 17:58:30 -07:00
Hamish Knight
1de3d0dbef Merge pull request #31943 from owenv/line-and-col 2020-05-25 17:57:09 -07:00
swift_jenkins
48e8953fe6 Merge remote-tracking branch 'origin/master' into master-next 2020-05-22 12:38:49 -07:00
Nathan Hawes
2ac1eeed3f Merge pull request #31964 from nathawes/fix-header-interface-lone-get-issue
[IDE][InterfaceGen] Always print the top-level decl in header file generated interfaces.
2020-05-22 12:37:36 -07:00
Nathan Hawes
5cb1f30994 [IDE][InterfaceGen] Always print the top-level decl in header file generated interface.
While the decls being printed for header file generated interfaces were mapped
from the top-level clang decls in that file, the Swift decls they correspond to
may not be top-level. E.g. top-level functions in the header file can be mapped
to property accessors on the Swift side, which were being printed simply as
"get" at the top level.

This updates header interface generation to map each decl to its top-level decl
before printing.

Resolves rdar://problem/63409659
2020-05-21 21:12:17 -07:00
swift_jenkins
5d16b82996 Merge remote-tracking branch 'origin/master' into master-next 2020-05-21 17:59:18 -07:00
Nathan Hawes
defac258ba Merge pull request #31941 from nathawes/pattern-binding-decl-indentation
[SourceKit/CodeFormat] Don't column-align PatternBindingDecl entries in certain cases.
2020-05-21 17:58:21 -07:00
Nathan Hawes
99edbf0e56 [SourceKit/CodeFormat] Don't column-align PatternBindingDecl entries in certain cases.
Don't column align PBD entries if any entry spans from the same line as
the var/let to another line. E.g.

```
// Previous behavior:
let foo = someItem
      .getValue(), // Column-alignment looks ok here, but...
    bar = otherItem
      .getValue()

getAThing()
  .andDoStuffWithIt()
let foo = someItem
      .getValue() // looks over-indented here, which is more common.
getOtherThing()
  .andDoStuffWithIt()

// New behavior
getAThing()
  .andDoStuffWithIt()
let foo = someItem
  .getValue() // No column alignment in this case...
doOtherThing()

let foo = someItem
   .getValue(), // Or in this case (unfortunate, but less common)...
   bar = otherItem
       .getValue()

let foo = someItem.getValue(),
    bar = otherItem.getValue() // but still column-aligned in this case.
```

Resolves rdar://problem/63309288
2020-05-21 11:49:35 -07:00
Owen Voorhees
45bc578ae5 [SourceManager] Rename line and column APIs for clarity 2020-05-21 12:54:07 -05:00
swift_jenkins
e0f00916be Merge remote-tracking branch 'origin/master' into master-next 2020-05-21 09:59:52 -07:00
Rintaro Ishizaki
2eb623ec4c [CodeCompletion] Handle variadic parameter in expr context analysis
for call arguments. Consider variadic arguments 'skippable'. Also, don't
treat 'VarargExpansionExpr' as a "context providing" expression.

rdar://problem/62479469
2020-05-20 22:51:49 -07:00
swift_jenkins
00057cc66a Merge remote-tracking branch 'origin/master' into master-next 2020-05-20 09:19:26 -07:00
Rintaro Ishizaki
522a9fe7c5 Merge pull request #31892 from rintaro/ide-completion-duplicatedmodule-rdar63370253
[CodeCompletion] Avoid suggesting duplicated module names
2020-05-20 09:09:47 -07:00
Rintaro Ishizaki
af27e8f183 [CodeCompletion] Avoid suggesting duplicated module names
in global completion result. Overly modules have the same name as the
shadowed modules. We should not list both names because they are
identical.

Maintain a set of seen module names to avoid suggesting duplicated
names.

rdar://problem/63370253
2020-05-19 15:18:34 -07:00
swift_jenkins
b4fd34bead Merge remote-tracking branch 'origin/master' into master-next 2020-05-19 12:19:26 -07:00
Dmitri Gribenko
b6d0ef5c81 Remove support for a broken std::regex in libstdc++ 4.8
Out of all operating systems ever supported by Swift, only Ubuntu 14.04
had libstdc++ 4.8, and Swift has sunset support for Ubuntu 14.04 for a
while now.
2020-05-19 17:20:55 +02:00
swift_jenkins
3bb3be175e Merge remote-tracking branch 'origin/master' into master-next 2020-05-18 12:38:59 -07:00
Anthony Latsis
55447e66aa Merge pull request #31645 from AnthonyLatsis/relocate-to-iterabledc
[NFC] AST: Relocate some conformance lookup client methods from DeclContext to IterableDeclContext
2020-05-18 22:25:08 +03:00
Erik Eckstein
bdd337cd17 Merge remote-tracking branch 'origin/master' into master-next 2020-05-15 20:13:50 +02:00
Anthony Latsis
643744fa4a Merge pull request #31734 from AnthonyLatsis/gensigimpl-api-cleanup
[NFC] GenericSignatureImpl: Spell conformsToProtocol & getConformsTo in terms of requirements
2020-05-15 09:38:10 +03:00
Anthony Latsis
44a92a926c [NFC] GenericSignatureImpl: Spell conformsToProtocol & getConformsTo in terms of requirements 2020-05-14 22:51:44 +03:00
Rintaro Ishizaki
b8f6471096 Merge pull request #31774 from rintaro/ide-completion-rdar60982638
[CodeCompletion] Avoid re-typechecking pre-checked expressions
2020-05-14 12:48:12 -07:00
Rintaro Ishizaki
3337d7b25b [CodeCompletion] Avoid re-typechcking pre-checked expressions
in expression context analysis. They are simply not necessary.

rdar://problem/60982638
2020-05-13 16:59:06 -07:00
swift_jenkins
10e1981971 Merge remote-tracking branch 'origin/master' into master-next 2020-05-13 13:37:47 -07:00