Commit Graph

2342 Commits

Author SHA1 Message Date
Mike Ash
33b7c04842 [Test] Disable the Runtime.demangleTruncate test on older OSes so it doesn't fail in back deployment testing.
rdar://problem/52357361
2019-07-08 15:34:13 -04:00
Xiaodi Wu
dfb90b7e1c Merge pull request #25745 from xwu/sync-decimal
[Foundation] Synchronize Decimal overlay with swift-corelibs-foundation
2019-07-05 14:42:16 -04:00
Xiaodi Wu
7adc12fd60 Add test for pow(_: Decimal, _: Int) 2019-07-05 12:25:34 -04:00
David Smith
0ae4b0ab64 Merge pull request #25866 from Catfish-Man/someone-set-up-us-the-bom
Bridge non-ASCII SmallStrings as native Swift Strings rather than by creating CFStrings
2019-07-02 23:59:29 -07:00
David Smith
27359bdec6 Bridge non-ASCII SmallStrings as native Swift Strings rather than by creating CFStrings. This gets consistent behavior with non-smol Strings when the String contains a BOM 2019-07-02 16:34:22 -07:00
Mike Ash
5cf7ce7ab4 Merge pull request #25933 from mikeash/uiviewcontrolleradditions-test-folder-fix
[Test] Adjust UIViewControllerAdditions to take individual nib files as arguments rather than the enclosing folder.
2019-07-02 15:59:02 -04:00
Mike Ash
e0031d0b8f [Test] Adjust UIViewControllerAdditions to take individual nib files as arguments rather than the enclosing folder.
remote-run doesn't like copying folders. This achieves the same end result without requiring remote-run to copy folders.

rdar://problem/50503952
2019-07-02 11:05:23 -04:00
Mike Ash
7211a51dc3 Merge pull request #25909 from mikeash/evil-class-initialization-disable-on-10.14
[Test] Disable ObjCEvilClassInitialization.GenericOnEvilClass on <10.15.
2019-07-02 09:52:09 -04:00
Karoy Lorentey
f0291626e3 Merge pull request #25873 from lorentey/RawRepresentable-hashing
[stdlib] RawRepresentable: revert to default _rawHashValue(seed:)
2019-07-01 16:22:57 -07:00
Scott Perry
f994fc3f80 Merge pull request #25808 from numist/numist/diffing-performance-master
Performance improvements and availability updates for Collection.difference(from:using:)
2019-07-01 14:20:07 -07:00
Mike Ash
a47f2eed70 [Test] Disable ObjCEvilClassInitialization.GenericOnEvilClass on <10.15.
rdar://problem/52357504
2019-07-01 12:38:22 -04:00
Karoy Lorentey
09bf1f72b1 [stdlib] RawRepresentable: revert to default _rawHashValue(seed:)
https://bugs.swift.org/browse/SR-10734
2019-06-29 11:49:51 -07:00
Scott Perry
7041d5c511 Fix build on platforms < (macOS 10.15, iOS 13, tvOS 13, watchOS 6, *) by disabling diffing tests 2019-06-27 15:38:12 -07:00
Michael Ilseman
1de84fc531 Merge pull request #23834 from milseman/a_line_scaler
[String] Scalar-alignment bug fixes.
2019-06-27 14:28:09 -07:00
Scott Perry
3ddfff92a6 add CollectionDifference.inverse() and test coverage 2019-06-27 11:40:46 -07:00
Scott Perry
0fc5d6ad31 Performance improvements and availability updates for Collection.difference(from:using:) 2019-06-26 16:55:29 -07:00
Michael Ilseman
4cd1e812b7 [String] Scalar-alignment bug fixes.
Fixes a general category (pun intended) of scalar-alignment bugs
surrounding exchanging non-scalar-aligned indices between views and
for slicing.

SE-0180 unifies the Index type of String and all its views and allows
non-scalar-aligned indices to be used across views. In order to
guarantee behavior, we often have to check and perform scalar
alignment. To speed up these checks, we allocate a bit denoting
known-to-be-aligned, so that the alignment check can skip the
load. The below shows what views need to check for alignment before
they can operate, and whether the indices they produce are aligned.

┌───────────────╥────────────────────┬──────────────────────────┐
│ View          ║ Requires Alignment │ Produces Aligned Indices │
╞═══════════════╬════════════════════╪══════════════════════════╡
│ Native UTF8   ║ no                 │ no                       │
├───────────────╫────────────────────┼──────────────────────────┤
│ Native UTF16  ║ yes                │ no                       │
╞═══════════════╬════════════════════╪══════════════════════════╡
│ Foreign UTF8  ║ yes                │ no                       │
├───────────────╫────────────────────┼──────────────────────────┤
│ Foreign UTF16 ║ no                 │ no                       │
╞═══════════════╬════════════════════╪══════════════════════════╡
│ UnicodeScalar ║ yes                │ yes                      │
├───────────────╫────────────────────┼──────────────────────────┤
│ Character     ║ yes                │ yes                      │
└───────────────╨────────────────────┴──────────────────────────┘

