Commit Graph

4398 Commits

Author SHA1 Message Date
Karoy Lorentey 241f006ddc [test] Fix ~10% false pass rate without local hash seeds 2018-03-16 14:58:24 +00:00
Karoy Lorentey acfc1b90d4 [test] Test that hashed collections use local hash seeds 2018-03-15 16:30:44 +00:00
swift-ci 1bdf5e41eb Merge pull request #15215 from xedin/rdar-37790062-perf-followup 2018-03-13 14:23:26 -07:00
Pavel Yaskevich 5795215928 [crashers] NFC: Limit time spent in solver for crashers 28684 and 28686 2018-03-13 13:28:58 -07:00
Karoy Lorentey b0108336f7 Merge pull request #15207 from lorentey/seedless-hashes
[runtime] Add better control over the random hashing seed
2018-03-13 19:46:51 +00:00
Karoy Lorentey e5eed66b67 [test] Add tests verifying hash randomization. Update tests for new names. 2018-03-13 16:29:43 +00:00
Andrew Trick bf0463cdc1 Disable Lazy.swift on Ubuntu 16.04.
Even without ASAN this failes with "corrupted double-linked list".

<rdar://problem/35797159> [Associated Type Inference] Swift CI: 1. OSS - Swift ASAN - Ubuntu 16.04 (master) heap-use-after-free ASTContext::getSpecializedConformance llvm::FoldingSetBase::InsertNode
2018-03-13 08:59:51 -07:00
Andrew Trick 725da7f303 Disable Lazy.swift under Linux ASAN.
Waiting for a fix for <rdar://35797159> [Associated Type Inference]
Swift CI: 1. OSS - Swift ASAN - Ubuntu 16.04 (master)
heap-use-after-free ASTContext::getSpecializedConformance
llvm::FoldingSetBase::InsertNode
2018-03-12 15:29:31 -07:00
Joe Groff 3fd2d2165e Merge pull request #15145 from jckarter/trimming-metadata
Trimming metadata
2018-03-12 06:55:59 -07:00
Joe Groff f01af883fc IRGen: Use known value witness tables for common type layouts.
If a type has the same layout as one of the basic integer types, or has a single refcounted pointer representation, we can use prefab value witness tables from the runtime instead of instantiating new ones. This saves quite a bit of code size, particularly in the Apple SDK overlays, where there are lots of swift_newtype wrappers and option set structs.
2018-03-11 11:04:37 -07:00
Karoy Lorentey 8cf5bc8bdc [stdlib] Switch to using SipHash-1-3 as the standard hash function
Beyond switching hashing algorithms, this also enables per-execution hash seeds, fulfilling a long-standing prophecy in Hashable’s documentation.

To reduce the possibility of random test failures, StdlibUnittest’s TestSuite overrides the random hash seed on initialization.

rdar://problem/24109692
rdar://problem/35052153
2018-03-09 14:48:59 +00:00
Karoy Lorentey 42cab58554 [stdlib] Dictionary, Set: Use resilient hashing
This switches the primary hashing interface from hashValue to _hash(into:).
2018-03-09 14:35:19 +00:00
Karoy Lorentey 54b857ed0b [stdlib] Hashable: Add support for resilient hashing
Introduce _Hasher, representing an opaque hash compression function.

Add the method _hash(into:) as a Hashable requirement, decoupling the choice of hash function from Hashable's implementation. The default implementation of _hash(into:) has a default implementation that simply feeds hashValue to the hasher.

Add _hash(into:) implementations for the default integer types. Note that Int.hashValue does not return self anymore.

Add struct _LegacyHasher, emulating Swift 4.1 hashes in the new interface.
2018-03-09 14:34:57 +00:00
swift-ci 9bda1e5c55 Merge pull request #13340 from glessard/umbp-failearlyrangecheck 2018-03-08 05:38:39 -08:00
Karoy Lorentey b52a94d789 [test] Fix tests relying on specific hash values or Set/Dictionary orderings
We shouldn't need to update regular tests if/when we modify the hash function.
2018-03-07 16:44:43 +00:00
Slava Pestov 47c6117a9b Sema: Remove deprecated SWIFT_FUNC_STAT counters 2018-03-06 19:42:52 -08:00
Slava Pestov 6065168928 Parse: Test that we only parse function bodies in primary files
I added this optimization a while ago but didn't add a test for it.
2018-03-06 19:42:43 -08:00
Doug Gregor e49dbf5664 Merge pull request #15002 from DougGregor/gsb-ext-typealias-inherited-assoc-sr-7097
[GSB] Always ensure that we wire up typealiases in protocol extensions.
2018-03-06 09:57:23 -08:00
Jordan Rose d8104e7e43 Evolution tests: Don't bother testing changing a class's superclass (#15000)
We're okay with saying this is a binary-breaking change, and its
presence in these tests is interfering with testing other things.

rdar://problem/36932507
2018-03-06 08:48:49 -08:00
swift-ci abbaa47614 Merge pull request #12504 from glessard/umbp-nonmutating-setter 2018-03-06 06:37:58 -08:00
Doug Gregor 823d2a990b [GSB] Always ensure that we wire up typealiases in protocol extensions.
During "expansion" of the requirements of a protocol, we check all of
the inherited associated types against definitions within the
protocol. Also look for concrete types within extensions of that
protocol, so we can identify more places where developers have used
typealiases in inheriting protocols to effect a same-type constraint
on an inherited associated type.

Fixes SR-7097 / rdar://problem/38001269.
2018-03-05 17:10:39 -08:00
Ben Cohen 7c99c68672 Add test for ArraySlice.popLast 2018-03-02 13:32:27 -08:00
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