Commit Graph

361 Commits

Author SHA1 Message Date
Max Moiseev
556e089d19 Merge pull request #22138 from moiseev/spring-cleaning
[stdlib] Remove a bunch of declarations marked as obsoleted in 4
2019-02-01 11:03:37 -08:00
Lily Vulcano
ac7a93963c Revert "Merge pull request #20103 from lilyball/fix_kvo"
This reverts commit 7c514196fc, reversing
changes made to 2d7c31b24c.

This patch will be reproposed with fixes.
2019-02-01 10:55:06 -08:00
Mishal Shah
42633218c5 Update master to build with Xcode 10.2 beta 1 2019-01-31 14:48:29 -08:00
Maxim Moiseev
714982bd1b Remove access specifiers on some extensions to avoid warnings 2019-01-31 14:36:55 -08:00
Maxim Moiseev
8f5877b994 Fix INParameter availability 2019-01-31 13:43:19 -08:00
Max Moiseev
5da70012db Merge pull request #22244 from moiseev/macos-inimage
Make APIs using INImage unavailable on macOS
2019-01-30 15:53:27 -08:00
Lily Vulcano
b864a7461f Rebase master; move this to use NSSet, not AnyObject. 2019-01-30 13:06:02 -08:00
Lily Ballard
4dd8bcc548 [SDK] Clean up the KVO swizzles slightly 2019-01-30 12:41:14 -08:00
Lily Ballard
fafaa33f9b [SDK] Replace global KeyPath table with a per-thread table
The global table was vulnerable to race conditions when making
observations concurrently on multiple threads. We can assume the
`NSKeyValueObservingCustomization` methods are invoked synchronously
when creating the observation, so we can use a per-thread table instead.
This per-thread table is still vulnerable in the event that an
implementation of `automaticallyNotifiesObservers(for:)` creates a new
observation using a different `KeyPath` with the same Obj-C path, but
this method really shouldn't be creating any observations of its own.

Unfortunately we can't include the class in the per-thread table key, as
this may produce incorrect results in the presence of subclasses.

rdar://problem/45567020 https://bugs.swift.org/browse/SR-9077
2019-01-30 12:41:14 -08:00
Lily Ballard
e5ba2c8356 [SDK] Fix NSSortDescriptor.keyPath
The previous implementation could return keyPaths other than the one
used to create the `NSSortDescriptor` in the event that any subsequent
observation, `NSExpression`, or `NSSortDescriptor` was created using a
different `KeyPath` that had the same Obj-C keypath value.

https://bugs.swift.org/browse/SR-9076
2019-01-30 12:41:13 -08:00
Lily Ballard
82e3171556 [SDK] Fix potential race with NSKeyValueObservation
If the `NSKeyValueObservation` was being deinited on one thread while a
KVO change notice was being broadcast on another, it could end up trying
to handle the change notice concurrently with deiniting, which will
probably crash.

This also fixes a problem where it was swizzling `NSObject`'s
`observeValue(forKeyPath:of:change:context:)` implementation, which
resulted in potentially invoking undefined behavior if an observer ever
called up to `NSObject`'s implementation.

https://bugs.swift.org/browse/SR-9074
https://bugs.swift.org/browse/SR-9075
2019-01-30 12:41:13 -08:00
Lily Ballard
dd51e9d4bb [SDK] Fix thread safety of KVO swizzling
Swizzling the methods in a different order ensures we don't overwrite
the public `NSObject` method until it's safe to call our replacement.

rdar://problem/36663633 https://bugs.swift.org/browse/SR-6795
2019-01-30 12:41:13 -08:00
Maxim Moiseev
af00487bb8 Make APIs using INImage unavailable on macOS
<rdar://problem/47673006>
2019-01-30 11:10:32 -08:00
Doug Gregor
30a6c0fac1 [Foundation] Rename swift_errorBridgingInfo so it doesn't conflict with pre-stable ABI Swift
Fixes rdar://problem/47651565
2019-01-29 17:22:31 -08:00
Maxim Moiseev
02cc2256e9 [stdlib] Remove a bunch of declarations marked as obsoleted in 4 2019-01-29 11:13:47 -08:00
Michael Ilseman
81e87ac838 Merge pull request #21959 from milseman/fast_foundation
[String] Add UTF-8 fast-paths for Foundation initializers
2019-01-22 16:26:36 -08:00
Mike Ash
ae0f04ab23 Merge pull request #21958 from mikeash/rename-avoid-more-objc-conflicts
[stdlib][Foundation] Avoid coexistence conflicts with JSONEncoder/Decoder and _stdlib_AtomicInt.
2019-01-18 17:18:03 -05:00
Maxim Moiseev
18f4ffeeb3 Change doc comment style 2019-01-17 15:21:31 -08:00
Maxim Moiseev
d3f3890cc3 Make Compression.Algorithm conform to CaseIterable 2019-01-17 15:06:03 -08:00
Michael Ilseman
a088e13224 [String] Add UTF-8 fast-paths for Foundation initializers
Many Foundation initializers could benefit from faster string
construction and subsequent reads in Swift 5. Add UTF-8 fast paths for
when constructing a string from a valid UTF-8 code units.
2019-01-17 14:15:40 -08:00
Mike Ash
faceaaa0ab [stdlib][Foundation] Avoid coexistence conflicts with JSONEncoder/Decoder and _stdlib_AtomicInt.
JSONEcoder/Decoder get another underscore in their ObjC name, as the one with a single underscore conflicts with older Swifts that had _JSONEcoder/Decoder as internal rather than fileprivate.

