Commit Graph

2015 Commits

Author SHA1 Message Date
Arnold Schwaighofer
7e4ce9a575 Codesign more tests 2018-08-10 06:58:40 -07:00
Slava Pestov
8d4b8e31aa Sema: Remove ScalarToTuple conversion
This either became dead shortly after the removal of Swift 3
compatibility mode from the constraint solver, or even earlier.

Note that the code completion test change is actually correct
because (Any) -> () is not convertible to () -> () in the
language.
2018-08-08 10:18:52 -07:00
Pavel Yaskevich
913f3710c6 Merge pull request #18484 from xedin/diag-req-failures-via-fixes
[ConstraintSystem] Diagnose missing conformance requirements via "fixes"
2018-08-03 19:23:06 -07:00
Pavel Yaskevich
c2bf3d5ba9 [TypeChecker] NFC: Fix all of the diagnostics improved by conformance tracking 2018-08-02 21:55:16 -07:00
Michael Ilseman
8294c0003a [string] Drop _StringGuts subscript; NFC
_StringGuts shouldn't expose a subscript, implying efficient
access. Switch to the explicit code unit fetch method. Update tests
accordingly, and switch off of deprecated typealiases.
2018-08-02 16:34:22 -07:00
Michael Ilseman
ced2e63d95 [test] Make string internal testing a little more robust; NFC
Add an isSmall query to Character so testing doesn't have to bake in
internal format. Clarify the purpose of the invalid UTF-16 backdoor
creation method.
2018-08-02 16:34:19 -07:00
Michael Ilseman
ba6158d74e [test] Internalize _StringGuts; Add shared testing struct; NFC
Create a _StringRepresentation struct to standardize internal testing
on. Internalize much of _StringGuts, except for some SPI hacks, and
update tests to use _StringRepresentation.
2018-08-01 14:23:56 -07:00
Ben Rimmington
2f326bcc88 [stdlib] Remove theGlobalMT19937
SwiftPrivate/PRNG.swift:

