Commit Graph

1616 Commits

Author SHA1 Message Date
swift-ci
b4bae42909 Merge remote-tracking branch 'origin/master' into master-next 2018-07-21 13:49:33 -07:00
Slava Pestov
bfc4121971 AST: Rework AbstractFunctionDecl construction away from multiple parameter lists
There are two general constructor forms here:

- One took the number of parameter lists, to be filled in later.
  Now, this takes a boolean indicating if there is an implicit
  'self'.

- The other one took the actual parameter lists and filled them
  in right away. This now takes a separate 'self' ParamDecl and
  ParameterList.

Instead of storing the number of parameter lists, an
AbstractFunctionDecl now only needs to store if there is a 'self'
or not.

I've updated most places that construct AbstractFunctionDecls to
properly use these new forms. In the ClangImporter, there is
more code that remains to be untangled, so we continue to build
multiple ParameterLists and unpack them into a ParamDecl and
ParameterList at the last minute.
2018-07-21 07:30:30 -07:00
swift-ci
403cb35abc Merge remote-tracking branch 'origin/master' into master-next 2018-07-20 00:29:49 -07:00
Slava Pestov
090934f6b6 ClangImporter: Remove uses of AbstractFunctionDecl::getParameterLists() 2018-07-19 21:23:44 -07:00
swift-ci
e2acff2bbc Merge remote-tracking branch 'origin/master' into master-next 2018-07-18 23:08:57 -07:00
Doug Gregor
780f8fea93 [Clang importer] Consistently set “isObjC” bit on imported decls. 2018-07-18 14:52:57 -07:00
Doug Gregor
b70466dc63 [Type Checker] Add a request kind for computing 'ValueDecl::isObjC()'.
Still a WIP
2018-07-18 14:50:39 -07:00
Doug Gregor
8f23915334 [Type Checker] Introduce a request for “overridden declarations”.
Introduce a new request kind to capture the computation of the set of
overridden declarations of a given declaration, eliminating the
stateful “setOverriddenDecls()” calls from the type checker.
2018-07-18 14:50:38 -07:00
Doug Gregor
4073055c7a [Clang importer] Remove some now-unnecessary code.
The use of getAsClassOrClassExtensionContext() obviates the need for a
specific isTypeContext() check. NFC.
2018-07-18 14:50:38 -07:00
swift-ci
a792448233 Merge remote-tracking branch 'origin/master' into master-next 2018-07-17 14:09:53 -07:00
Slava Pestov
8d6a55fedb Merge pull request #16655 from davezarzycki/formalize_DeclIsBeingValidatedRAII
[AST] NFC: Formalize Decl validation tracking via RAII
2018-07-17 14:07:53 -07:00
swift-ci
f92c53d847 Merge remote-tracking branch 'origin/master' into master-next 2018-07-16 18:09:01 -07:00
Jordan Rose
986e093e3b [ClangImporter] Remove support for Swift 3 mode (#17722)
Not as exciting as some of the other components, but still!
2018-07-16 17:59:42 -07:00
David Zarzycki
b29d2784ed [AST] NFC: Formalize Decl validation tracking via RAII
After this change, RAII ensures that the validation state is accurate as
possible.
2018-07-12 10:30:26 -04:00
swift-ci
ed21529b6f Merge remote-tracking branch 'origin/master' into master-next 2018-07-06 10:48:57 -07:00
Hamish Knight
c66e68fb93 [Parse][Sema] Emit immediate deallocation warning on the '=' token for PBDs (#17700)
Pass through the location of the equal '=' token for pattern binding decl entries, and use this location for the immediate deallocation diagnostic. Previously, we were just diagnosing on the start of the initialiser expression.

Additionally, this commit moves the call to `diagnoseUnownedImmediateDeallocation` from `typeCheckBinding` to `typeCheckPatternBinding`. This not only gives us easier access to the PBD entry, but also avoids calling the diagnostic logic for statement conditions such as `if let x = <expr>`. We currently never diagnose on these anyway, as the 'weak' and 'unowned' keywords cannot be applied to such bindings.

Resolves [SR-7340](https://bugs.swift.org/browse/SR-7340).
2018-07-06 10:47:49 -07:00
swift-ci
0b12c9a5fa Merge remote-tracking branch 'origin/master' into master-next 2018-07-06 00:49:00 -07:00
Slava Pestov
381483bd74 AST: Remove Expr's LValueAccessKind 2018-07-05 23:54:13 -07:00
Bob Wilson
e468fae196 Merge remote-tracking branch 'origin/master' into master-next 2018-07-04 11:13:51 -07:00
Ben Cohen
2b04e9f105 Suppress a number of warnings in no-assert builds (#17721)
* Supress a number of warnings about things used only in asserts

* Re-use a couple of variables instead of supressing the warning
2018-07-04 07:15:14 -07:00
swift-ci
1b91f00914 Merge pull request #17733 from DougGregor/refactor-override-checking 2018-07-03 22:04:01 -07:00
Doug Gregor
19aa5521a7 [Clang Importer] Always set overridden decls and add ‘override’ attribute. 2018-07-03 17:19:21 -07:00
swift-ci
7f76628302 Merge remote-tracking branch 'origin/master' into master-next 2018-07-03 12:48:54 -07:00
Doug Gregor
6486e6ca49 [Clang importer] Allow us to wire up overrides with generic classes.
A use of "getAs<ClassType>()" when trying to wire up the overrides of
an imported Objective-C initializer meant that imported Objective-C
generic classes didn't get their overrides set properly. This could
lead to redundant initializers; use a proper accessor, since we only
need the ClassDecl anyway.

Fixes SR-8142 / rdar://problem/41591677.
2018-07-03 10:50:24 -07:00
swift-ci
a93ce92de1 Merge remote-tracking branch 'origin/master' into master-next 2018-07-02 20:29:09 -07:00
Doug Gregor
764f14807f [AST] Centralize the storage of the overridden declarations of a declaration.
Several kinds of declarations can override other declarations, but the
computation and storage for these “overridden” declarations was scattered in
at least 3 different places, with different resolution paths. Pull them
all together into two bits of LazySemanticInfo in ValueDecl (“have we computed
overrides?” and “are there any overrides?”), with a side table for the
actual list of overrides.

One side effect here is that the AST can now represent multiple overridden
declarations, although only associated type declarations track this
information.

Start using LazyResolver::resolveOverriddenDecl() more consistently, unifying
it with the separate path we had for associated type overrides. All of this
is staging for a move to the request-evaluator for overridden declaration
computation.
2018-07-02 14:51:28 -07:00
swift-ci
16625f531b Merge remote-tracking branch 'origin/master' into master-next 2018-07-02 10:48:59 -07:00
Hamish Knight
893d33128c Add a convenience PatternBindingDecl::createImplicit member and mark some PBDs as implicit (#17441)
Previously, some PBDs weren't being marked implicit even though the associated vars were implicit. PatternBindingDecl::createImplicit will be even nicer when we start parsing the location of the equals token.
2018-07-02 10:42:03 -07:00
swift-ci
f3b8a3cbaf Merge remote-tracking branch 'origin/master' into master-next 2018-06-30 10:09:20 -07:00
John McCall
f81036202d Merge pull request #17566 from rjmccall/storage-impls
Generalize storage implementations to support generalized accessors
2018-06-30 12:58:33 -04:00
swift-ci
3026500f59 Merge remote-tracking branch 'origin/master' into master-next 2018-06-30 06:29:07 -07:00
John McCall
9bee3cac5a Generalize storage implementations to support generalized accessors.
The storage kind has been replaced with three separate "impl kinds",
one for each of the basic access kinds (read, write, and read/write).
This makes it far easier to mix-and-match implementations of different
accessors, as well as subtleties like implementing both a setter
and an independent read/write operation.

AccessStrategy has become a bit more explicit about how exactly the
access should be implemented.  For example, the accessor-based kinds
now carry the exact accessor intended to be used.  Also, I've shifted
responsibilities slightly between AccessStrategy and AccessSemantics
so that AccessSemantics::Ordinary can be used except in the sorts of
semantic-bypasses that accessor synthesis wants.  This requires
knowing the correct DC of the access when computing the access strategy;
the upshot is that SILGenFunction now needs a DC.

Accessor synthesis has been reworked so that only the declarations are
built immediately; body synthesis can be safely delayed out of the main
decl-checking path.  This caused a large number of ramifications,
especially for lazy properties, and greatly inflated the size of this
patch.  That is... really regrettable.  The impetus for changing this
was necessity: I needed to rework accessor synthesis to end its reliance
on distinctions like Stored vs. StoredWithTrivialAccessors, and those
fixes were exposing serious re-entrancy problems, and fixing that... well.
Breaking the fixes apart at this point would be a serious endeavor.
2018-06-30 05:19:03 -04:00
Slava Pestov
94feb373c8 AST: Remove 'checked inheritance clause' bit from TypeDecl and ExtensionDecl 2018-06-30 00:20:36 -07:00
swift-ci
0305938623 Merge remote-tracking branch 'origin/master' into master-next 2018-06-29 01:29:16 -07:00
swift-ci
109829b181 Merge pull request #17616 from DougGregor/isobjc-without-attr 2018-06-29 01:17:54 -07:00
Bob Wilson
b254041121 Merge remote-tracking branch 'origin/master' into master-next 2018-06-28 23:23:29 -07:00
Doug Gregor
90771a0c0c [AST] Minor fixes to only set the isObjC bit when interop is enabled. 2018-06-28 22:20:15 -07:00
Doug Gregor
346e5da333 [AST] Add bits to capture ValueDecl's "isObjC" state and whether it has been computed.
One small step toward computing "isObjC" via the request-evaluator.
2018-06-28 20:22:44 -07:00
Doug Gregor
64a8619ba5 [Clang importer] Mark call to Builtin.zeroInitializer as non-throwing.
Found while investigating SR-8079.
2018-06-28 14:01:13 -07:00
swift-ci
93582cf46c Merge remote-tracking branch 'origin/master' into master-next 2018-06-27 08:49:23 -07:00
Christopher Rogers
b68ae2e230 Preserve availability on ObjC subscript getters and setters (#17105)
This resolves SR-7398.
2018-06-27 08:35:06 -07:00
swift-ci
a36b6407f4 Merge remote-tracking branch 'origin/master' into master-next 2018-06-22 13:29:27 -07:00
Jordan Rose
2107bdf392 [ClangImporter] Defend against ObjC properties without getters (#17429)
Objective-C provides no way to declare such a thing, so for this to
occur something else must have gone wrong. Unfortunately all we have
is a SourceKit crash log, so I couldn't write a test case. Hopefully
some day the assert will fire and we can handle this properly.

rdar://problem/41305904
2018-06-22 13:27:48 -07:00
swift-ci
2a0e83dc0d Merge remote-tracking branch 'origin/master' into master-next 2018-06-18 11:00:19 -07:00
Jordan Rose
05d0a2dfef [Serialization] Mark decls that can never be cross-referenced (#17223)
This allows us to filter them out in cases that would otherwise be
ambiguous. The particular prompting situation looks a lot like the
test case: a protocol, plus a forward-declared class with the same
name. (Normally we ignore forward-declared classes, but SourceKit's
module interface generation feature makes dummy ClassDecls for them
instead.)

https://bugs.swift.org/browse/SR-4851
2018-06-18 10:50:35 -07:00
swift-ci
4538ce9818 Merge remote-tracking branch 'origin/master' into master-next 2018-06-17 15:38:24 -07:00
John McCall
69f4dd1ec9 Generalize accessor storage to preserve the original accessor list.
Only not NFC because it's detectable by source tools.
2018-06-16 18:16:31 -04:00
swift-ci
bfe796b93e Merge remote-tracking branch 'origin/master' into master-next 2018-06-16 01:32:31 -07:00
Bob Wilson
5df3d1f100 Merge remote-tracking branch 'origin/master' into master-next 2018-06-14 20:51:48 -07:00
Doug Gregor
2b2e143f59 [Request-Evaluator] Introduce a request for getting an "inherited type". 2018-06-14 15:29:57 -07:00