Commit Graph

52929 Commits

Author SHA1 Message Date
Erik Eckstein
4efdcebf80 Demangler: make the demangler more tolerant with malformed symbols.
Instead of crashing it just should not demangle malformed symbols.

rdar://problem/32113006
2017-05-16 12:28:32 -07:00
swift-ci
04de6586ef Merge pull request #9631 from DougGregor/gsb-perf swift-DEVELOPMENT-SNAPSHOT-2017-05-16-a 2017-05-15 22:59:03 -07:00
Doug Gregor
9ff7ff73ef Fix up order-dependent test cases 2017-05-15 22:17:19 -07:00
Doug Gregor
cf5424b617 [GSB] Move the Recursive(Concrete|Superclass)Type bits into EquivalenceClass.
Recursive concrete and superclass constraints are detected
per-equivalence-class; record them that way.

Use that information to drop recursive concrete and superclass
constraints from the resulting signature, which frees the canonical
generic signature builder from having to worry about such recursive
constraints. This eliminates the invalid-code crashes introduced in
the prior commit that disabled finalization for the canonical GSBs, as
well as fixing one other random crash-on-invalid.
2017-05-15 22:05:07 -07:00
ematejska
6d8511218f Merge pull request #9636 from ematejska/update_where_clause_warning_to_error
Update where clause warning to error for Swift 4
2017-05-15 21:55:55 -07:00
Pavel Yaskevich
9a07f28ac4 Merge pull request #9587 from xedin/rdar-31973368
[QoI] Extend single tuple parameter diagnostics to function/subscript calls
2017-05-15 21:29:42 -07:00
Mark Lacey
82e60ccce4 Merge pull request #9630 from rudkx/delete-new-test
Remove test added with revert a1ed4e6174.
2017-05-15 21:15:09 -07:00
Slava Pestov
7ce86c0162 Merge pull request #9573 from slavapestov/class-existential-payload-lvalue
Fix mutating method calls on class existentials
2017-05-15 21:07:57 -07:00
Slava Pestov
03ebba50be Sema: Fix lvalue access of class existential payloads
Now that SILGen can correctly lower lvalue accesses of
class existential payloads, remove a hack in Sema that
was simply doing the wrong thing.

Fixes <rdar://problem/31858378>.
2017-05-15 20:14:48 -07:00
Rintaro Ishizaki
04f31a76c0 Merge pull request #7955 from rintaro/parse-ifconfig-validate
[Parse] Separate compilation condition validation and evaluation
2017-05-16 12:06:31 +09:00
Slava Pestov
da80d4b791 Merge pull request #9637 from slavapestov/silgen-existential-lvalue-plumbing
SILGen plumbing for existential lvalue access fixes
2017-05-15 19:57:26 -07:00
Ben Cohen
df76500e9c Re-enable expression_too_complex test and bump memory to 12k per rdar://problem/31794148 (#9635) 2017-05-15 19:50:13 -07:00
Ewa Matejska
fa6e207f62 Updating to have stronger working for warning and review feedback 2017-05-15 18:43:10 -07:00
Pavel Yaskevich
ead1447aa1 [QoI] Extend single tuple parameter diagnostics to function/subscript calls
Properly diagnose cases of function/subscript argument tuple
structuring/destructuring related by not limited to SE-0110.

Resolves: rdar://problem/31973368
2017-05-15 18:41:41 -07:00
Joe Groff
dd1d8891bd Merge pull request #9618 from jckarter/keypath-crashes
Fix some compiler crashing issues found by early adopters of keypaths.
2017-05-15 18:24:06 -07:00
Slava Pestov
31efc6a40a SILGen: Use emitOpenExistentialLValue() when lowering OpenExistentialExprs with lvalue base 2017-05-15 18:17:26 -07:00
Slava Pestov
82ef5b3690 SILGen: Fix LogicalPathComponent::getMaterialized() for opened existentials
This is pretty awkward. If an lvalue has an open existential
as its RValue type, we would emit an alloc_stack instruction
holding the materialized temporary before we emitted the
value itself. This introduced a def-after-use violation
because the open existential type in the stack allocation
was not dominated by its definition.

