Commit Graph

1419 Commits

Author SHA1 Message Date
Philippe Hausler
b78b438897 Ensure that hashing data with zero bytes avoids empty allocations and fix bridged empty data hashes from de-referencing null values (#12509) 2017-10-19 17:53:19 -07:00
Max Moiseev
88c544164f Merge pull request #12424 from moiseev/mtkmesh-fix
[overlay] Fix newMeshes to return proper modelIO meshes
2017-10-16 14:50:36 -07:00
Kim Topley
1da4b04d99 Fixes overflow trap when creating DispatchTime objects with large uptimeNanoseconds values and re-enables the tests that failed.
Adds some additional tests.
2017-10-16 07:09:05 -07:00
Max Moiseev
ed553fd257 [overlay] Fix newMeshes to return proper modelIO meshes
Fixes: <rdar://problem/34624659>
2017-10-13 10:48:11 -07:00
Roman Levenstein
9134153bd3 Stop using -sil-serialize-all when building the standard library
We can finally get rid of -sil-serialize-all when building the standard library! This option will be completely eliminated in the future commits.

Instead of serializing just everything as we did before, we now serialize only functions annotated with @_inlineable. This way we can selectively control what needs to be available to the clients. This is an important step towards building a resilient standard library.

While this is a huge change for the serialization of the stdlib, it should be virtually invisible to the clients. For example, there are no noticeable performance regressions on any of the benchmarks.
2017-10-02 14:34:14 -07:00
Doug Gregor
797df6e8d7 Eliminate the _*Indexable protocols.
The various _*Indexable protocols only exist to work around the lack of
recursive protocol constraints. Eliminate all of the *_Indexable protocols,
collapsing their requirements into the corresponding Collection protocol
(e.g., _MutableIndexable —> Collection).

This introduces a number of extraneous requirements into the various
Collection protocols to work around bugs in associated type
inference. Specifically, to work around the lack of "global" inference
of associated type witnesses. These hacks were implicitly present in
the *Indexable protocols; I've made marked them as ABI FIXMEs here so
we can remove them when associated type inference improves.

Fixes rdar://problem/21935030 and a number of ABI FIXMEs in the library.
2017-10-01 15:08:23 -07:00
Doug Gregor
42968b2069 Eliminate a number of uses of the *Indexable protocols. 2017-10-01 15:08:23 -07:00
Ross Bayer
fc9dcc09a9 Added in missing imports to Accelerate and CoreFoundation overlays. (#12167) 2017-09-28 15:45:52 -07:00
Max Moiseev
7322b63c44 [overlay] Fix Foundation extensions to Substring
When a substring gets bridged to NSString, it loses the initial offset,
therefore APIs that accept or return StringIndex ranges should handle
this case explicitly by adding/subtracting the substring start offset.

Fixes <rdar://problem/33873277>
2017-09-27 20:09:01 -07:00
Max Moiseev
962895b652 Merge pull request #11965 from moiseev/arkit+metal
[overlay] Add Metal, MetalKit overlays, and new APIs to ARKit
2017-09-22 11:44:18 -07:00
ktopley-apple
0dc62017a1 Merge pull request #11927 from ktopley-apple/dispatch-time-overflows
Fix overflow traps in DispatchTime/DispatchWallTime/DispatchTimeInterval
2017-09-20 13:27:35 -07:00
ktopley-apple
0165e734d1 Merge pull request #11777 from ktopley-apple/dispatch-apply-fixup
Change the fix-up for dispatch_apply() to refer to the correct replacement.
2017-09-20 12:27:39 -07:00
Kim Topley
c5af2799c1 Fix overflow traps in DispatchTime/DispatchWallTime/DispatchTimeInterval.
rdar://problem/32678302
2017-09-20 12:16:05 -07:00
Itai Ferber
1457e4da9d Merge pull request #11885 from cpwhidden/decoding-bool-coercion
[stdlib] Prevent coercion from Bool to numerical types when decoding JSON and plist
2017-09-18 09:15:18 -07:00
Philippe Hausler
c8bbce6ef1 Data slice mutation support (#11939)
* Mutations of slices of data should preserve relative indexing as well as cow semantics of slices

* Ensure hashes of ranges are uniform to the expected hash for Data

* Correct a few mistakes in the slice mutation tests

* Update sequence initializations to avoid directly calling mutableCopy which prevents slice offset mismatches

* Avoid invalid index slices in creating mirrors

* Restore the original Data description

* Resetting a slice region should expand the slice to the maximum of the region (not a out of bounds index of the backing buffer)

* Remove stray comment and use a stack buffer for sequence appending

* Return false when allocations fail in _resizeConditionalAllocationBuffer (not yet in use)

* Enumeration of regions of a slice should be limited to the slice range in the case of custom backing (e.g. dispatch_data_t)

* adjust assertion warnings for data indexes that are negative
2017-09-16 13:22:01 -07:00
Ryan Schmitt
a4ca9d0886 [overlay] Add Metal and MetalKit overlays 2017-09-15 16:51:02 -07:00
Mike Buerli
3edd26e8e9 [overlay] Add ARFaceGeometry APIs to ARKit overlay 2017-09-15 16:51:02 -07:00
cpwhidden
997fe01809 [stdlib] Prevent type coercion from Bool to numerical types when decoding JSON and plist
JSONEncoder and PropertyListEncoder both use NSNumber to box Bool values.  An encoded Bool can be coerced to any numerical type during decoding because (false as NSNumber).intValue == 0.  As a remedy, all of the unbox(_:as:) methods of _JSONDecoder and _PlistDecoder for numerical types include a check that the value is not identical to either kCFBooleanTrue or kCFBooleanFalse, and throw a DecodingError._typeMismatch(at:expectation:) if this check fails.
2017-09-12 15:31:04 -05:00
Kim Topley
9b96c0eb36 Change the fix-up for dispatch_apply() to refer to the correct replacement. Also change from "renamed" to "message" because concurrentPerform(iterations:execute:) has different arguments than dispatch_apply(), so Xcode does not handle the conversion properly. 2017-09-05 15:00:16 -07:00
Maxim Moiseev
6c7d93491f Merge pull request #11627 from moiseev/swift-2-artifacts
[stdlib] Remove the Grand Renaming artifacts of Swift 3 era
2017-09-05 11:41:18 -07:00
Max Moiseev
43f0830e67 [overlay] Weakly link against ModelIO Framework
Multiple overlays depend on ModelIO transitively, inlcuding GLKit. So an
app linked against GLKit will successfully build and run on the modern
OSes, but will crash on load if back-deployed to an OS where ModelIO did
not exist.

<rdar://problem/33960842>
<rdar://problem/33471433>

(cherry picked from commit 1c385f189c)
2017-09-01 16:10:43 -07:00
Kuba (Brecka) Mracek
d03a575279 Unify the capitalization across all user-visible error messages (#11599)
* Unify the capitalization across all user-visible error messages (fatal errors, assertion failures, precondition failures) produced by the runtime, standard library and the compiler.

* Update some more tests to the new expectations.
2017-08-29 12:16:04 -07:00
Maxim Moiseev
ee5fb33656 [stdlib] Remove the Grand Renaming artifacts of Swift 3 era 2017-08-28 15:54:11 -07:00
Itai Ferber
ee39ff7f2f Allow top-level Codable strategy/type interception
At the top level, JSONEncoder/PropertyListEncoder (and the decoders) directly encoded values into an encoder instead of following the logic to box the values (and thus dispatch based on the type, potentially intercepting representations or applying strategies). This led to top-level values having a different representation than similar values throughout a payload.
2017-08-24 13:31:08 -07:00
Mishal Shah
df070b858f Update swift master to build with Xcode 9 beta 6, macOS 10.13, iOS 11, tvOS 11, and watchOS 4 SDKs. 2017-08-22 11:52:50 -07:00
Ian Partridge
96a3b9709c Sync NSStringAPI.swift from overlay 2017-08-22 09:49:07 -07:00
Max Moiseev
cf7ea08ed3 [overlay] Public extensions on external protocol are not in fact public 2017-08-14 17:15:46 -07:00
Itai Ferber
273dd8740e Merge pull request #11368 from itaiferber/urlcomponents-codable-adoption
Adopt Codable on URLComponents
2017-08-11 12:15:37 -07:00
Philippe Hausler
d2926cfb05 Replicate NSAffineTransform logic for rotation to AffineTransform 2017-08-04 09:58:11 -07:00
Itai Ferber
bf4a12568a Add Codable conformance for URLComponents
Adopt Codable on URLComponents and add associated unit tests
2017-08-03 14:28:18 -07:00
Itai Ferber
2e5817ebe1 Merge pull request #11315 from itaiferber/fix-sr-5206-hack
Remove previous hack for SR-5206
2017-08-03 10:37:56 -07:00
Itai Ferber
db5133b21b Use encodeIfPresent in DateComponents.encode
Now that encodeIfPresent is available as API, we can use it to make DateComponents.encode slightly more digestible.
2017-08-02 14:56:39 -07:00
Itai Ferber
fbdcbee7a2 Remove previous hack for SR-5206
As a temporary workaround for SR-5206, certain Foundation types which had custom behavior in JSONEncoder and JSONDecoder were granted special knowledge of those types internally in order to preserve strategies on encode/decode.

This replaces that special knowledge with a more general-purpose fix that works for all types and all encoders/decoders.
2017-08-02 14:11:29 -07:00
Mishal Shah
64a77ca716 Update master to build with Xcode 9 beta 4, macOS 10.13, iOS 11, tvOS 11, and watchOS 4 SDKs. 2017-07-28 11:17:59 -07:00
Max Moiseev
7569dc9585 "[overlay] Add back INSetProfileInCarIntent.defaultProfile for compatibliity
<rdar://problem/33457609>
2017-07-25 15:19:43 -07:00
swift-ci
5684766a83 Merge pull request #11167 from DougGregor/nscolor-literal-extended-srgb 2017-07-25 09:19:32 -07:00
Doug Gregor
8b3889a0a3 [AppKit overlay] Use NSColor(red:green:blue:alpha:) for color literals.
This initializer, which is the same on iOS, allows negative values and
values > 1.0 to support the extended sRGB color space.

Fixes rdar://problem/33500905.
2017-07-25 07:58:20 -07:00
Itai Ferber
c962bdb56c Merge pull request #11148 from itaiferber/indexset-rangeview-fixes
Fix IndexSet.RangeView indexing with subranges
2017-07-24 19:32:50 -07:00
Itai Ferber
b05866a92f Fix IndexSet.RangeView indexing with subranges
On initialization, IndexSet.RangeView made the erroneous assumption that given an intersection range, a nil _indexOfRange(containing: bound) indicated that the bound was beyond the beginning or end of the index set. Instead, the index could simply not exist.

We now calculate the actual intersection of the parent index set with the given intersection range and use that as the index set to view.

This also makes the unit tests for testing range views more comprehensive.
2017-07-24 15:32:03 -07:00
Itai Ferber
5252f3b2f8 Fix NSNumber's custom AnyHashable representation
When we give NSNumber a custom AnyHashable representation, we want to
give it as large a box as possible. When we want to compare it against
other AnyHashable boxes such as Int or UInt, it's always possible to
upcast the Int/UInt to a larger integer size like Int64 or UInt64 for
the comparison. By eliminating the smaller boxes we create, we can
maintain the existing behavior that _SwiftTypePreservingNSNumber gave
us.
2017-07-24 12:22:45 -07:00
Itai Ferber
f6e48dceb6 Merge pull request #11025 from michael-lehew/codable_support_for_nsarchival
NSKeyed{Una,A}rchiver should support Codable
2017-07-19 19:11:57 -07:00
Michael LeHew
ef35a001e6 NSKeyed{Una,A}rchiver should support Codable 2017-07-19 16:43:55 -07:00
Maxim Moiseev
3a1d6e1ebf Merge pull request #10980 from moiseev/uikit-drag-drop
[overlay] Add NSItemProviderReading/Writing methods to UIKit overlay
2017-07-17 10:44:14 -07:00
Max Moiseev
e43f146c5b [overlay] Replace _SwiftDragDropItemProvider with _ObjectiveCBridgeable 2017-07-14 22:47:17 -07:00
Dave Rahardja
340447ac64 [overlay] Add NSItemProvider overlay
<rdar://problem/32138540>
2017-07-14 22:13:30 -07:00
Philippe Hausler
5dfa9160f9 [Foundation] replaceSubrange in the cases of immutable and mutable backing stores should recalculate length per the reference backing store change and not the length of the replacement 2017-07-14 18:34:57 -07:00
Dave Rahardja
1382fc85d7 [overlay] Add NSItemProviderReading/Writing methods to UIKit overlay
<rdar://problem/32138581>
2017-07-14 17:15:58 -07:00
swift-ci
efb7d75489 Merge pull request #10970 from apple/rdar-33307780 2017-07-14 17:14:44 -07:00
Dave Abrahams
e59cb97048 [stdlib/Foundation] Swift 3 backward compatibility hack
Since samePosition(in:) now unconditionally returns optionals,
String.UTF16View.Index.distance(to: String.UTF16View.Index) must accept an
optional to keep some code working.

Fixes <rdar://33307780>.
2017-07-14 15:30:06 -07:00
Maxim Moiseev
16b7de05a3 Merge pull request #10376 from moiseev/foundation-string-extensions
[WIP][overlay] Port Foundation String extensions to StringProtocol
2017-07-13 14:50:47 -07:00