Commit Graph

165 Commits

Author SHA1 Message Date
Slava Pestov
1602580303 SIL: Sort vtable entries for synthesized methods
Completes the fix for <rdar://problem/35647420> and
<https://bugs.swift.org/browse/SR-6468>.
2018-04-20 12:36:02 -07:00
Mark Lacey
32d006de4a stdlib: Collapse some multi-line closures to single-line closures.
The change in CheckMutableCollectionType.swift.gyb previously resulted
in a runtime failure, and before that a compiler crash.

It appears that whatever type checker bug(s) were causing the issue
have been resolved in the last few months, so I'm returning this
closure to a single-expression form and cleaning up a couple other
places where we had an unneeded temporary as well.

Resolves rdar://problem/33781464.
2018-04-03 22:26:33 -07:00
Greg Parker
072e9827aa Use SwiftObject's old name when building for the pre-stable ABI.
rdar://35554345
2018-03-26 14:04:30 -07:00
David Zarzycki
f5ae7b2584 [validation tests] Improve concurrency
This improves 'ninja check-swift-validation' by about 35% on my Linux desktop.
2018-03-21 09:28:51 -04:00
Greg Parker
9637b4a6e1 [runtime] Rename class SwiftObject to Swift._SwiftObject. (#13748)
SwiftObject needs to be renamed to avoid ObjC class name collisions between
the Swift stable ABI and older Swift apps.

rdar://35554345
2018-01-09 16:16:55 -08:00
Ben Cohen
4ddac3fbbd [stdlib] Eradicate IndexDistance associated type (#12641)
* Eradicate IndexDistance associated type, replacing with Int everywhere

* Consistently use Int for ExistentialCollection’s IndexDistance type.

* Fix test for IndexDistance removal

* Remove a handful of no-longer-needed explicit types

* Add compatibility shims for non-Int index distances

* Test compatibility shim

* Move IndexDistance typealias into the Collection protocol
2017-12-08 12:00:23 -08:00
Hamish
79d8209ffa [stdlib] Use addressor for Dictionary's subscript(_:default:) 2017-11-19 15:45:27 +00:00
Michael Gottesman
89cefe0a70 [stdlib] Use a different access pattern to check uniqueness to work around more conservative SILGen codegen.
Using && here causes us to go down a SILGen path that guarantees that self will
be evaluated over the entire && expression instead of just the LHS. This cause
the uniqueness check to always return false at -Onone. At -O, the optimizer is
smart enough to remove this issue.

rdar://33358110
2017-11-18 20:16:28 -07:00
Karoy Lorentey
ed5b202c8f [stdlib] Implement -retainCount in _SwiftNativeNS*Base
Fixes rdar://problem/28002554.
2017-09-26 14:32:20 -07:00
Lance Parker
07b9232235 Correctly handle big endian systems, updated the comment for va_arg usage 2017-09-25 12:38:18 -07:00
Lance Parker
6056ebede1 Add tests for Bool’s conformance to CVarArg 2017-09-22 09:53:47 -07:00
Lance Parker
276f49af84 Merge pull request #11982 from lancep/comprehensiveArrayTests
[stdlib] Comprehensive array tests
2017-09-20 13:01:59 -07:00
Lance Parker
09d73a87ed Only import Foundation on Darwin platforms 2017-09-18 16:26:51 -07:00
Lance Parker
2839e78b45 Fix Linux build 2017-09-18 14:20:55 -07:00
Lance Parker
6ff5310260 Moved helpers to a new file 2017-09-18 11:51:59 -07:00
Greg Parker
0bae31c1f0 [runtime] Add some missing -isNSWhatever__ methods to SwiftObject. (#11891)
SR-5636, rdar://33764085
2017-09-13 03:01:37 -07:00
Mark Lacey
b64551b853 [stdlib] Restore signatures to use UnsafeMutableBufferPointer.
Resolves rdar://problem/21933004.
2017-08-31 22:33:36 -07:00
Greg Parker
f3bd55eb52 [runtime] Implement SwiftObject -methodForSelector: and +instanceMethodForSelector:.
Fixes SR-5577 and rdar://33606034.
2017-08-23 17:11:47 -07:00
Dave Abrahams
8aabc03c75 [stdlib] Strip allocator implementation dependencies from a test
These tests depend on the specific characteristics of the memory allocator under
use.  In particular, if the allocator decides to return a larger memory block
than requested, the tests may fail.

I can only make wild guesses as to why changes to String would cause this test
to fail on Linux, but that's what we're observing.

  check failed at .../swift/validation-test/stdlib/Inputs/CommonArrayTests.gyb, line 159
  8 >= 9
2017-07-26 15:58:05 -07:00
Itai Ferber
aa317ba860 Add ObjC unit test to verify NSNumber bridging 2017-07-24 13:20:02 -07:00
Michael Gottesman
ab6a4f5249 Disable some failing tests.
rdar://33358110
2017-07-19 16:25:39 -07:00
Ben Cohen
4d7ae8ca85 [stdlib] Fix array slice self-assignment bug (#10958)
* Fix bug where assigning from self wasn't checking bounds of the assigned slice matched

* break up if statement
2017-07-17 13:09:35 -07:00
Michael Ilseman
a37a823e6e [stdlib] Update non-contiguous NSStrings to Unicode 9
This adds Unicode 9 grapheme breaking support for non-contiguous
NSStrings. Non-contiguous NSStrings that don't hit our fast paths are
very rare, but should still behave identically to contiguous
strings.

We first copy a fixed number of code units into a fixed size buffer
(currently 16 in size) and try to grapheme break inside of that
buffer. This is sufficient storage for all known non-pathological
graphemes. Any graphemes larger than the buffer are handled by copying
larger portions of the string into an Array.

Test cases added, including pathological "zalgo" text that stresses
extremely long graphemes.
2017-06-28 15:35:25 -07:00
Philippe Hausler
c40ba96328 [Foundation] Correct data subscript indexing to be offset from the base index (#9816) 2017-05-24 09:43:56 -07:00
Michael Ilseman
75c476b984 Revert "Add Codable conformance to common Foundation types"
This reverts commit dee889f4d0.
2017-05-17 11:56:31 -07:00
Itai Ferber
dee889f4d0 Add Codable conformance to common Foundation types
Add conformances + unit tests for
* CGFloat
* AffineTransform
* Calendar
* CharacterSet
* DateComponents
* DateInterval
* Decimal
* IndexPath
* IndexSet
* Locale
* Measurement
* NSRange
* PersonNameComponents
* TimeZone
* URL
* UUID

along with some unit tests for each.
2017-05-16 16:57:46 -07:00
Andrew Trick
da0c4db530 Fix and enable testing stdlib Collection instances.
Top-level entry points fully testing a collection instance:
check${Traversal}Collection

One level of recursion into all slices of the collection instance
O(n^2). (Not combinatorial).

Previously, checkCollection() did nothing. So much of the testing infrastructure was inactive. Now it runs all forward collection tests.

Fixes a bug in subscriptRangeTests.

The UnsafeRawBufferPointer and Data collection testing is disabled and
will be fixed in the following commit.
2017-04-06 17:12:18 -07:00
Andrew Trick
849421799a Revert "SE-0138: Proposed amendment to SE-0138: Normalize UnsafeRawBufferPointer Slices (#8222)"
This reverts commit 1d32586d28.
2017-04-06 10:38:52 -07:00
Andrew Trick
1d32586d28 SE-0138: Proposed amendment to SE-0138: Normalize UnsafeRawBufferPointer Slices (#8222)
* Add sliceability tests for Unsafe(Raw)BufferPointer.

Improve the generic sliceability tests to verify that SubSequence indices are
compatible with their parents indices.

* Fix and enable testing stdlib Collection instances.

Top-level entry points fully testing a collection instance:
check${Traversal}Collection

One level of recursion into all slices of the collection instance
O(n^2). (Not combinatorial).

Previously, checkCollection() did nothing. So much of the testing infrastructure was inactive. Now it runs all forward collection tests.

Fixes a bug in subscriptRangeTests.

The UnsafeRawBufferPointer and Data collection testing is disabled and
will be fixed in the following commit.

* Give UnsafeRawBufferPointer a distinct slice type.

SubSequence = RandomAccessSlice<Self>

* Fix raw buffer pointer tests after changing the API

* Add UnsafeRawBuffer(rebasing:) initializers.

Allows converting a raw slice into a zero-based raw buffer,
which is a common operation on flat memory.

Add and update UnsafeRawBufferPointer unit tests.

* Do not run recursive O(n^2) collection slice testing on large collections.

Now, even with collection unit testing wired up, the validation tests
take the same amount of time to execute.

* Add init(rebasing:) to UnsafeBufferPointer.

This is required for consistency with UnsafeRawBufferPointer.

* Update CHANGELOG.md for SE-0138 amendment: UnsafeRawBufferPointer slice type.
2017-04-06 10:08:09 -07:00
Philippe Hausler
6c26b80e6e [Foundation] Rework the backing storage for CharacterSet to be more performant and bridge correctly to objective-c and CF
Some cases of using isSuperset can cause crashes, this was caused by improper subclassing callouts; this pr resolves those failures (and provides unit tests for that case)
The cases where the bridge was traversed too much now only causes a single bridge out call (without needing to reallocate or thrash retain/release)
String.components(separatedBy: CharacterSet) should be considerably faster now not only for more apporpriate bridging calls but also no longer needing to bridge arrays back and forth.

Resolves the following issues:
rdar://problem/17281998
rdar://problem/26611771
rdar://problem/29738989
2017-03-31 11:06:38 -07:00
Joe Groff
294913e114 Fix _stdlib_getErrorDefaultUserInfo to have the signature the runtime expects.
The ABI mismatch here would cause a crash in cases when the Foundation overlay wasn't available, or its implementation of swift_Foundation_getErrorDefaultUserInfo wasn't dynamically resolvable, such as in a stripped statically linked binary. Fixes rdar://problem/29173132.
2017-03-08 14:56:02 -08:00
Max Moiseev
c059b45a0b [validation-test] Splitting Arrays.swift.gyb into multiple files
In order to parallelize tests more and avoid a single long running
bottleneck.

<rdar://problem/30269532>
2017-02-03 17:06:55 -08:00
practicalswift
6d1ae2a39c [gardening] 2016 → 2017 2017-01-06 16:41:22 +01:00
practicalswift
797b80765f [gardening] Use the correct base URL (https://swift.org) in references to the Swift website
Remove all references to the old non-TLS enabled base URL (http://swift.org)
2016-11-20 17:36:03 +01:00
Alexis Beingessner
7ec26fc976 fallout of renaming on tests which rely on internals
Some of these are kinda dubious, but I think this would be better
addressed as part of eager bridging, which will invalidate the concept
most of these are checking for.
2016-11-03 19:55:36 -04:00
Alexis Beingessner
052e94a34a refactor HashedCollections to support verbatim bridging 2016-11-03 19:52:30 -04:00
Alexis Beingessner
76c6281fea [stdlib] Rewriting native hashed collection indices
Changes:
- Native dictionary and set indices no longer hold references to storage
- Cocoa-based dictionary and set indices no longer hold references to storage
- Removed double indirection trick from hashed collections
- Rewrote storage types to reflect simpler model
- Updated unit tests
2016-10-29 10:04:35 -04:00
practicalswift
cc852042c9 [gardening] Fix accidental trailing whitespace. 2016-10-29 10:22:58 +02:00
Dmitri Gribenko
c9041beea3 Migrate callsites from 'expectNotEmpty()' to 'expectNotNil()' 2016-09-10 20:05:43 -07:00
Joe Groff
8232d3355b Foundation overlay: Remove unnecessary precondition that array elements be ObjectiveCBridgeable.
This caused a crash when arrays were bridged from ObjC with `Any` or other non-bridged value type elements. Fixes rdar://problem/27905230.
2016-09-07 10:39:05 -07:00
Max Moiseev
9fc37efee4 [test] renaming test/1_stdlib to just test/stdlib 2016-09-01 16:51:43 -07:00
Jordan Rose
e83c117c30 [test] Hack: run stdlib tests first to start long-running tests earlier.
This decreases total testing time by over a minute on my old Mac Pro.
It probably has much less effect on systems with fewer cores, but shouldn't
be any worse there.

Swift SVN r22745
2014-10-15 01:30:51 +00:00
Dave Abrahams
2d850421bc [stdlib] Internalize HeapBuffer[Storage], OnHeap
They were never really useful to users, because their APIs were
insufficiently public.  They have been replaced with a single class,
ManagedBuffer<Value,Element>, which is really designed for user
consumption.

Swift SVN r22636
2014-10-09 21:45:44 +00:00
Dave Abrahams
c93f32a4b3 [stdlib] Eliminate needless intermediate class
Swift SVN r22415
2014-09-30 23:43:25 +00:00
Dmitri Hrybenko
b095339da7 stdlib/Array: implement delayed bridging
rdar://18191358

Swift SVN r22071
2014-09-18 13:46:39 +00:00
Dmitri Hrybenko
395b56c287 Remove a swap file that I accidentally committed
Swift SVN r21941
2014-09-15 13:53:48 +00:00
Dmitri Hrybenko
ceff82f2ba stdlib/Array: add tests for Array -> NSArray bridging
Swift SVN r21939
2014-09-15 13:49:50 +00:00
Dmitri Hrybenko
d7acb06c64 stdlib/Dictionary: use 'delayed bridging' to keep pointers, returned
from a bridged NSDictionary, stable

We used to return a fresh pointer value every time an NSDictionary
element is requested, but, unfortunately, our SDK has bugs.

Fixes rdar://18191358 for Dictionary.

Swift SVN r21905
2014-09-12 13:20:30 +00:00
Dmitri Hrybenko
2487238955 Dictionary test: generalize equalsUnordered() utility
Swift SVN r21904
2014-09-12 09:24:36 +00:00
Dmitri Hrybenko
2ecb228b72 stdlib/Dictionary test: use AtomicInt to count key/value instances
Swift SVN r21872
2014-09-11 14:00:36 +00:00