To get around this, don't use an SGFContext to emit the 'get'
in-place. There's no performance degradation, because the only
time we will attempt materializing an lvalue with an open
existential type is when performing an lvalue access of a
class existential payload, and here we in-place initialization
makes no difference since the value is a single reference.
2017-05-15 18:17:26 -07:00
Slava Pestov
52b3ba1f0a SILGen: Use emitOpenExistentialLValue() when lowering OpaqueValueExprs as lvalues
This is part of allowing lvalue access on class existential
payloads.
2017-05-15 18:17:25 -07:00
Slava Pestov
f4741aa7b6 SILGen: Introduce OpenClassExistentialComponent
This is an LValue component whose value is the class
reference inside of a class existential.

Unlike OpenOpaqueExistentialComponent, this is a logical
component, with a "writeback" consisting of wrapping the
new class reference in a class existential having the
same conformances as the original.

This is slightly awkward, but adding "by-address" operations
on class existentials, and projecting the payload out is
a big change and might not make sense for other reasons.
2017-05-15 18:17:24 -07:00
Joe Groff
366f2389d1 Merge pull request #9628 from jckarter/hide-getKeyPath
Hide the swift_getKeyPath entry point from the standard library API.
2017-05-15 18:01:00 -07:00
Ewa Matejska
09fea35a12 more test updates 2017-05-15 17:46:22 -07:00
Joe Groff
306fce3d62 Merge branch 'master' into keypath-crashes 2017-05-15 17:18:29 -07:00
Doug Gregor
4f8f86ab2f [GSB] Only finalize a canonical GSB when performing expensive assertions.
A `GenericSignatureBuilder` only needs to be finalized when we need to 
compute a generic signature from it or otherwise require diagnostics.
Canonical generic signature builders don’t need either of those, so unless we
are performing the expensive idempotency checking, only do the minimal work
to “process delayed requirements”.

This gives a 3x speedup in type-checking time for the “trivial” example

    let x = [1, 2]

because we do a lot less work on deserialization of generic environments.

Part of rdar://problem/32116933.
2017-05-15 17:16:50 -07:00
Doug Gregor
4f0b322ad9 Switch getOrCreateGenericSignatureBuilder to computeGenericSignature. 2017-05-15 17:16:50 -07:00
Doug Gregor
329fd0c728 [AST] Pass GenericSignature through getOrCreateCanonicalGenericEnvironment().
Rather than having `ASTContext:: getOrCreateCanonicalGenericEnvironment()`
ask its `GenericSignatureBuilder` parameter recompute the generic signature
at nontrivial cost, just pass the known signature through.
2017-05-15 17:16:50 -07:00
Doug Gregor
fef69478f6 [GSB] Introduce computeGenericSignature() for generic signature creation.
The GenericSignatureBuilder requires `finalize()` to be called before a
generic signature can be retrieved with `getGenericSignature()`. Most of the former isn’t strictly needed unless you want a generic signature, and the 
latter is potentially expensive. `computeGenericSignature()` combines the two
operations together, since they are conceptually related. Update most of the
callers to the former two functions to use `computeGenericSignature()`.
2017-05-15 17:16:50 -07:00
Doug Gregor
0324920847 [GSB] Cache the archetype anchor of each equivalence class.
Archetype anchors are (re-)computed often, but shouldn't change all
that much. Cache them in the equivalence class for a ~15% speedup
type-checking the standard library.
2017-05-15 17:16:50 -07:00
Mark Lacey
bc75a797cc Remove test added with revert a1ed4e6174.
I added a test case from one of the failures that were exposed by the
change that I was reverting in
a1ed4e6174,
but I was unable to make this test not dependent on CGFloat. We don't
have that available everywhere, and the mock SDK doesn't support
everything we need here, so I'm just going to remove the test since
adding it isn't absolutely necessary at this time.
2017-05-15 17:12:27 -07:00
Slava Pestov
61c2f2ce69 Merge pull request #9625 from slavapestov/load-expr-fix-and-cleanups
Fix for nested LoadExprs fix and cleanups
2017-05-15 16:53:32 -07:00
Pavel Yaskevich
7ad9cbee99 Merge pull request #9624 from xedin/rdar-32101765
[QoI] Improve diagnostics for Smart KeyPath
2017-05-15 16:51:44 -07:00
Ewa Matejska
10b9feb07e updating current test for swift 4 2017-05-15 16:37:50 -07:00
Ewa Matejska
24a9bea5d6 Adding compatiblity test, updating warning. 2017-05-15 16:26:32 -07:00
Joe Groff
e8e4f8b6af Hide the swift_getKeyPath entry point from the standard library API.
It's intended to be used as a runtime entry point only. rdar://problem/32200848
2017-05-15 16:24:41 -07:00
Joe Groff
faa6bc72f0 Sema: Reject unimplemented key path components during resolveKeyPathExpr.
This is a bit more robust and user-friendly than hoping more brittle recovery in SILGen or IRGen for unsupported components kicks in. rdar://problem/32200714
2017-05-15 16:10:59 -07:00
Joe Groff
69a7ef6e2d Revert "SILGen: Tweak key path computed property lowering to produce a consistent runtime-callable ABI."
This reverts commit 4522cd09aa. This was a failed approach I shouldn't have committed. Fixes rdar://problem/32201589.
2017-05-15 16:10:55 -07:00
Slava Pestov
159807d175 SILGen: Add an assertion to OpenOpaqueExistentialComponent
This component should only be used if the base is an
opaque existential value; otherwise SIL has no way to
express a projection of the payload.
2017-05-15 15:18:00 -07:00
Slava Pestov
8ba21d8947 SILGen: Fix some accesses of values after they've been consumed
We should not touch 'this' after a 'std::move(this)'.
2017-05-15 15:16:48 -07:00
Slava Pestov
4b25945257 SILGen: Fix overlapping LoadExprs
When lowering a LoadExpr, SILGen constructs an LValue
and loads from it to produce an RValue.

