Commit Graph

4476 Commits

Author SHA1 Message Date
Ben Cohen
2380950fa7 [stdlib] Collapse DropWhileBidirectionalCollection and de-gyb DropWhile.swift (#14906)
Collapse DropWhileBidirectionalCollection and de-gyb DropWhile.swift
2018-03-02 07:53:06 -08:00
Ben Cohen
f50afde523 Collapse PrefixWhileBidirectionalCollection and de-gyb PrefixWhile.swift (#14910) 2018-03-01 14:13:48 -08:00
Lance Parker
e0e50e9b3e Add failing test 2018-02-28 11:27:40 -08:00
Doug Gregor
46e623a089 [SubstitutionMap] Handle conformance lookup via superclass requirements.
Conformances that discoverably for a type parameter via a superclass
requirement occupy a bit of a gray area in the type checker and
generic signature handling right now: we have a type parameter (so the
paths that handle concrete conformances don't kick in), but the
conformance itself isn't modeled as a requirement because it is
available via lookup. Teach SubstitutionMap's conformance lookup to
detect this case and perform conformance lookup in the generic
signature (i.e., falling back to global lookup) in this case,
replicating the hack that IRGen uses to address the same issue when
accessing the conformance (see GenArchetype.cpp's TODO where we lookup
a conformance on the superclass). The removal of that hack (as well as
this one) are tracked by rdar://problem/34609744.

For now, fixes SR-7072 / rdar://problem/37904576.
2018-02-26 23:31:46 -08:00
Pavel Yaskevich
75e90cac20 Merge pull request #14798 from xedin/rdar-35870863
[TypeChecker] Fix crash related to chained optionals in case statements
2018-02-23 11:09:45 -08:00
Pavel Yaskevich
ea0427e9f9 [TypeChecker] Fix crash related to chained optionals in case statements
Type checker didn't handle the safe of disjoint optional chaining when trying
to convert such chaining into `.Some` cases, which leads to dangling
`BindOptionalExpr` in the AST.

Resolves: rdar://problem/35870863
2018-02-22 19:33:48 -08:00
Jordan Rose
63ec4e21fb Add a (tiny) test that adding "final" to a file rebuilds dependents
I can't see how we'd ever get this wrong at this point, but way back
in the early days of incremental builds we apparently managed to.
Adding a test just to close this out.

rdar://problem/23148987
2018-02-22 16:56:07 -08:00
Lance Parker
7cc222e271 Ditched the simple/complex test distinction as they all pass now (#20) 2018-02-19 10:09:24 -08:00
Lance Parker
0661de22a2 [stdlib]Un-revert string comparison (#14694)
Restore (un-revert) sting comparison, with fixes

More exhaustive testing of opaque strings, which consistently reproduces prior sporadic failure. Shims fixups. Some test tweaking.
2018-02-18 10:50:33 -08:00
Lance Parker
abe6a6d177 Revert string comparison (#14657) 2018-02-15 14:37:43 -08:00
Lance Parker
49bc1459ae Update string comparison tests 2018-02-14 15:44:11 -08:00
Mark Lacey
1aa5e8c925 Disable this test, which is failing in some branches. 2018-02-13 22:19:45 -08:00
Pavel Yaskevich
79d706463b Merge pull request #13664 from xedin/finalize-expr-type-cache
[ConstraintSystem] Only set types on expressions in presence of solution
2018-02-13 21:43:34 -08:00
swift-ci
86ccbd8b77 Merge pull request #14617 from DougGregor/gsb-avoid-unresolved-dependent-member-types 2018-02-13 18:06:08 -08:00
Doug Gregor
8b04dd3dbe [GSB] Avoid unresolved dependent member types in generic signatures.
The GenericSignatureBuilder is allowing unresolved dependent member
types to creep into generic signatures, which eventually blows up in
name mangling. Prefer to pick dependent member types that are
fully-resolved when choosing anchors.

This is a spot fix; a better approach would eliminate the notion of
unresolved dependent member types entirely from
PotentialArchetype. That's tracked by rdar://problem/35839277.

Fixes rdar://problem/36549499.
2018-02-13 15:40:53 -08:00
Pavel Yaskevich
8c17b925e6 [ConstraintSystem] Add TypeLoc caching to constraint system
This is useful for explicit casts and type expressions, where
type loc and expression types might be different, and allows
constraint solver to avoid setting opened types to expressions
which resolves multiple crashes.
2018-02-13 00:08:56 -08:00
Mark Lacey
37009b0d8b [ConstraintSystem] Remove constraint propagation.
The current implementation isn't really useful in the face of generic
overloads. It has never been enabled by default, and isn't useful to
keep around if it is disabled. If we ever want to bring it back,
we know where to look!
2018-02-12 21:30:39 -08:00
Joe Groff
4cffc9fa3f Update validation tests for diagnostic message change from #14391. 2018-02-09 11:56:04 -08:00
Doug Gregor
dee02c42a4 Update test cases for constraint solver performance hack 2018-02-08 22:57:05 -08:00
Doug Gregor
3d32e89e33 [Constraint solver] Favor more-specialized overload among two generics.
When we form an overload set containing two generic functions, where
one is more specialized than the other, "favor" the more-specialized
function in the constraint system so we won't explore any paths
involving the less-specialized function when the more-specialized
version applies. This should be a strict improvement, because
previously we would have always gone down both paths.

Fixes rdar://problem/37371815, taking this exponential example linear.
2018-02-08 20:41:13 -08:00
Jordan Rose
f9299e711c [test] rth: Use dynamic linking to properly test backwards-deployment (#14447)
The added test worked before as well; it's to make sure I didn't break
the existing behavior.
2018-02-08 17:14:10 -08:00
Pavel Yaskevich
c6ff7b40cc [CSBindings] Look through optional types when trying to validate l-valueness of the new bindings
When bindings are picked for particular type variable, right-hand
side of the binding might be another type variable wrapped into optional
type, when trying to determine if both sides of the binding have the
same l-valueness it's imperative to look throught optional type of the
right-hand side. Otherwise new binding might be effectively unsolvable.

Resolves: rdar://problem/37291371
2018-02-08 01:55:39 -08:00
Pavel Yaskevich
1a0221398b Merge pull request #14419 from xedin/rdar-36989792
[DeclChecker] Don't try to derive conformances for invalid enums
2018-02-05 16:43:45 -08:00
Pavel Yaskevich
38e305cfdc [DeclChecker] Don't try to derive conformances for invalid enums
If one of the cases is invalid, let's mark parent enum as invalid
as well, and avoid trying to derive any conformances related to it.

Resolves: rdar://problem/36989792
2018-02-05 14:12:55 -08:00
Ben Cohen
415d90c72c Move collection compat test that needs StdlibCollectionUnittest to validation-test 2018-02-05 13:19:41 -08:00
Huon Wilson
bc37733daf Merge pull request #14293 from huonw/nested-conditional-types
[GSB] Infer requirements from parents of types.
2018-02-05 09:50:10 +11:00
Ben Cohen
9ee856f386 [stdlib][WIP] Eliminate (Closed)CountableRange using conditional conformance (#13342)
* Make Range conditionally a Collection

* Convert ClosedRange to conditionally a collection

* De-gyb Range/ClosedRange, refactoring some methods.

* Remove use of Countable{Closed}Range from stdlib

* Remove Countable use from Foundation

* Fix test errors and warnings resulting from Range/CountableRange collapse

* fix prespecialize test for new mangling

* Update CoreAudio use of CountableRange

* Update SwiftSyntax use of CountableRange

* Restore ClosedRange.Index: Hashable conformance

* Move fixed typechecker slowness test for array-of-ranges from slow to fast, yay

* Apply Doug's patch to loosen test to just check for error
2018-02-01 20:59:28 -08:00
Ben Cohen
072aedcdb7 Use LifetimeTracked for Array.popLast test (#14334) 2018-02-01 19:47:28 -08:00
Pavel Yaskevich
fb199ffb92 [TypeChecker] Mark perf test-case for rdar://problem/22282851 as fast
Recent changes to contraction of the closure argument/parameter type
variables resulted in speed up in type-checker performance which resolved
one of existing "slow" test-cases.
2018-02-01 15:27:37 -08:00
Huon Wilson
9aed3e83a8 [GSB] Infer requirements from parents of types.
A type Foo<...>.Bar may only exist conditionally (i.e. constraints on the
generic parameters of Foo), in which case those conditional requirements
should be implied when Foo<...>.Bar is mentioned.

Fixes SR-6850.
2018-02-02 08:44:30 +11:00
Pavel Yaskevich
d49d8f0c5d Merge pull request #14308 from xedin/rdar-36838495
[CSSolver] Fix performance regression related to contraction of closure parameters
2018-01-31 15:52:45 -08:00
Pavel Yaskevich
3b7e555c7e [CSSolver] Fix performance regression related to contraction of closure parameters
Improve situation around closure parameter/argument contractions
by allowing such action if it can be proved that none of the bindings
would result in solver attempting to bind parameter to `inout` type.

Resolves: rdar://problem/36838495
2018-01-31 14:21:14 -08:00
Karoy Lorentey
77992d37f0 Merge pull request #14033 from lorentey/rdar/35995647
[Foundation] Coalesce duplicate String keys in bridged NSDictionary and NSSet
2018-01-31 11:57:31 +00:00
Andrew Trick
dd2e3480e2 Add a test case for AST verification of loaded modules in WMO.
Prior to the following commit, the SILVerifier will assert
on this test case.

PR: 14250 <https://github.com/apple/swift/pull/14250>

commit deebe8b9c7
Author: Andrew Trick <atrick@apple.com>
Date:   Mon Jan 29 15:22:28 2018

    performTypeChecking: Defer verifyAllLoadedModules in WMO mode.
2018-01-30 13:55:08 -08:00
Pavel Yaskevich
6a45971c3c [IRGen/Resilience] Add a test case for rdar://problem/36560486
Since field offsets are now encoded after generic parameters, it
is useful to validate that using generic parameter metadata is now
more resilient in presence of new fields.
2018-01-29 23:25:29 -08:00
Greg Parker
e223f1fc9b [IRGen][runtime] Simplify runtime CCs and entry point ABIs (#14175)
* Remove RegisterPreservingCC. It was unused.
* Remove DefaultCC from the runtime. The distinction between C_CC and DefaultCC
  was unused and inconsistently applied. Separate C_CC and DefaultCC are
  still present in the compiler.
* Remove function pointer indirection from runtime functions except those
  that are used by Instruments. The remaining Instruments interface is
  expected to change later due to function pointer liability.
* Remove swift_rt_ wrappers. Function pointers are an ABI liability that we
  don't want, and there are better ways to get nonlazy binding if we need it.
  The fully custom wrappers were only needed for RegisterPreservingCC and
  for optimizing the Instruments function pointers.
2018-01-29 13:22:30 -08:00
Michael Gottesman
c48196f892 Fix the build by making the test arc_36509461.swift only run on macosx.
rdar://36916944
2018-01-29 10:32:37 -08:00
Michael Gottesman
75c0572afa As per Jordan's request, move execution_crashers => execution.
I thought these were all execution time crashers, but I was incorrect. Some are
just execution tests that take a little bit to run.
2018-01-29 10:31:51 -08:00
Jordan Rose
f9c40c3a14 [test] Disable Michael's ARC+ASan test on 32-bit iOS simulator
Some configurations are still failing on some Apple-internal bots.  I
filed rdar://problem/36952273 to look into it and re-enable the test.
2018-01-27 17:41:15 -08:00
Michael Gottesman
c3ed87515d Change the executable test arc_36509461.swift to use %target-run so it runs properly on the simulator.
rdar://36916944
2018-01-26 12:24:22 -08:00
Michael Gottesman
a01a5ade83 Move arc_36509461 execution crasher into the executable_crasher test directory. 2018-01-26 12:20:25 -08:00
Michael Gottesman
5947e04298 Rename ./validation_test/execution => execution_crashers to match the names of the compiler_crasher. 2018-01-26 12:19:20 -08:00
Doug Gregor
e0c39396cc Merge pull request #14154 from DougGregor/sr-6746-test-case
Add now-fixed test case for SR-6746 / rdar://problem/36483751.
2018-01-25 09:37:18 -08:00
Pavel Yaskevich
261ffe4d5c Merge pull request #14100 from xedin/rdar-36449760
[ConstraintSystem] Bind Self to correct contextual type for nested types in protocol
2018-01-25 00:57:41 -08:00
swift-ci
6e3d980e7e Merge pull request #14142 from DougGregor/assoc-type-inference-recursion 2018-01-25 00:25:06 -08:00
Doug Gregor
3806d56fb7 Add now-fixed test case for SR-6746 / rdar://problem/36483751. 2018-01-24 23:46:57 -08:00
Doug Gregor
597c955948 [Associated type inference] Find tentative type witnesses across protocol hierarchy.
As a minor step toward more global associated type inference,
allow tentative type witnesses to be found across a protocol
hierarchy, eliminating some recursion through associated type
inference. Fixes a recent regression in validation-test/stdlib/CollectionTypes.swift, as well as rdar://problem/36453271.
2018-01-24 23:01:21 -08:00
Pavel Yaskevich
a11263b156 [ConstraintSystem] Bind Self to correct contextual type for nested types in protocol
If something that we are trying to contextually bind is a nested type inside
protocol or protocol extension, let's try to find the innermost conforming type
from the current declaration context and map Self parameter of the protocol
to that nominal type. Since nested types in protocols aren't yet implemented this
is going to result in failure, but that's better than crashing.

Resolves: rdar://problem/36449760
2018-01-24 18:21:26 -08:00
Doug Gregor
24aa030f0c [Associated type inference] Break recursive inference and fail predictably.
There was a path through associated type inference where we would end
up recording a type witness that contained an error, but for which we
had not reported that error, which would lead to downstream
crashes. Make sure that we reject such inferences.

And because it triggers once we fix this issue... make sure break
recursion when trying to resolve type witnesses lazily.

Fixes the crash in SR-6609 / rdar://problem/36038033, but we're still
failing to infer in those cases.
2018-01-24 15:58:26 -08:00
Jordan Rose
8dad8994c1 [test] Disable parse_stdlib.sil on Apple platforms to unblock builders (#14098)
Tracked within Apple by <rdar://problem/36754225> Swift CI:
parse_stdlib.sil tests failing with vtable verification. The error is
an assertion failure that we haven't traced back to its cause yet:

    Assertion failed: (EntriesSZ == VTableEntryCache.size() && "Cache
    size is not equal to true number of VTable entries"), function
    verify, file /Users/buildnode/jenkins/workspace/
    oss-swift-package-osx/swift/lib/SIL/SILVerifier.cpp, line 4747.
2018-01-24 08:45:09 -08:00