Commit Graph

1358 Commits

Author SHA1 Message Date
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
Jordan Rose
1e38b4b624 Merge pull request #10893 from jrose-apple/are-you-having-issues
[stdlib] Surface NSKeyedArchiver issues in Xcode.
2017-07-13 12:53:01 -07:00
Jordan Rose
fd3b585de0 [stdlib] Surface NSKeyedArchiver issues in Xcode.
By calling through to swift_reportToDebugger, Xcode can pick up the
NSKeyedArchiver/Unarchiver issues with Swift classes and display them
in the Issues Navigator. This increases the probability that they'll
be seen and acted upon.

This is not a fully-general interface yet, please do not start hooking
random things up to it. Especially if you're working on something that
doesn't ship with Xcode itself. :-)

rdar://problem/32900735
2017-07-13 11:19:03 -07:00
Maxim Moiseev
4d70a7c4c5 Merge pull request #10856 from moiseev/color-literal-init
[overlay] Hide the _ExpressibleByColorLiteral initizlier from code completion
2017-07-13 10:40:59 -07:00
Brian Croom
f7ee42588b Merge pull request #10905 from briancroom/XCTAssert-continueAfterFailure
Stop swallowing test interruption exceptions thrown during XCTAssert evaluation
2017-07-12 17:22:32 -07:00
Maxim Moiseev
ec77bd01de Merge pull request #10903 from moiseev/metered-fare
[overlay] Add INRideOption
2017-07-12 14:57:18 -07:00
Brian Croom
f788a309ff Stop swallowing test interruption exceptions thrown during XCTAssert evaluation.
Rethrow any test interruption exceptions that get caught, mirroring the
behavior of the Objective-C XCTAssert macros.

<rdar://problem/33255447>
2017-07-12 12:28:34 -07:00
Kyle Zhao
923468be6b [overlay] Add INRideOption
<rdar://problem/32935297>
2017-07-12 11:36:54 -07:00
Max Moiseev
391d49a31e [overlay] Hide the _ExpressibleByColorLiteral initializer from code completion.
Fixes: <rdar://problem/32726800>
2017-07-12 09:05:06 -07:00
Dave Abrahams
69eb4d6fe2 Merge pull request #10785 from xwu/silence-warnings
[gardening] Silence compiler warnings [NFC]
2017-07-11 23:13:30 -07:00
Maxim Moiseev
2e512cb7fe Merge pull request #10865 from moiseev/intents-availability-again
[overlay] Fixing the availability of INSearchCallHistoryIntent.init
2017-07-11 09:13:27 -07:00
Max Moiseev
95d46b1ee0 [overlay] Fixing the availability of INSearchCallHistoryIntent.init
Addresses: <rdar://problem/33206673>
2017-07-10 15:49:54 -07:00