The "requires alignment" applies to any operation taking a
String.Index that's not defined entirely in terms of other operations
taking a String.Index. These include:

* index(after:)
* index(before:)
* subscript
* distance(from:to:) (since `to` is compared against directly)
* UTF16View._nativeGetOffset(for:)
2019-06-26 16:42:58 -07:00
Karoy Lorentey
f336bf0077 [test] Update for availability adjustments in Accelerate 2019-06-25 20:19:07 -07:00
Xiaodi Wu
b2ce4a2ba1 [Foundation] Fix two Decimal members with respect to NaN (#25698)
* Update Decimal.swift

Fix `Decimal.magnitude` so that `Decimal.nan.magnitude` is no longer incorrectly `0`.
Port changes from apple/swift-corelibs-foundation#1759, crucially correcting an error where `(0 as Decimal).doubleValue` returned `.nan`.

* [gardening] Zap indentation error

* Add test for `Decimal.nan.magnitude`

* Apply reviewer suggestion

Clean up `doubleValue`
2019-06-25 08:45:56 -04:00
Mike Ash
bcd9db5a2c [Test] Fix the dlopen_race test to work with remote-run.
The dylib needs to be passed as a command line parameter so that remote-run knows to copy it across.

rdar://problem/51903298
2019-06-19 14:35:50 -04:00
Mike Ash
b70cd7031f Merge pull request #25150 from mikeash/dlopen-race
[Runtime] Fix a race with dlopen and libobjc.
2019-06-18 11:48:49 -07:00
Karoy Lorentey
194dba6c69 Merge pull request #25454 from lorentey/nsvalue-availability
[Foundation] Set correct availability on NSValue.value(of:)
2019-06-17 12:25:17 -07:00
Mike Ash
2ac0ab069a [Runtime] Use objc_addLoadImageFunc when available to find out about newly loaded images.
rdar://problem/49742015
2019-06-14 17:09:28 -04:00
Mike Ash
7696a76577 [Runtime] Add a test case for a race with dlopen and libobjc.
rdar://problem/49742015
2019-06-14 15:06:40 -04:00
Sam Lazarus
2cefbe0d78 Test: Update additional tests with improved generic mismatch diagnostic 2019-06-14 12:35:32 -04:00
Sam Lazarus
de7851b0e9 Test: Update tests to reflect change to generic mismatch note locations 2019-06-14 12:35:32 -04:00
Sam Lazarus
81dc5460c9 Sema / Test: Fix tests broken by introduction of GenericArgumentsMismatchFailure
Additionally, fixed a crash caused by the change relating to opaque types.
2019-06-14 12:35:31 -04:00
Karoy Lorentey
8ae76342f8 [Foundation] Set correct availability on NSValue.value(of:)
(cherry picked from commit 35a47b3a55e113fd1212485b85d808427ccf5dea)
2019-06-13 20:10:06 -07:00
Stephen Canon
2df36527d3 Provide a default implementation of multipliedFullWidth (#25346)
* Provide a default implementation of multipliedFullWidth

Previously, [U]Int64 fatalErrored on 32b platforms, which is obviously undesirable. This PR provides a default implementation on FixedWidthInteger, which is not ideally efficient for all types, but is correct, and gives the optimizer all the information that it needs to generate good code in the important case of Int64 arithmetic on 32b platforms. There's still some minor room for improvement, but we'll call that an optimizer bug now.

* Clarify comments somewhat, remove `merge` nested function

I was only using `merge` in one place, so making it a function seems unnecessary. Also got rid of some trucatingIfNeeded inits where the compiler is able to reason that no checks are needed anyway.

* Add some basic test coverage specifically for multipliedFullWidth

* Fix typo, further clarify bounds comments.

* Make new defaulted implementation @_aEIC so we don't need availability.
2019-06-11 22:02:48 -07:00
Saleem Abdulrasool
9f070edc17 Merge pull request #25308 from Azoy/demangle-bug-thing
[Runtime] swift_demangle: Update buffer size after copying
2019-06-11 16:56:57 -07:00
Julian Lettner
105e4ad592 [TSan] Add positive test for TSan + Dispatch on Linux
1) Enable tests that use `import Dispatch` on Linux. Add substitution
   `%import-libdispatch` that needs to be used for all cross-platform
   tests (i.e., tests that are intended to be run on other platforms
   than Darwin) that do `import Dispatch` or enable thread sanitizer.

2) Make sure as many existing Dispatch and TSan tests as possible run on
   Linux. Mark tests that would require substantial work with
   `UNSUPPORTED: OS=linux-gnu`.

3) Add integration-style Swift test that shows that TSan finds a simple
   race when using `Dispatch.async` incorrectly. A more complete test
   suite for TSan's libdispatch support lives on the LLVM/compiler-rt
   side.