_JSONEncoder/Decoder get another underscore in their Swift name to avoid conflicting with the ObjC name from the ones in older overlays.
2019-01-17 17:12:01 -05:00
Eric Bainville
a05ecf9c53 fixes from code review 2019-01-17 13:09:56 -08:00
Maxim Moiseev
3e05648996 Stylistic changes 2019-01-17 11:10:49 -08:00
Max Moiseev
a2659f0b33 Update stdlib/public/Darwin/Compression/Compression.swift
Co-Authored-By: ebainville <ebainville@apple.com>
2019-01-17 09:05:43 -08:00
Eric Bainville
556f79d8d0 InputFilter, OutputFilter overlay for the Darwin Compression stream API, and corresponding test 2019-01-16 14:41:06 -08:00
Mike Ash
a2cd889ab3 [Stdlib] Fix botched merge conflict resolution in Data.swift. 2019-01-15 13:43:20 -05:00
Mike Ash
fa5888fb3f [Stdlib][Overlays] Rename various classes to avoid conflicting ObjC names.
Old Swift and new Swift runtimes and overlays need to coexist in the same process. This means there must not be any classes which have the same ObjC runtime name in old and new, because the ObjC runtime doesn't like name collisions.

When possible without breaking source compatibility, classes were renamed in Swift, which results in a different ObjC name.

Public classes were renamed only on the ObjC side using the @_objcRuntimeName attribute.

This is similar to the work done in pull request #19295. That only renamed @objc classes. This renames all of the others, since even pure Swift classes still get an ObjC name.

rdar://problem/46646438
2019-01-15 12:21:20 -05:00
Itai Ferber
70f5e4ce2d Remove unnecessary @inlinable annotations on hash(into:) 2019-01-11 11:09:12 -08:00
Itai Ferber
076effdf5d Correct buffering in .init<S> and .append<S> and add unit test 2019-01-11 10:14:27 -08:00
Itai Ferber
1b5c0189b1 Account for Int vs. UInt8 in InlineData.hash(into:) 2019-01-10 15:50:56 -08:00
Itai Ferber
bb5ab742d5 Add buffering to worst-case scenarios in Data.init<S>/.append<S> 2019-01-10 15:50:32 -08:00
Itai Ferber
e49da4dc49 Refine inlinability of Data and Data.Iterator 2019-01-09 15:02:46 -08:00
Itai Ferber
1de88a3916 Refine inlinability of _Representation 2019-01-09 14:48:47 -08:00
Itai Ferber
123b06787d Refine inlinability of LargeSlice and RangeReference 2019-01-09 14:40:48 -08:00
Itai Ferber
03dd2a365a Annotate inlinability of InlineSlice 2019-01-09 14:34:08 -08:00
Itai Ferber
b1e4c56d73 Refine inlinability of InlineData 2019-01-09 14:23:58 -08:00
Itai Ferber
6482c34077 Refine inlinability of _DataStorage 2019-01-09 14:18:33 -08:00
Itai Ferber
1d00e3c9b7 Migrate Data from hashValue to hash(into:) 2019-01-09 14:00:20 -08:00
David Smith
016ced2c44 Adopt the new bulk Dictionary initializer in bridging 2018-12-20 16:57:38 -08:00
Doug Gregor
69c9fbc3c8 Move SIMD operators back into the Swift standard library
Moving them out to SIMDOperators didn't help, but the type checker hack
might. Move them back into the Swift standard library where they belong,
but leave SIMDOperators there to smooth over any short-term
incompatibilities.
2018-12-17 11:07:32 -08:00
Philippe Hausler
9e9a791e94 Revert "[Foundation] Fallback to presuming 32-bit platforms if we dont explicitly know that it is 64 bit; this allows for better portability (#21290)"
This reverts commit 77c7a69ae2.
2018-12-13 15:19:57 -08:00
Lily Vulcano
d5f5ba6402 Merge pull request #21297 from millenomi/fix-crash-init-cocoaDictionary
Build crash fix: AnyObject -> NSDictionary
2018-12-13 13:25:15 -08:00
Philippe Hausler
77c7a69ae2 [Foundation] Fallback to presuming 32-bit platforms if we dont explicitly know that it is 64 bit; this allows for better portability (#21290) 2018-12-13 12:39:52 -08:00
Max Moiseev
bdc68189bf Merge pull request #21265 from moiseev/scenekit-switch-default
Use @unknown default in a switch over SCNGeometryPrimitiveType
2018-12-13 11:53:37 -08:00
Lily Vulcano
d57f714a29 Build crash fix: AnyObject -> NSDictionary
As seen in swift crashers while building https://github.com/apple/swift/pull/20103
2018-12-13 11:03:43 -08:00
Itai Ferber
d4e42c0dd1 Merge pull request #20225 from phausler/inline_data_and_dataprotocol
DataProtocol and new inline Data
2018-12-12 16:10:13 -08:00
Maxim Moiseev
7e211c6615 Use @unknown default in a switch over SCNGeometryPrimitiveType
<rdar://problem/39029889>
2018-12-12 13:51:50 -08:00
Philippe Hausler
d030354320 Initial draft of DataProtocol ContiguousCollection and new inline Data 2018-12-11 11:19:36 -08:00
Karoy Lorentey
ef392c1277 Merge pull request #21056 from lorentey/error-hashing
[Foundation] Update hashing for bridged NSError protocols
2018-12-11 13:17:00 +00:00
Stephen Canon
95d76cd195 Minor improvements to CGFloat (#21090)
* Minor improvements to CGFloat

Apparently init(exactly:) was never implemented for CGFloat, so let's fix that. Also includes minor cleanup for the .magnitude property.

* Add transparent annotations to some other CGFloat things.
2018-12-10 15:31:23 -05:00