- currently uses `theGlobalMT19937`;
- previously used `arc4random` (see #1939);
- is obsoleted by SE-0202: Random Unification.
2018-08-01 13:00:16 +01:00
Mishal Shah
0ef312ff78 Merge pull request #18409 from apple/swift-master-xcode-10-beta-5
Update master to build with Xcode 10 beta 5, macOS 10.14, iOS 12, tvOS 12, and watchOS 5 SDKs
2018-07-31 15:04:02 -07:00
swift-ci
f744bc536b Merge pull request #18379 from milseman/three_free 2018-07-31 13:43:05 -07:00
Mishal Shah
13f5118a92 Update master to build with Xcode 10 beta 5, macOS 10.14, iOS 12, tvOS 12, and watchOS 5 SDKs 2018-07-31 13:05:42 -07:00
Michael Ilseman
a7d3c7079b [test] Adjust String.swift tests for non-small strings on 32b; NFC 2018-07-31 11:23:51 -07:00
Karoy Lorentey
517e7806a0 Merge pull request #17907 from lorentey/crashes-scare-counters2
[test] Re-add crash tests for getObjects:andKeys:count:
2018-07-31 14:55:17 +01:00
Michael Ilseman
534a17aebb [test] Migrate String.swift off of Swift 3; NFC 2018-07-30 17:38:25 -07:00
Michael Ilseman
143e8d9caf [test] Migrate StringViews.swift off of Swift 3; NFC 2018-07-30 17:26:30 -07:00
Mark Lacey
78d83e5703 Use %target-typecheck-verify-swift where possible. 2018-07-26 23:13:43 -07:00
Doug Gregor
059163360a Re-enable Lazy test on Linux.
Arnold fixed this by re-computing the insert position in
getSpecializedConformance(), with
https://github.com/apple/swift/pull/17904.

Fixes rdar://problem/35797159.
2018-07-26 16:07:37 -07:00
Pavel Yaskevich
84cd99a3eb [Diagnostics] Enable extraneous/incorrect label diagnostics via solver fixes
This builds on initial commit which added `RelabelArguments` fix
to the solver that only supported `missingLabels` at that moment,
but now it supports all three posibilities - missing/extraneous and
incorrect labels.
2018-07-25 14:34:26 -07:00
Ben Cohen
345879429b [stdlib] Take several underscored stdlib functions private (#18134)
* Make _sanityCheck internal

* Make _debugPrecondition internal

* Make Optional._unsafelyUnwrappedUnchecked internal.

* Make _precondition internal

* Switch Foundation _sanityChecks to assertions

* Update file check tests

* Remove one more _debugPrecondition

* Update Optimization-with-check tests
2018-07-24 18:26:19 -07:00
Ben Cohen
34610780fd Break out conformances into extensions (#18098)
Replace LoggingRangeReplaceableCollection variants with typealiases

Replace LoggingMutableCollection variants with typealiases.

Collapse BufferAccessLoggingMutableCollection variants into typealiases

Turn LoggingRandomAccessCollection into a typealias

Turn LoggingBidirectionalCollection into a typealias
2018-07-20 12:50:12 -07:00
Mark Lacey
5828a98874 Merge pull request #18032 from rudkx/restore-order
Return to the old disjunction ordering until some test regressions are addressed.
2018-07-17 20:19:35 -07:00
Ben Cohen
074dc43c3e Restore Sequence conformance to FlattenSequence.Iterator (#18024) 2018-07-17 20:00:30 -07:00
Mark Lacey
7fd052efd8 Revert the effect of 6fa403dc7d.
For the moment, return to the old ordering for disjunctions as the new
ordering regressed some type checker performance tests.
2018-07-17 17:27:19 -07:00
Ben Cohen
be894e4510 Replace Random.default with SystemRandomNumberGenerator (#17989) 2018-07-17 13:17:06 -07:00
Mark Lacey
6fa403dc7d [ConstraintSystem] Change the order in which we attempt disjunctions
to be stable.

We currently will stop visiting the elements of a disjunction under
certain circumstances once we have found a solution. The result we get
is inherently dependent on the order in which we determine to visit
the disjunctions themselves (in addition to the elements of the
disjunction).

This change makes the order in which we visit disjunctions
stable. Future commits will create a stable ordering for the elements
of disjunctions. Once we also have that stable ordering in place we
can in theory short circuit more often as part of changing the way in
which we decide what the "best" solution is to a system.

This results in an expression in
validation-test/stdlib/AnyHashable.swift.gyb no longer being able to
typecheck in a reasonable amount of time, so I had to tweak that
expression.
2018-07-16 09:32:14 -07:00
Ben Cohen
bd7171bedf [stdlib] De-gyb Sort (#17954)
* [stdlib] De-gyb Sort
2018-07-15 14:23:06 -07:00
Michael Ilseman
c8ed8f9a2f [test] Update String tests for older iOS versions 2018-07-13 16:08:36 -07:00
Karoy Lorentey
d2861f779e [test] Re-add crash tests for getObjects:andKeys:count:
On some platforms, when a new process is started, ARC’s autoreleased return value optimization is expected to fail the first time it is used in each linked dylib. StdlibUnittest takes care of warming up ARC for the stdlib (libswiftCore.dylib), but for Dictionary.swift, we also need to do it for Foundation, or there will be spurious leaks reported for tests immediately following a crash test.

Add the necessary dummy operations to setUp, and re-add the crash tests that were removed in #17862. (As separate tests this time, so they don’t hide leaks in non-crashing test parts.)
2018-07-13 15:32:52 +01:00
Karoy Lorentey
4832e0ed46 [test] Fix leak and reenable getObjects:andKeys:count: tests 2018-07-12 18:33:00 +01:00
Karoy Lorentey
d1fd33f9b0 [test] Disable getObjects:andKeys:count: tests.
Removing crash tests fixed optimized test runs, but exposed an issue in unoptimized i386 simulator tests.

Disable the two affected tests until we plug all their holes.
2018-07-11 01:42:30 +01:00
Karoy Lorentey
6c97fe4db8 [test] Reenable previously disabled Dictionary tests 2018-07-10 22:42:22 +01:00
Karoy Lorentey
68a5331712 [test] Fix Dictionary failures; reenable previously disabled tests
Crashes somehow interfere with object counters in optimized tests, breaking the tests immediately following a crash test.

Remove getObjects:andKeys:count: crash tests for now.

rdar://problem/41871587
2018-07-10 22:41:54 +01:00
Karoy Lorentey
ea98396dbd [test] Skip two Dictionary tests to unblock CI 2018-07-10 13:13:59 +01:00
Ben Cohen
685f31b0e2 [stdlib] Migrate stdlib tests of Swift 3 (#17427)
* First sweep of Swift 3 stdlib test upgrades

* Review feedback

* Remove a handful more #if >=4.0

* Fix up Dictionary tests
2018-07-08 09:37:01 -07:00
Mark Lacey
dec3341ee0 Merge pull request #17748 from rudkx/remove-swift3-from-some-tests
Remove -swift-version 3 from a handful of tests and update them appro…
2018-07-06 15:59:40 -07:00
Alejandro
79cb33fa78 [SR-8178] Fix BinaryFloatingPoint.random(in:) open range returning upperBound (#17794) 2018-07-06 13:13:19 -04:00
Mishal Shah
95c80cf2ce Merge pull request #17761 from apple/update-master-xcode-10-beta-3
Update master to build with Xcode 10 beta 3, macOS 10.14, iOS 12, tvOS 12, and watchOS 5 SDKs
2018-07-05 15:53:29 -07:00
Mishal Shah
811b1d0879 Update master to build with Xcode 10 beta 3, OS X 10.14, iOS 12, tvOS 12, and watchOS 5 SDKs 2018-07-05 10:57:03 -07:00
Karoy Lorentey
91bb2c0a6c [test] check getObjects:andKeys:count: implementations in bridged Dictionaries 2018-07-05 15:52:11 +01:00
Mark Lacey
5e75b1ad3b Remove -swift-version 3 from a handful of tests and update them appropriately.
These are all tests that would otherwise fail if the expression type
checker support for Swift 3 is removed.

I've moved some of the code from deleted Migrator tests into new
Constraints tests that verify that we do not support the constructs.
2018-07-04 20:58:21 -07:00
Karoy Lorentey
f8e6c304e0 [test] AnyHashable: Shorten class hierarchy tests
AnyHashable.swift.gyb is by far the longest test in debug builds of the test suite. Cut it dramatically shorter by reducing the number of equivalence classes checked in “containing classes from the <foo> hierarchy” tests from 16 down to 3.

(It seems to me the extra test cases didn’t actually test any additional functionality.)
2018-07-02 21:27:37 +01:00
Karoy Lorentey
a4e9109618 Merge pull request #17396 from lorentey/anyhashable-is-not-hashable
[stdlib] Fix AnyHashable's Equatable/Hashable conformance
2018-06-29 17:38:08 +01:00
Ben Cohen
a4230ab2ad [stdlib] Update stdlib to 4.0 and reorganize compatibility shims (#17580)
* Update stdlib to 4.0 and move all compatibility shims into a dedicated source file
2018-06-29 06:26:52 -07:00
Huon Wilson
350f7d8494 [test] Move test using StdlibCollectionsUnittest to validation-test. 2018-06-26 17:43:40 +10:00
Ben Cohen
a51cc89b11 Replace _CharacterView with a typealias (#17472) 2018-06-25 13:22:09 -07:00
Karoy Lorentey
bf872ec157 [stdlib][SE-0206] Use distinct hash encodings for standard integer types
Fix Hashable conformance of standard integer types so that the number of bits they feed into hasher is exactly Self.bitWidth.

This was intended to be part of SE-0206. However, it would have introduced additional issues with AnyHashable. The custom AnyHashable representations introduced in the previous commit unify hashing for numeric types, eliminating the problem.
2018-06-25 20:14:17 +01:00
Karoy Lorentey
ff91f36a9d [stdlib] Fix AnyHashable's Equatable/Hashable conformance
AnyHashable has numerous edge cases where two AnyHashable values compare equal but produce different hashes. This breaks Set and Dictionary invariants and can cause unexpected behavior and/or traps. This change overhauls AnyHashable's implementation to fix these edge cases, hopefully without introducing new issues.

- Fix transitivity of ==. Previously, comparisons involving AnyHashable values with Objective-C provenance were handled specially, breaking Equatable:

    let a = (42 as Int as AnyHashable)
    let b = (42 as NSNumber as AnyHashable)
    let c = (42 as Double as AnyHashable)
    a == b // true
    b == c // true
    a == c // was false(!), now true

    let d = ("foo" as AnyHashable)
    let e = ("foo" as NSString as AnyHashable)
    let f = ("foo" as NSString as NSAttributedStringKey as AnyHashable)
    d == e // true
    e == f // true
    d == f // was false(!), now true

- Fix Hashable conformance for numeric types boxed into AnyHashable:

    b == c // true
    b.hashValue == c.hashValue // was false(!), now true

  Fixing this required adding a custom AnyHashable box for all standard integer and floating point types. The custom box was needed to ensure that two AnyHashables containing the same number compare equal and hash the same way, no matter what their original type was. (This behavior is required to ensure consistency with NSNumber, which has not been preserving types since SE-0170.

- Add custom AnyHashable representations for Arrays, Sets and Dictionaries, so that when they contain numeric types, they hash correctly under the new rules above.

- Remove AnyHashable._usedCustomRepresentation. The provenance of a value should not affect its behavior.

- Allow AnyHashable values to be downcasted into compatible types more often.

- Forward _rawHashValue(seed:) to AnyHashable box. This fixes AnyHashable hashing for types that customize single-shot hashing.

https://bugs.swift.org/browse/SR-7496
rdar://problem/39648819
2018-06-25 20:14:01 +01:00
swift-ci
6ed6b2fd9b Merge pull request #17408 from airspeedswift/one-is-the-loneliest-iterator 2018-06-22 11:54:26 -07:00
Ben Cohen
2eec236f13 Move two more Iterators into nested types 2018-06-21 16:28:20 -07:00
Slava Pestov
e07aefbe74 stdlib: Add -swift-version 3 to two more tests 2018-06-20 22:55:38 -07:00