Commit Graph

1293 Commits

Author SHA1 Message Date
swift_jenkins
b1cc1ae5ae Merge remote-tracking branch 'origin/master' into master-rebranch 2020-08-18 18:26:20 -07:00
Anthony Latsis
21faa48298 Remove FuncDecl::getBodyResultTypeLoc 2020-08-19 00:09:10 +03:00
swift-ci
6663cb964e Merge remote-tracking branch 'origin/master' into master-rebranch 2020-08-07 07:23:55 -07:00
eeckstein
ea30413cc6 Merge pull request #33288 from eeckstein/string-optimization
AST, SIL: Remove UTF16 encoding from StringLiteralExpr and StringLiteralInst
2020-08-07 16:18:05 +02:00
swift-ci
0dcbd763be Merge remote-tracking branch 'origin/master' into master-rebranch 2020-08-06 15:43:58 -07:00
Erik Eckstein
755f6aa2e4 AST, SIL: Remove UTF16 encoding from StringLiteralExpr and StringLiteralInst
The UTF16 encoding is not used (anymore). I think it became obsolete with the switch to the UTF8 String representation.
2020-08-06 19:09:09 +02:00
Nathan Hawes
ef6c374516 [Sema/Index] Resolve #keyPath components so they can be indexed
Unlike \keypath expressions, only the property components of #keypath
expressions were being resolved, so index wouldn't pick up references for their
qualifying types.

Also fixes a code completion bug where it was reporting members from the Swift
rather than ObjC side of bridged types.

