Commit Graph

1358 Commits

Author SHA1 Message Date
Xiaodi Wu
075948c099 Explicitly discard result of NSDecimal operations 2017-07-10 17:11:42 -05:00
Kyle Zhao
5ab2e4d3a5 [overlay] Change INBooleanResolutionResul.defaultProfile to .isDefaultProfile
<rdar://problem/31816908>
2017-07-10 11:25:09 -07:00
Itai Ferber
acadd6ca32 Merge pull request #10819 from itaiferber/encoders-eliminate-overlapping-exclusive-accesses
Remove overlapping exclusive accesses in encoders
2017-07-07 16:08:17 -07:00
Max Moiseev
1a0436e9c7 [overlay] Use RangeExpression whenever possible instead of Range 2017-07-07 15:34:56 -07:00
Max Moiseev
77edc65003 [overlay] Potentially better bridging to NSString in StringProtocol extensions 2017-07-07 15:34:56 -07:00
Max Moiseev
72479aca50 [overlay] Move static unavailable members back to String 2017-07-07 15:34:56 -07:00
Max Moiseev
5f1c3f7021 [overlay] Generalize Foundation StringProtocol extensions 2017-07-07 15:34:56 -07:00
Max Moiseev
fc0cf33bdc [overlay] Mark Foundation String slicing methods as deprecated 2017-07-07 15:34:56 -07:00
Max Moiseev
fe1ebdfc73 [overlay] Port Foundation extensions from String to StringProtocol 2017-07-07 15:34:08 -07:00
Xiaodi Wu
2c29408430 Merge branch 'master' into silence-warnings 2017-07-07 17:33:55 -05:00
Max Moiseev
f45c1888b6 [overlay] Move unavailable declarations to StringProtocol 2017-07-07 15:29:47 -07:00
Max Moiseev
b2b0dc42d4 [overlay] Extracting static string extensions 2017-07-07 15:29:46 -07:00
Dave Abrahams
076b2e115f Merge pull request #10814 from apple/index-interchange
Index interchange
2017-07-07 15:01:17 -07:00
Itai Ferber
18b523289d Remove overlapping exclusive accesses in encoders
{JSON,Plist}{Encoder,Decoder} had overlapping accesses which were supposed to be mutually exclusive in their `with(pushedKey:)` methods.

