Commit Graph

12606 Commits

Author SHA1 Message Date
practicalswift
27eabd4fb5 Merge pull request #8498 from practicalswift/gardening-20170403
[gardening] Fix typos. Fix headers. Python cleanups.
2017-04-12 16:41:33 +02:00
practicalswift
b704f1448b [gardening] Improve header consistency 2017-04-12 15:13:11 +02:00
swift-ci
c523ca44ad Merge remote-tracking branch 'origin/master' into master-next 2017-04-12 01:08:31 -07:00
practicalswift
7684e73388 Merge pull request #8706 from practicalswift/excess-logic
[gardening] Remove redundant logic
2017-04-12 09:51:49 +02:00
Slava Pestov
b756f76a66 Sema: Update 'can be represented in @objc' logic for subclass existentials 2017-04-12 00:07:30 -07:00
Slava Pestov
b5ae8c4de6 AST: Add mangling for class-constrained existentials 2017-04-12 00:07:29 -07:00
Slava Pestov
c38f53d128 AST: Add ExistentialLayout::isErrorExistential() 2017-04-12 00:07:29 -07:00
Slava Pestov
5a10c4ea8b AST: Bring back old meaning of mayHaveSuperclass() 2017-04-12 00:07:28 -07:00
swift-ci
c591dcc9bc Merge remote-tracking branch 'origin/master' into master-next 2017-04-11 23:28:32 -07:00
Doug Gregor
5dadfa8fac Merge pull request #8707 from DougGregor/gsb-delayed-reqs
[GSB] Basic infrastructure for delaying and reprocessing requirements
2017-04-11 23:28:27 -07:00
swift-ci
a743b1b8fc Merge remote-tracking branch 'origin/master' into master-next 2017-04-11 17:28:32 -07:00
Robert Widmann
5b3c4b6844 [NFC] Use the presence of an argument type to check for associated values (#8679)
* Use the presence of an argument type to check for associated values

hasOnlyCasesWithoutAssociatedValues returns true for any serialized
enum declaration whether or not it has cases.  This never really came
up because it's mostly relevant to Sema's proto-deriving mechanism.  Fix
this by using the presence of the case's argument type instead.

* Separate checks for presence of cases and enum simplicity

Necessary because the old behavior was an artifact of the
implementation.
2017-04-11 20:13:17 -04:00
Doug Gregor
148f6383df [GSB] Basic infrastructure for delaying and reprocessing requirements. 2017-04-11 14:15:46 -07:00
Doug Gregor
10ebdcd50a [GSB] Broaden the Boolean result of "add a constraint" operations.
Rather than true (an error occurred) or false (the constraint was
resolved), introduce ConstraintResult to better model what
happened. NFC for now, but the intent here is to report unresolved
constraints through this mechanism.
2017-04-11 14:15:45 -07:00
practicalswift
5e255e07d7 [gardening] Remove redundant logic 2017-04-11 23:04:55 +02:00
swift-ci
0b0efa274c Merge remote-tracking branch 'origin/master' into master-next 2017-04-11 13:08:34 -07:00
Arnold Schwaighofer
4d60ec333b AST/SILGen support for constant string literals
rdar://30545013
2017-04-11 11:41:43 -07:00
Jordan Rose
d0a9ec509e [Serialization] Drop overriding properties with missing bases.
Like the previous commit, but with added trickiness because we also
serialize the form of the PatternBindingDecl a property came from.
Make getPattern handle a failure in the simple case that overrides
use, and pass that up to the PatternBindingDecl initialization. (This
can result in zero-element PatternBindingDecls, but that's fine.)

'getPattern' is also a change from 'maybeGetPattern', but every caller
knows how many patterns it expects, so accomodating the "maybe" case
is no longer important.
2017-04-11 10:37:30 -07:00
swift-ci
5ba89103a7 Merge remote-tracking branch 'origin/master' into master-next 2017-04-11 09:28:31 -07:00
Arnold Schwaighofer
b167b4475d Add SIL and IRGen support for a ConstantStringLiteral instruction
This supports a utf8 or utf16 encoding.

rdar://30545013
2017-04-11 08:43:47 -07:00
swift-ci
532f18aeb0 Merge remote-tracking branch 'origin/master' into master-next 2017-04-11 01:08:32 -07:00
swift-ci
6956926264 Merge pull request #8686 from rjmccall/access-enforcement-selection-pass 2017-04-11 00:49:29 -07:00
John McCall
b9676d2002 Add a SIL pass to select an access enforcement for allocated boxes.
Tests to come.
2017-04-11 03:10:51 -04:00
swift-ci
1c269dc87e Merge remote-tracking branch 'origin/master' into master-next 2017-04-10 18:08:52 -07:00
Slava Pestov
a5fd009bf6 Merge pull request #8650 from slavapestov/subclass-existentials
Preliminary Sema and AST support for subclass existentials (SE-0156)
2017-04-10 17:56:52 -07:00
Slava Pestov
de323b5bef Sema: Update resolveType() for subclass existentials
If the -enable-experimental-subclass-existentials staging flag
is on, resolveType() now allows protocol compositions to contain
class types. It also diagnoses if a composition has more than one
superclass requirement.

Also, change diagnostics that talked about 'protocol composition'
to 'protocol-constrained type'.

Since such types can now contain a superclass constraint, it's not
correct to call them protocol composition.

"Protocol-constrained type" isn't quite accurate either because
'Any' has no protocols, and 'AnyObject' will have no protocols but
a general class constraint; but those are edge cases which won't
come up in these diagnostics.
2017-04-10 17:11:07 -07:00
swift-ci
29e74e91c4 Merge remote-tracking branch 'origin/master' into master-next 2017-04-10 17:08:32 -07:00
Jordan Rose
e26c08f588 Merge pull request #8666 from jrose-apple/more-experimental-deserialization-recovery
More -enable-experimental-deserialization-recovery
2017-04-10 17:07:52 -07:00
Slava Pestov
b1d22ffad2 AST: Update TypeBase::mayHaveSuperclass() for subclass existentials 2017-04-10 17:05:43 -07:00
Slava Pestov
ad417c96ad AST: Update ProtocolCompositionType::requiresClass() for subclass existentials
Whether a protocol composition requires a class is no longer
solely a property of what protocols it contains; now, a
protocol composition consisting of a non-class constrained
protocol and a superclass should return true from requiresClass().

This is done by looking at the ExistentialLayout, instead of
walking the members directly.
2017-04-10 17:05:43 -07:00
Slava Pestov
32a7505847 AST: Update ProtocolCompositionType::get() for subclass existentials
Don't assume all members are existential types; we could have
a class (or a class-constrained existential) also, and this
needs to be handled.

When building a canonical protocol composition, the subclass
requirement always comes first in the list of types. This is
an important invariant allowing ExistentialLayout to be
calculated quickly.

Also, calculate the recursive properties of the composition
type from the recursive properties of its members, since they're
no longer trivial if the composition contains a class member
with generic parameters.
2017-04-10 17:05:42 -07:00
Slava Pestov
9c3b514c7e AST: New getExistentialLayout() method on TypeBase and CanType
This consolidates calculations which need to look at every
protocol in an existential type. Soon we will also have to
deal with superclass constrained existentials, so start
updating call sites that look at all protocols to use the
new ExistentialLayout and correctly handle a class constraint
as well.

Also, eventually I will kill off the AnyObject protocol and
model it as a protocol composition with no protocols or
superclass, but the requiresClass() flag set.

This is not quite modeled this way yet and AnyObject still
exists, but the new abstraction is a step in the right
direction.
2017-04-10 17:04:37 -07:00
Slava Pestov
143c91a892 Sema: Remove unused method declaration 2017-04-10 17:04:35 -07:00
Slava Pestov
efb3d428ab AST: Do the right thing when constructing ConcreteDeclRef with empty substitutions
This allows always using the constructor that takes substitutions,
passing in an empty list if there are none.
2017-04-10 17:04:35 -07:00
Jordan Rose
7e8d642e8e [Serialization] When crashing, note if mix-and-match may be to blame.
That is, a Swift 3 target imported into a Swift 4 context or vice
versa. This requires serializing the compatibility mode explicitly,
instead of including it in the textual version string that's only
for debugging.
2017-04-10 16:38:58 -07:00
Joe Groff
7eebb27153 Sema: Infer the specific type of a key path literal from the mutability of the resolved components. 2017-04-10 16:06:40 -07:00
swift-ci
a2abf3b876 Merge remote-tracking branch 'origin/master' into master-next 2017-04-10 14:48:43 -07:00
swift-ci
4ef9465fe0 Merge pull request #8668 from atrick/fix 2017-04-10 14:47:45 -07:00
Andrew Trick
2eb6d48b1c [AccessMarker] Fix a reverse instruction iterator.
I reversed this loop's direction over the instruction list and forgot to change
the order of erasing an instruction with respect to advancing the iterator.

Thankfully ASAN is far smarter than I.

Converting between forward/reverse iterators makes the loop unreadable.
Add an iterator return value to BasicBlock::erase(SILInstruction*).
2017-04-10 14:08:59 -07:00
swift-ci
80a6ad1920 Merge remote-tracking branch 'origin/master' into master-next 2017-04-10 14:08:30 -07:00
Jordan Rose
e7d1027e8a Merge pull request #8580 from jrose-apple/enable-experimental-deserialization-recovery
[Serialization] Proof-of-concept: drop overriding methods if the base is missing
2017-04-10 13:57:33 -07:00
swift-ci
5eb44b61e7 Merge remote-tracking branch 'origin/master' into master-next 2017-04-10 11:28:33 -07:00
swift-ci
a36bdff69f Merge pull request #8657 from DougGregor/gsb-dependent-type-cleanup 2017-04-10 11:20:23 -07:00
Doug Gregor
fb8023736f [GSB] Eliminate unnecessary "dependentType" parameters throughout.NFC
Now that ProtocolRequirement sources can compute their own stored
types, stop propagating that information through the GSB.
2017-04-10 10:14:01 -07:00
swift-ci
6df122082f Merge remote-tracking branch 'origin/master' into master-next 2017-04-10 09:48:31 -07:00
Andrew Trick
4355cad83e Add a pass to eliminate access markers. 2017-04-10 09:47:50 -07:00
Andrew Trick
44110e361d Add a HasAccessMarkers flag to SILFunction.
This allows the verifier to be run before and after marker elimination.
2017-04-10 09:47:50 -07:00
Doug Gregor
7900decb09 [GSB] Compute the dependent type for ProtocolRequirement sources.
The dependent type that is the subject of a ProtocolRequirement
source is independently computable based on the root potential
archetype of the source and the potential archetype to which the
requirement applies, i.e., it's just the dependent member type that
gets from the former to the later. Compute this directly, rather than
relying on the passed-down dependent type.

This is possible now because we no longer capriciously rebase
requirements onto the representatives of equivalence classes, nor
destroy any other structural information in the formation of potential
archetypes.
2017-04-10 09:21:44 -07:00
swift-ci
1513ff70d4 Merge remote-tracking branch 'origin/master' into master-next 2017-04-09 21:48:32 -07:00
Devin Coughlin
bee17f7838 [SILDiagnostics] Add static enforcement of Law of Exclusivity (#8560)
Add a diagnostic pass that emits errors when a violation of the "Law of
Exclusivity" is detected at compile time. The Law of Exclusivity requires
that the access duration of any access to an address not overlap
with an access to the same address unless both accesses are reads.

This pass relies on 'begin_access' and 'end_access' SIL instruction
markers inserted by SILGen to determine when an access to an address begins and
ends. It models the in-progress accesses with a map from storage locations to
the counts of read and write-like accesses in progress for that location.
2017-04-09 21:41:13 -07:00