Resolves rdar://problem/61573935
2020-08-05 15:27:52 -07:00
swift-ci
ae09b1eb08 Merge remote-tracking branch 'origin/master' into master-rebranch 2020-08-04 18:03:56 -07:00
Nathan Hawes
607e2b8822 Manually merge remote-tracking branch 'upstream/master' into HEAD 2020-08-04 13:47:48 -07:00
Rintaro Ishizaki
00e4a76ef0 Revert "[Sema/Index] Resolve #keyPath components so they get handled by indexing, semantic highlighting, etc." 2020-08-04 12:51:52 -07:00
Varun Gandhi
3882beb85d [NFC] Use consistent naming scheme for predicate methods. (#33265)
bool throws() -> isThrowing(), bool async() -> isAsync()
2020-08-03 16:37:29 -07:00
Varun Gandhi
270b5dc7a6 Merge pull request #33118 from varungandhi-apple/vg-builder-pattern-ExtInfo
Refactor ExtInfo to use the builder pattern for construction.
2020-08-03 10:30:05 -07:00
Nathan Hawes
4c7cd16c3f Merge pull request #33245 from nathawes/index-key-paths
[Sema/Index] Resolve #keyPath components so they get handled by indexing, semantic highlighting, etc.
2020-08-03 10:28:48 -07:00
Nathan Hawes
1d78fe1211 [Sema/Index] Resolve #keyPath components so they can be indexed
Unlike \keypath expressions, only the property components of #keypath
expressions were being resolved, so index wouldn't pick up references for their
qualifying types.

Also fixes a code completion bug where it was reporting members from the Swift
rather than ObjC side of bridged types.

Resolves rdar://problem/61573935
2020-07-31 17:11:23 -07:00
Varun Gandhi
f219e58ada [NFC] Refactor ExtInfo to use a builder-pattern based API.
Since the two ExtInfos share a common ClangTypeInfo, and C++ doesn't let us
forward declare nested classes, we need to hoist out AnyFunctionType::ExtInfo
and SILFunctionType::ExtInfo to the top-level.

We also add some convenience APIs on (AST|SIL)ExtInfo for frequently used
withXYZ methods. Note that all non-default construction still goes through the
builder's build() method.

We do not add any checks for invariants here; those will be added later.
2020-07-31 13:55:55 -07:00
swift-ci
3a299d5a76 Merge remote-tracking branch 'origin/master' into master-rebranch 2020-07-30 08:23:18 -07:00
Chris Lattner
8bde04cc14 [Concurrency] Implement parsing and semantic analysis of await operator
Similar to `try`, await expressions have no specific semantics of their
own except to indicate that the subexpression contains calls to `async`
functions, which are suspension points. In this design, there can be
multiple such calls within the subexpression of a given `await`.

Note that we currently use the keyword `__await` because `await` in
this position introduces grammatical ambiguities. We'll wait until
later to sort out the specific grammar we want and evaluate
source-compatibility tradeoffs. It's possible that this kind of prefix
operator isn't what we want anyway.
2020-07-29 22:08:09 -07:00
swift-ci
0d8e3e1d71 Merge remote-tracking branch 'origin/master' into master-rebranch 2020-07-29 09:14:39 -07:00
Doug Gregor
41817229d5 Merge pull request #33147 from DougGregor/async-function-types
[Concurrency] Add `async` to the Swift type system.
2020-07-29 08:59:34 -07:00
swift-ci
8724a0117b Merge remote-tracking branch 'origin/master' into master-rebranch 2020-07-29 08:10:41 -07:00
Slava Pestov
c46eb22fcd AST: Don't attach trailing where clause requirements to the GenericParamList
Previously we had two representations for the 'where' clause of a
parsed declaration; if the declaration had generic parameters of
its own, we would store them in the GenericParamList, otherwise
we would store them separately in a TrailingWhereClause instance.

Since the latter is more general and also used for protocols and
extensions, let's just use it for everything and simplify
GenericParamList in the process.
2020-07-28 02:07:16 -04:00
Slava Pestov
14dd4eef2d AST: Add a way to distinguish a parsed generic parameter list from a synthesized one
Add a new GenericContext::getParsedGenericParams(). This produces
the same value as GenericContext::getGenericParams() if the generic
parameter list was written in source. For extensions and protocols,
this returns nullptr without synthesizing anything.
2020-07-28 02:07:16 -04:00
Doug Gregor
f6e9f352f0 [Concurrency] Add async to the Swift type system.
Add `async` to the type system. `async` can be written as part of a
function type or function declaration, following the parameter list, e.g.,

  func doSomeWork() async { ... }

`async` functions are distinct from non-`async` functions and there
are no conversions amongst them. At present, `async` functions do not
*do* anything, but this commit fully supports them as a distinct kind
of function throughout:

* Parsing of `async`
* AST representation of `async` in declarations and types
* Syntactic type representation of `async`
* (De-/re-)mangling of function types involving 'async'
* Runtime type representation and reconstruction of function types
involving `async`.
* Dynamic casting restrictions for `async` function types
* (De-)serialization of `async` function types
* Disabling overriding, witness matching, and conversions with
differing `async`
2020-07-27 18:18:03 -07:00
Nathan Hawes
9d4ed5f39c Manually merge remote-tracking branch 'upstream/master' into manually-merge-master-to-master-rebranch 2020-07-20 16:09:55 -07:00
Michael Gottesman
d2f986739c Merge pull request #32940 from gottesmm/pr-8414ddbc369ed5bb8c0622162de920b962426cf1
[ast] Rename VarPattern -> BindingPattern.
2020-07-18 20:47:21 -07:00
Michael Gottesman
092edd6621 [ast] Rename VarPattern -> BindingPattern.
VarPattern is today used to implement both 'let' and 'var' pattern bindings, so
today is already misleading. The reason why the name Var was chosen was done b/c
it is meant to represent a pattern that performs 'variable binding'. Given that
I am going to add a new 'inout' pattern binding to this, it makes sense to
give it now a better fitting name before I make things more confusing.
2020-07-16 18:56:01 -07:00
Brent Royal-Gordon
acc01aea03 [NFC] Add MagicIdentifierKinds.def
Extracts the list of magic identifier literal kinds into a separate file and updates a lot of code to use macro metaprogramming instead of naming half a dozen cases manually. This is a complicated change, but it should be NFC.
2020-07-13 14:05:13 -07:00
Nathan Hawes
4fd0cdc2ef Fix up calls to clang::Type::dump() now that it requires a clang::ASTContext. 2020-07-07 15:05:34 -07:00
Dan Zheng
71dbe2b65c NFC: silence some -Wrange-loop-analysis warnings. (#32634) 2020-06-30 20:40:20 -07:00
Rintaro Ishizaki
9044aa0376 [AST] ParamDecl::isNonEphemeral() not to evaluate InterfaceTypeRequest
'-dump-parse' for the following code used to hit an assertion failure:

  struct MyStruct {}
  _ = { (val: MyStruct) in }

Because 'isNonEphemeral()' on 'val' parameter unintentionally causes
'InterfaceTypeRequest::evaluate()'. Since 'isNonEphemeral()' inference
based on the interface type is not possible after type checking, return
'false' unless 'hasInterfaceType()'

Also:
  * Dump parameter list on 'EnumElementDecl' as well
  * Adjust the position of 'range=...' in parameter list dumping
2020-06-25 15:01:27 -07:00
Anthony Latsis
01e6cb35a9 Merge pull request #31812 from AnthonyLatsis/substitution-revolution-pre-1
[NFC] AST: Define SubstitutionMap::getInnermostReplacementTypes
2020-06-20 00:11:07 +03:00
Rintaro Ishizaki
4358502676 [CodeCompletion] Update CodeCompletionExpr::dump to dump base exprssion 2020-06-17 13:45:14 -07:00
Robert Widmann
a748d8ed77 [NFC] Fixup RequirementRepr Printing To Use Only the Repr
If a semantic representation of the RequirementRepr is needed, then it should be resolved to a Requirement and printed.
2020-06-11 16:18:23 -07:00
Robert Widmann
e1015761fb [NFC] Reduce usage of TypedPattern::getTypeLoc 2020-06-10 16:51:10 -07:00
Robert Widmann
2371e5c260 Strip TypeLoc from EnumElementPattern 2020-06-10 14:22:46 -07:00
Robert Widmann
fc9070c072 Strip TypeLoc from IsPattern 2020-06-10 13:29:39 -07:00
Robert Widmann
ca728917e1 Merge pull request #32138 from AnthonyLatsis/eliminate-typeloc
Sema: Remove TypeLoc from ExplicitCastExpr (via TypeExpr)
2020-06-10 11:28:50 -07:00
Anthony Latsis
4b4634141f Sema: Remove TypeLoc from ExplicitCast 2020-06-09 15:20:25 +03: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
Doug Gregor
ad42d477f7 [AST] Remove some pointless uses of hasSingleExpressionBody(). 2020-06-03 22:55:23 -07:00
Anthony Latsis
dfbbd727bf [NFC] AST: Rename TypeAliasType::getInnermostGenericArgs to getDirectGenericArgs 2020-05-15 14:07:40 +03:00
Brent Royal-Gordon
ec6bc5bdc9 Merge pull request #31573 from brentdax/explicit-iuo
[NFC] Include implicit-unwrap bit in AST dump
2020-05-06 10:43:01 -07:00
Brent Royal-Gordon
b3f79f7a40 [NFC] Include implicit-unwrap bit in AST dump
There’s a bit in the AST indicating whether a ForceValueExpr is an implicitly-inserted unwrap of an IUO, but it’s not included in the AST dump. Add it.
2020-05-05 19:00:29 -07:00
Hamish Knight
b7320cd6d5 [AST] Collapse two arrays into one
Store an array of Located<Identifier> instead of
an array of Identifiers and SourceLocs on
OperatorDecl. This allows us to cleanup
OperatorPrecedenceGroupRequest a little.
2020-05-01 10:38:34 -07:00
Pavel Yaskevich
a483b344ee [AST] Drop const qualifier from {get/set}Type callbacks 2020-04-29 17:03:45 -07:00
Pavel Yaskevich
87b8f79d2c [AST] Extend ASTNode to support Pattern/TypeLoc 2020-04-29 17:03:45 -07:00
Robert Widmann
f9463922fd Merge pull request #31390 from CodaFi/tone-loc
Strip Out More TypeLocs
2020-04-29 16:46:00 -07:00
Anthony Latsis
882a89b81f Merge pull request #31415 from AnthonyLatsis/se-0267-ast-dump
ASTDumper: print contextual 'where' clauses where necessary
2020-04-30 01:29:11 +03:00
Anthony Latsis
5fe21dc528 ASTDumper: print contextual where clauses on extensions and non-generic type decls 2020-04-29 22:33:38 +03:00
Robert Widmann
f9a506d799 [NFC] Strip EditorPlaceholderExpr of its TypeLoc 2020-04-28 20:10:10 -07:00