If a LoadExpr contains another LoadExpr, the innermost
LoadExpr builds its own LValue, which is then loaded
to an RValue, and turned back into an LValue by creating
a single ValueComponent.

When evaluating an OpenExistentialExpr inside an LValue,
we record the base expression and evaluate it as an LValue
later when we encounter the corresponding OpaqueValueExpr.

The problem is when this is combined with a nested
LoadExpr, we might be inside of a different LValue than
the original LValue that contained the OpenExistentialExpr.

This would trigger an assertion, because the mapping from
OpaqueValueExprs to their base expressions was per-LValue;
instead, it needs to be per-SILGenFunction.
2017-05-15 15:16:48 -07:00
Ewa Matejska
4553d5ea67 Making the where_inside_brackets warning into an Error for > Swift 3. 2017-05-15 15:12:14 -07:00
swift-ci
1d317b2d91 Merge pull request #9612 from devincoughlin/enable-static-exclusivity-by-default 2017-05-15 14:44:41 -07:00
Pavel Yaskevich
8e8ead31d3 [QoI] Improve diagnostics for Smart KeyPath
Add `FailureDiagnostics::visitKeyPathExpr` to try and diagnose contextual
value type problems related to Smart KeyPath feature. If problems with
contextual value type can't be diagnosed let's walk components and see
if there are any structural problems with expression itself e.g. unknown
members and incorrect types in the path.

Resolves: rdar://problem/32101765
2017-05-15 14:43:37 -07:00
Joe Groff
6eaa9ee03c Don't misclassify protocol extension properties as polymorphic.
Part of fixing rdar://problem/32201589.
2017-05-15 14:12:41 -07:00
Joe Groff
ba7a5a80dd Sema: Don't crash when a tuple element is referenced in a key path.
Fixes rdar://problem/32200643. It'd be nice to have a targeted diagnostic too…
2017-05-15 14:12:41 -07:00
Mark Lacey
a1ed4e6174 Merge pull request #9606 from rudkx/revert-ecfa406fc580df48260c6ad606bfd11c10f6ad4c
Revert "Re-instate "Improve disjunction selection""
2017-05-15 13:24:11 -07:00
Roman Levenstein
add5d6782f Merge pull request #9542 from swiftix/inliner-improvements
Inliner improvements
2017-05-15 13:11:17 -07:00
swift-ci
e1a5610228 Merge pull request #9611 from palimondo/stringwalk-header-typo 2017-05-15 12:34:58 -07:00
swift-ci
68092f7c35 Merge pull request #9609 from louisdh/typo-20170515 2017-05-15 12:26:38 -07:00
swift-ci
eed8f55735 Merge pull request #9613 from DougGregor/rename-nskeyedarchive-attributes 2017-05-15 12:16:47 -07:00
swift-ci
a61b981cd9 Merge pull request #9610 from moiseev/no-init 2017-05-15 12:04:22 -07:00
Roman Levenstein
dd93027a0e Always inline pure functions with constant arguments
A function is pure if it has no side-effects.
If there is a call of a pure function with constant arguments, it always makes sense to inline it, because we know that the whole computation will be constant folded.
2017-05-15 11:52:36 -07:00