Commit Graph

21018 Commits

Author SHA1 Message Date
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
Jordan Rose
28b3d8e0a7 [Serialization] Preserve whether a raw value is explicit (#26324)
...which allows the AST printer to correctly choose whether to print
it, which means it can be printed in a module interface in a non-WMO
build, which is necessary for @objc enums to have a correct run-time
representation when clients use that interface.

rdar://problem/53469608
2019-07-24 10:25:42 -07:00
Slava Pestov
12fa06a4d4 Merge pull request #26316 from slavapestov/finish-storage-impl-info
Sema: Move finishStorageImplInfo() to StorageImplInfoRequest evaluation
2019-07-24 06:31:15 -04:00
Xi Ge
bdb892556e Merge pull request #26318 from nkcsgexi/52982457
AST: avoid unnecessarily calling getStartLoc() to avoid exponential growth of the stack trace
2019-07-23 19:07:59 -07:00
Slava Pestov
8047ddae82 Sema: Move finishStorageImplInfo() to StorageImplInfoRequest evaluation
This merges Sema's special logic for updating the ImplInfo of lazy properties
and property wrappers with the StorageImplInfoRequest.

I had to move some code from the parser into the StorageImplInfoRequest, to
avoid request cycles caused by hasStorage() calls; this is the right thing to
do anyway.

Since hasStorage() now answers false for lazy properties and property wrappers,
we have to move some diagnostic checks from checkDeclAttributesEarly() to
the StorageImplInfoRequest implementation itself.

Over time, I expect all of the checks currently in checkDeclAttributesEarly()
and checkDeclAttributes() to either migrate to requests, or typeCheckDecl().
2019-07-23 22:00:31 -04:00
Slava Pestov
e88f0c2a9a Merge pull request #26282 from slavapestov/storage-impl-info-request
Use a request to compute AbstractStorageDecl::getImplInfo()
2019-07-23 21:12:32 -04:00
Xi Ge
d9c4a77fb5 AST: avoid unnecessarily calling getStartLoc() to avoid exponential growth of the stack trace
Issuing multiple getStartLoc() from sub-expression can exponentially grow the stack trace.
When the expression under analysis is complex enough, this could be a user-noticeable hang.
This patch fixes UnresolvedDotExpr::getStartLoc() by 'refactoring' the result of SubExpr->getStartLoc()
to a local variable.

rdar://52982457
2019-07-23 16:22:55 -07:00
Holly Borla
10a4e3ef41 Merge pull request #26278 from hborla/existential-type-supported-request
Sema: implement `existentialTypeSupported` using a request evaluator.
2019-07-23 14:05:35 -07:00
Slava Pestov
60e1dfe8b9 Sema: Use a request to compute AbstractStorageDecl::getImplInfo()
This just moves the code from the parser into a request. Sema will
still overwrite the ImplInfo field for lazy properties and
property wrappers; refactoring that is next.
2019-07-23 16:13:28 -04:00
Slava Pestov
ac9a3bf34a Sema: Add counters for synthesized accessors 2019-07-23 16:13:28 -04:00
Slava Pestov
3d6c5d84c0 Merge pull request #26289 from slavapestov/fix-requires-stored-property-inits
Sema: Fix inheritance of @requires_stored_property_inits
2019-07-23 16:12:52 -04:00
Joe Groff
03dcccb828 Merge pull request #26287 from jckarter/disable-property-wrapper-composition
Disable property wrapper composition.
2019-07-23 12:39:12 -07:00
Slava Pestov
4eec522578 Sema: Fix inheritance of @requires_stored_property_inits
Previously we would copy this attribute from a superclass to the
subclass when validating a subclass. However, this is only correct
if the superclass is always guaranteed to have been validated
before the subclass.

Indeed, it appears this assumption is no longer true, so we would
sometimes lose track of the attribute, which would result in SILGen
failing to emit the ivar initializer entry point.

Instead, check for the attribute as part of the superclass walk
in checkAncestry(), ensuring the result is always up to date, correct,
and cached.

As a follow-up, we should also convert checkAncestry() into a
request, but I'm not doing that here to keep the fix short.

Fixes <rdar://problem/50845438>.
2019-07-23 12:23:27 -04:00
Slava Pestov
755c02c079 Merge pull request #26235 from slavapestov/accessor-refactoring
Split off StorageImplInfo from AccessorRecord
2019-07-22 23:17:15 -04:00
Joe Groff
5e08f7da32 Disable property wrapper composition.
There are ABI-affecting bugs with composition like SR-11138, so disable until those bugs can be
fixed. rdar://problem/53428736
2019-07-22 19:50:01 -07:00
Xi Ge
2f867eb052 Merge pull request #26276 from nkcsgexi/resolve-protocol-name-request
IDE+Evaluator: refactor resolveProtocolName to using the request evaluator, NFC
2019-07-22 18:12:15 -07:00
Slava Pestov
454281b226 AST: Split off StorageImplInfo from AbstractStorageDecl::AccessorRecord
We want to compute the former independently of the latter.
It's only 16 bits so storing it inside the Decl is fine;
it also allows us to eliminate the 'compact' representation
where an AbstractStorageDecl without an accessor record is
assumed to be stored.
2019-07-22 20:19:09 -04:00
Slava Pestov
a532a325e1 AST: Move a few methods from VarDecl down to ParamDecl 2019-07-22 20:19:09 -04:00
Slava Pestov
87199d572e Merge pull request #26190 from theblixguy/chore/cache-override-signature
[AST] Cache the override generic signatures
2019-07-22 19:59:06 -04:00
Jordan Rose
493c07f718 Merge pull request #26228 from jrose-apple/einstein
[ModuleInterface] Honor -disable-modules-validate-system-headers
2019-07-22 15:51:54 -07:00
Xi Ge
1cb746b47c IDE+Evaluator: refactor resolveProtocolName to using the request evaluator, NFC 2019-07-22 15:35:14 -07:00
Holly Borla
9f19597f73 Sema: implement existentialTypeSupported using a request evaluator.
Add the request `ExistentialTypeSupportedRequest` to lazily determine
if we are allowed to refer to an existential type conforming to a
protocol.
2019-07-22 15:35:10 -07:00
Xi Ge
b4ce18a92f Merge pull request #26268 from nkcsgexi/ide-type-checking-request
IDE+Evaluator: refactor the implementation of two type checker utilities to evaluator requests. NFC
2019-07-22 13:59:56 -07:00
Pavel Yaskevich
c28174a26c Merge pull request #26262 from xedin/new-diag-for-non-matching-overloads
[CSDiagnostics] Use special error message when call didn't match exactly
2019-07-22 13:46:40 -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
Pavel Yaskevich
783add0ea4 [CSDiagnostics] Split no exact match diagnostic into three choices
1. If this is a special name avoid printing it because
   printing kind is sufficient;

2. If all of the labels match, print a full name;

3. If labels in different choices are different, it means
   that we can only print a base name.
2019-07-22 12:32:17 -07:00
Pavel Yaskevich
caf266f4b1 [CSDiagnostics] Use special error message when call didn't match exactly
For multiple solutions with fixes for the same call, replace
`ambiguous reference` diagnostic with the one that explicitly
mentions that there are no exact matches, and provide partially
matched candidates as notes.
2019-07-22 11:20:56 -07:00
Michael Gottesman
7c6816f2aa Merge pull request #26252 from gottesmm/pr-26f2be9085e39bcfada4ac0e174959d83d1bf8bd
[closure-lifetime-fixup] Delete dead trivial phi nodes.
2019-07-19 17:46:46 -07:00
Michael Gottesman
819a56e680 [cfg] Extract out erasePhiArgument utility from SimplifyCFG -> CFG.h.
I needed this functionality to fix an edge case bug in closure lifetime fixup.
2019-07-19 16:01:54 -07:00
Xi Ge
be609e82ef Merge pull request #26230 from nkcsgexi/evalutor-collect-overriding-decls
IDE+Evaluator: refactor the implementation of two common IDE utilities to the evaluator model
2019-07-19 14:11:25 -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
Holly Borla
ab995ecbaa Merge pull request #26229 from hborla/existential-conforms-to-self-request
Sema: implement `existentialConformsToSelf` using a request evaluator.
2019-07-19 10:22:23 -07:00
Pavel Yaskevich
5fe29a719b Merge pull request #26219 from theblixguy/fix/SR-11060
[CSDiag] Add a new diagnostic for @propertyWrapper implicit init call missing arguments
2019-07-19 09:45:37 -07:00
Jordan Rose
88405bc2f3 [ModuleInterface] Honor -disable-modules-validate-system-headers
The point of this flag is to avoid re-checking the whole SDK on every
build, since under many circumstances you can assume it hasn't
changed. That worked for Clang modules, but Swift cached modules also
end up with dependencies that shouldn't be updated.

rdar://problem/53279521
2019-07-18 18:38:31 -07:00
Holly Borla
2225cb2f41 Sema: implement existentialConformsToSelf using a request evaluator.
Add the request `ExistentialConformsToSelfRequest` to lazily determine
if an existential conforming to a protocol can be matched with a
generic type parameter constrained to that protocol.
2019-07-18 17:06:16 -07:00
Xi Ge
e5e469f330 Merge pull request #26217 from nkcsgexi/index-util-ide-type
IDE: move two AST traversal utilities from libIndex to IDE type checking
2019-07-18 16:58:10 -07:00
Xi Ge
ab86991958 IDE: move two AST traversal utilities from libIndex to IDE type checking. NFC 2019-07-18 16:17:10 -07:00
Suyash Srijan
f47f5c44e4 [CSDiag] Adds a new diagnostic for implicit propertyWrapper initializer 2019-07-18 23:06:03 +01:00
Suyash Srijan
cbdc853cba [AST] Move GenericSignatureKey to ASTContext.cpp 2019-07-18 19:26:44 +01:00
Rintaro Ishizaki
6d73ed368e Merge pull request #26139 from vguerra/SR-11006
[Diagnostics] Improve diagnostic when using == instead of = for defau…
2019-07-18 19:23:44 +02:00
Holly Borla
2fdae648b7 Merge pull request #26201 from hborla/protocol-requires-class-request
Sema: implement `requiresClass` using a request evaluator.
2019-07-18 10:13:43 -07:00
Jordan Rose
d3193f8e23 Merge pull request #26149 from theblixguy/fix/SR-11134
[Parser] Diagnose use of subscript inside an array literal
2019-07-18 10:04:22 -07:00
eeckstein
63a1a42643 Merge pull request #26185 from eeckstein/old-condfail
Support the old single-parameter Builtin.condfail
2019-07-18 13:38:47 +02:00
swift-ci
e597b950d9 Merge pull request #25893 from owenv/desugar_confusing_types_for_diagnosis 2019-07-17 17:48:41 -07:00
Suyash Srijan
9a33b00ed2 [AST] Use getPointer() to compare the types in OverrideSignatureKey 2019-07-18 00:18:46 +01:00
Holly Borla
71fb2629ac Sema: implement requiresClass using a request evaluator.
Add the request `ProtocolRequiresClassRequest` to lazily determine if a
`ProtocolDecl` requires conforming types to be a class.

Note that using the request evaluator to compute `requiresClass` introduces
cycle errors for protocol declarations, where this computation didn't
previously emit diagnostics. For now, we'll allow duplicate diagnostics in this
case, with the eventual goal of removing explicitly checking for cycles
via `checkCircularity` (instead letting the request evaluator handle cycle
diagnostics).
2019-07-17 16:04:24 -07:00
Suyash Srijan
603a5df584 [AST] Use DenseMap for the cache 2019-07-18 00:03:00 +01:00
Daniel Rodríguez Troitiño
b479db0b22 Merge pull request #26192 from gottesmm/pr-c08ae1abeba47206bc05b6bd5f09f221128960cb
Remove constexpr to satisfy MSVC being what it is.
2019-07-17 15:43:49 -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
00d3a398bb Merge pull request #26191 from nkcsgexi/range-info-request
IDE+Evaluator: refactor range info resolver to an IDE evaluator request. NFC
2019-07-17 14:28:00 -07:00