Removes those methods and the overlapping accesses.
2017-07-07 13:43:21 -07:00
Itai Ferber
b8dc826d41 Merge pull request #10766 from itaiferber/jsonencoder-conditional-conformance-workarounds
JSONEncoder conditional conformance workarounds
2017-07-07 13:20:54 -07:00
Dave Abrahams
9159239995 Un-revert "[stdlib] String index interchange, etc." (#10812)
I failed to merge the upstream changes to swift-corelibs-foundation at the same
time as I merged that #9806, and it broke on linux. Going to get it right this
time.
2017-07-07 12:13:25 -07:00
Xi Ge
d9fb110674 Revert "[stdlib] String index interchange, etc." (#10812)
rdar://33186295
2017-07-07 12:03:16 -07:00
Itai Ferber
9f7506f002 Allow application of JSON strategies in all cases
One of the limitations of not having conditional conformance at the
moment is that the implementation of `init(from:)` and `encode(to:)` on
types which require it is that failure to cast dependent types to
`Encodable` or `Decodable` is a runtime failure. There is no way to
statically guarantee that the wrapped type is `Encodable` or
`Decodable`.

As such, in those implementations, at best we can directly call
`(element as! Encodable).encode(to: encoder)`, or similar. However, this
encodes the element directly into an encoder, without giving the encoder
a chance to intercept the type. This is problematic for `JSONEncoder`
because it cannot apply a strategy if it doesn't get to intercept the
type.

This gives a temporary workaround for JSON strategies because of
internal Foundation knowledge.
2017-07-07 09:38:07 -07:00
Dave Abrahams
2e0bb2f533 [stdlib] String index interchange, part II (UTF16) 2017-07-07 06:15:23 -07:00
Dave Abrahams
e523c80339 [stdlib] Index interchange, part I 2017-07-07 00:59:04 -07:00
Philippe Hausler
56f509f059 [Foundation] Merge sequence initializer fast paths into one initializer 2017-07-06 19:24:17 -07:00
Philippe Hausler
a842c6d43d [Foundation] Update Data sequence initializer to use initialize(from:) and add _copyContents 2017-07-06 09:45:53 -07:00
Philippe Hausler
aeb61e361b [Foundation] Add fast paths for Data initialization for common sequences 2017-07-06 09:45:53 -07:00
Xiaodi Wu
590ce5314d Restore indentation (partially) 2017-07-06 00:15:17 -05:00
Xiaodi Wu
3528479730 Silence compiler warnings 2017-07-05 23:56:44 -05:00
Maxim Moiseev
f2dbd65fec Merge pull request #10713 from ktopley-apple/dispatch-sync-fixup
Fix warnings in DispatchQueue.sync() implementation when using a comp…
2017-07-05 09:42:42 -07:00
Itai Ferber
e1007a2e3b Make coding paths non-optional
For the benefit of unkeyed containers, coding paths currently contain optional `CodingKey`s — unkeyed containers are allowed to report a `nil` key in a path. However, this is unhelpful for debugging purposes, or inspecting the coding path for context, since any unkeyed container simply reports `nil`, whether it’s at index 1 or 1000.

Now all containers are required to report a non-optional CodingKey for their segment of the coding path, and coding paths are now exposed as `[CodingKey]`.
2017-06-30 12:43:40 -07:00
Kim Topley
6194f37e1a Fix warnings in DispatchQueue.sync() implementation when using a compiler with SE-0176 support. 2017-06-30 08:45:15 -07:00
Itai Ferber
aa91b7273d Merge pull request #10667 from itaiferber/codable-encode-decode-nil-changes
Optionality updates to Codable API
2017-06-29 13:15:25 -07:00
Itai Ferber
b40c0bd3db Merge pull request #10685 from itaiferber/codingerror-bridging-and-conveniences
EncodingError/DecodingError bridging fixes and conveniences
2017-06-29 10:05:35 -07:00
Itai Ferber
cf0ebc195d Expose underlying serialization errors
If JSONSerialization or PropertyListSerialization throw errors during encoding or decoding, the error should be exposed as an EncodingError or DecodingError
2017-06-28 15:10:19 -07:00
Itai Ferber
92fccf964b Fix coding error bridging to NSError
CustomNSError briding only works when the CustomNSError conformance is in the same module as the original error declaration. We need to sink these down into the standard library.
2017-06-28 14:33:15 -07:00
Itai Ferber
850b21f50d JSONEncoder data encoding strategy tweaks
* Add deferredToData strategy on encode and decode
* Rename base64{Encode,Decode} to base64 (missed this in previous fixes)
* Add unit test to confirm behavior
2017-06-28 14:17:23 -07:00
Itai Ferber
baca811820 Ensure values are decodable from nil
* Eliminate null checks from unboxing in the general case (so types
  can at least attempt to decode from nil)
* Add unit tests to confirm this behavior
2017-06-28 11:23:22 -07:00
Maxim Moiseev
a2b89a7a2d Merge pull request #10585 from moiseev/modelio-overlay
[overlay] Add ModelIO overlay
2017-06-28 10:11:53 -07:00
Itai Ferber
692a893e16 Allow superDecoder to wrap null values
* Update {JSON,PropertyList}Decoder to allow superDecoder()s to wrap
  null value so current implementations of collections can decode
  contained objects from nil
2017-06-28 10:10:21 -07:00
Itai Ferber
bf1d2a745e Accessibility cleanup in {JSON,Plist}Encoder
To make it slightly easier to tell at a glance if a method is
implemented as part of API (public/open), shared implementation detail
(fileprivate), or implementation detail meaningful only to a given type
(private).
2017-06-28 10:10:21 -07:00
Itai Ferber
0a0e6b7397 Update PlistEncoder with proposed nil changes
* Add encodeNil/decodeNil variants on keyed and unkeyed containers
* Give implementations of decode() variants instead of decodeIfPresent()
2017-06-28 10:10:21 -07:00
Itai Ferber
f20d4425e5 Update JSONEncoder with proposed nil changes
* Add encodeNil/decodeNil variants on keyed and unkeyed containers
* Give implementations of decode() variants instead of decodeIfPresent()
2017-06-28 10:10:21 -07:00
swift-ci
e2327f62a2 Merge pull request #10619 from ianpartridge/patch-1 2017-06-27 10:01:45 -07:00
Maxim Moiseev
59c5e5623f Merge pull request #10598 from moiseev/dispatch-oneshot
[overlay] Rename scheduleOneShot and scheduleRepeating
2017-06-27 09:44:23 -07:00
Ian Partridge
ad2311d9e2 PropertyListEncoder: Typo in documentation of encode<Value>(Value) 2017-06-27 10:24:25 +01:00
Ian Partridge
399caebf11 JSONEncoder: Typo in documentation of encode<T>(T) 2017-06-27 10:18:08 +01:00
Philippe Hausler
e5504cdf15 [Foundation] slices of slices that use range expressions incorrectly calculated relative indexing 2017-06-26 16:35:40 -07:00
Max Moiseev
eaf20b23ba [overlay] Rename scheduleOneShot and scheduleRepeating
rdar://29587696
2017-06-26 15:38:21 -07:00
Max Moiseev
9cd60fa2ae [overlay] Adding ModelIO dependency to GLKit overlay 2017-06-26 15:26:38 -07:00
Maxim Moiseev
1fc6db7e68 Merge pull request #10551 from moiseev/inparameter
[overlay] Introducing INParameter
2017-06-26 14:27:59 -07:00
wmattelaer
a724284455 [overlay] Introducing INParameter
<rdar://problem/32409847>
2017-06-26 11:21:10 -07:00
Max Moiseev
46af654271 [overlay] Add ModelIO overlay 2017-06-26 10:56:13 -07:00
Itai Ferber
da27019800 Merge pull request #10539 from itaiferber/foundation-json-decimal
Encode Decimal as a numeric value in JSON
2017-06-23 15:41:51 -07:00