Commit Graph

1487 Commits

Author SHA1 Message Date
Tony Parker
7b20be2c1c Merge pull request #12779 from parkera/parkera/json_key_strategy
Add key encoding strategy to JSONEncoder
2017-11-16 15:48:32 -08:00
Greg Parker
1e894cd80b [runtime] Clean up symbols in error machinery. (#12853)
* [runtime] Clean up symbols in error machinery.

* [runtime] Clean up symbols in Foundation overlay.

* [runtime] Clean up symbols in collections and hashing.

* [runtime] Remove symbol controls from the Linux definition of swift_allocError.

* [tests] Add more stub functions for tests that link directly to the runtime.
2017-11-15 22:20:11 -08:00
Tony Parker
b87a8ea007 Add key encoding strategy to JSONEncoder 2017-11-15 16:44:28 -08:00
Tony Parker
b57a9cb8a9 Merge pull request #12898 from sashabelonogov/sashabelonogov/SR-6361
[SR-6361] Fix Data.withUnsafeMutableBytes() for slices with length < range.lowerBound
2017-11-15 11:26:49 -08:00
Alexander Belonogov
bf56b09395 [SR-6361] Fix Data.withUnsafeMutableBytes() for slices with length < range.lowerBound 2017-11-14 09:08:21 +01:00
Itai Ferber
ae8f815f64 Use the concrete type parameter passed to JSON/plist decode 2017-11-09 13:06:00 -08:00
Jordan Rose
1598a21e43 DI: Warn on non-delegating cross-module struct initializers
...as detected by initializing an individual field without having
initialized the whole object (via `self = value`).

This only applies in pre-Swift-5 mode because the next commit will
treat all cross-module struct initializers as delegating in Swift 5.
2017-11-09 11:24:28 -08:00
Max Moiseev
b49adc2398 Update UIKit
Changes simlar to those in AppKit.

<rdar://problem/34131288>
2017-11-06 15:52:52 -08:00
Max Moiseev
6cf8f9ba52 Extract operators into a protocol 2017-11-06 15:52:52 -08:00
Max Moiseev
e0f4985fbe Enable comparability and some numeric operations for specific wrapper types 2017-11-06 15:52:52 -08:00
Max Moiseev
d4d89d1854 Use swift 4 with the AppKit overlay 2017-11-06 15:52:52 -08:00
Lance Parker
414614cf88 Revert "Revert "[stdlib]Enable Swift 4 mode for the overlays (#12608)"" (#12751)
This reverts commit bcf5d66c8e.
2017-11-06 14:03:48 -08:00
Mishal Shah
bcf5d66c8e Revert "[stdlib]Enable Swift 4 mode for the overlays (#12608)"
This reverts commit f54d8b4ef2.
2017-11-03 11:52:30 -07:00
Lance Parker
f54d8b4ef2 [stdlib]Enable Swift 4 mode for the overlays (#12608)
Enable Swift 4 mode for the overlays
2017-11-03 10:11:45 -07:00
Roman Levenstein
c3bc08ec06 Remove any mention of sil-serialize-all related flags from CMake files and build-script-impl
These flags are not needed anymore.
2017-10-21 19:18:15 -07:00
Roman Levenstein
5047e1b475 Enable the serialization of sil_vtables by default and completely remove the -sil-serialize-vtables option
Only sil_vtables of public classes with fixed layout are serialized.
2017-10-21 11:36:12 -07:00
Roman Levenstein
f2e8e0a448 Merge pull request #12493 from swiftix/sil-serialization-before-optimizations5
Enable serialization of witness tables by default
2017-10-21 08:40:59 -07:00
Roman Levenstein
48d9b99675 Remove -sil-serialize-witness-tables flag completely
The functionality is always enabled now and there is no need to have a dedicated flag for it.
2017-10-20 19:45:29 -07:00
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