rdar://problem/49177535
2019-06-10 14:24:53 -07:00
Saleem Abdulrasool
62cb79b536 Merge pull request #25213 from compnerd/standard-validation
validation-test: adjust stdlib tests for Windows
2019-06-10 11:35:04 -07:00
Steve (Numerics) Canon
4b5a85a34d Fix a bug in root and add a test case for it.
For odd roots of negative values, we need to take the root of the *magnitude* of the number to avoid a NaN from the platform's implementation of `pow`, then restore the sign afterwards. We had the basic logic in place already, but were missing the step of taking the magnitude first. Also modified a test case to find this error.
2019-06-10 11:50:36 -04:00
Azoy
9bbb85323a add demangle truncate test 2019-06-09 13:54:10 -05:00
Mishal Shah
6c69c8d0bb Merge pull request #25135 from porglezomp-misc/fix/stdlib-unittest-over-release
FIx an overrelease in StdlibUnittest's getSystemVersionPlistProperty
2019-06-03 13:35:04 -07:00
Saleem Abdulrasool
1c41c0887c validation-test: adjust stdlib tests for Windows
The embedded shell script in the RUN command for lit is problematic for
non-sh shell environments (i.e. Windows).  This adjusts the tests to
uniformly build the code for the ObjC runtime.  However, the Objective-C
code is only built under the same circumstances that it is currently
enabled - the availability of the needed frameworks.  The empty object
on other runtimes will have no material impact.  The swift side of it
checks whether the runtime is built with ObjC interop.  This allows us
to largely use the same command line for all the targets.  The last
missing piece is that the `-fobjc-runtime` requires that we run a modern
ObjC runtime.  We enable this unconditionally in lit for the non-Apple
targets.

This improves the validation test coverage for the standard library on
Windows.
2019-06-03 08:36:22 -07:00
Karoy Lorentey
fb55fc3be8 [redux][Foundation] Fix availability of NSValue.value(of:) (#25179)
* [Foundation] Fix availability of NSValue.value(of:)

(cherry picked from commit fbe5563d60)

* [Foundation] NSValue.value(of:): Reinstate runtime OS version check
2019-05-31 17:36:24 -07:00
Pavel Yaskevich
2f3809c5b3 Merge pull request #25149 from xedin/diag-missing-generic-args
[ConstraintSystem] Detect and diagnose missing generic arguments
2019-05-31 13:04:00 -07:00
Arnold Schwaighofer
b31b7a9d8e Remove some UNSUPPORTED swift_test_mode_optimize_none_with_implicit_dynamic
rdar://51228899
2019-05-31 08:45:37 -07:00
Cassie Jones
b7c17988a0 Mark StdlibUnittestOverrelease test as REQUIRES: foundation 2019-05-30 09:05:03 -07:00
Cassie Jones
2d21059030 Fix an over-release in StdlibUnittest
Fixes rdar://51245681
2019-05-29 18:01:39 -07:00
Pavel Yaskevich
c30845fa74 [ConstraintSystem] Detect and diagnose missing generic arguments
Introduce a fix to detect and diagnose situations when omitted
generic arguments couldn't be deduced by the solver based on
the enclosing context.

Example:

```swift
struct S<T> {
}

_ = S() // There is not enough context to deduce `T`
```

Resolves: rdar://problem/51203824
2019-05-29 16:39:41 -07:00
Tatsuya Tanaka
01fc3fe893 Refactor CaseIterableTests 2019-05-29 12:17:41 +09:00
Tatsuya Tanaka
074e310130 make allCases tests more strict 2019-05-28 13:29:19 +09:00
swift-ci
b088acb66e Merge pull request #24767 from ikesyo/remove-unnecessary-breaks 2019-05-25 16:15:06 -07:00
Shengqi Zhu
45112229b6 [Foundation]Fix newValue/oldValue in swift KVO when keyPath having a optional value
Fix https://bugs.swift.org/browse/SR-6066.
2019-05-23 23:32:42 +08:00
David Smith
2dcd82239b Merge pull request #24874 from Catfish-Man/bulk-tests
Test foreign strings on invalid content more thoroughly
2019-05-22 16:28:23 -07:00
Bob Wilson
2e12ac8d74 Merge pull request #24836 from bob-wilson/rdar50173830
[Test] Conditionalize KVOKeyPaths tests that only work with Swift 5.1
2019-05-21 09:38:24 -07:00
David Smith
7561f95134 Test foreign strings on invalid content more thoroughly 2019-05-17 16:18:34 -07:00
Bob Wilson
1e3317be78 [Test] Conditionalize KVOKeyPaths tests that only work with Swift 5.1
Some of the tests in KVOKeyPaths.swift check problems that were not fixed
until Swift 5.1 so they are not expected to pass when running with the
5.0 libraries.

rdar://problem/50173830
2019-05-16 12:57:25 -07:00