Commit Graph

3245 Commits

Author SHA1 Message Date
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
Dave Abrahams
38828872b9 [stdlib] Add missing unwraps for backward compatibility
Otherwise, the result would have been an infinite recursion.
2017-07-14 15:30:06 -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
swift-ci
7fc46747b0 Merge pull request #10931 from apple/rdar-33276845 2017-07-13 10:06:13 -07:00
Maxim Moiseev
7d3627a972 Merge pull request #10558 from lorentey/binaryinteger-words
Implement BinaryInteger.words
2017-07-13 09:06:51 -07:00
Dave Abrahams
c62cdf3dc0 [stdlib] Use minimal bits for stride for indices in String.UTF8View
Fixes <rdar://33276845>
2017-07-13 07:55:53 -07:00
Joe Groff
4b615311d7 Merge pull request #10913 from jckarter/key-path-writeback-order
KeyPaths: Ensure mutation accesses are ended in the correct order.
2017-07-12 16:35:20 -07:00
Maxim Moiseev
ce53a6582f Merge pull request #8354 from anayini/bugfix/SR-4172
[stdlib] 0-ary tuples should be equatable
2017-07-12 16:12:51 -07:00
Maxim Moiseev
ec77bd01de Merge pull request #10903 from moiseev/metered-fare
[overlay] Add INRideOption
2017-07-12 14:57:18 -07:00
Joe Groff
34ec20c0e4 KeyPaths: Ensure mutation accesses are ended in the correct order.
Using an Array to hold onto all the cleanup objects for an access happens to destroy the cleanup objects in FIFO order (and it's probably not a good idea to rely on Array cleaning itself up in any particular order at all). For want of proper accessor coroutines, chain the cleanup objects in a linked list so that they reliably get destroyed in the desired inside-out order. Fixes SR-5442 | rdar://problem/33267959.
2017-07-12 14:41:34 -07:00
Kyle Zhao
923468be6b [overlay] Add INRideOption
<rdar://problem/32935297>
2017-07-12 11:36:54 -07:00
Joe Groff
a6404f0185 Merge pull request #10895 from jckarter/read-only-writable-key-path-projection
SILGen: Do a read-only projection of a writable KeyPath when the lvalue is only read.
2017-07-11 17:14:57 -07:00
Joe Groff
eb1231b722 SILGen: Do a read-only projection of a writable KeyPath when the lvalue is only read.
If we project an lvalue using a KeyPath, but the lvalue is only read from, we don't want to trigger writebacks, observers, or other side effects that a mutable projection would normally need to induce. Fixes SR-5338 | rdar://problem/33135489.
2017-07-11 15:47:59 -07:00
Dave Abrahams
4f71d9e35c [stdlib] Spot fix for https://bugs.swift.org/browse/SR-5401
The simplest way to keep the string buffer alive is simply to always grab its
iterator, even if we're not going to use it.  Thanks @milseman for that idea and
@jckarter for the diagnosis help!
2017-07-11 14:58:29 -07:00
John McCall
7f22faf968 Substantially rework how SILGen handles bridging as part of laying the
ground work for the syntactic bridging peephole.

- Pass source and dest formal types to the bridging routines in addition
  to the dest lowered type.  The dest lowered type is still necessary
  in order to handle non-standard abstraction patterns for the dest type.

- Change bridging abstraction patterns to store bridged formal types
  instead of the formal type.

- Improve how SIL type lowering deals with import-as-member patterns.

- Fix some AST bugs where inadequate information was being stored in
  various expressions.

- Introduce the idea of a converting SGFContext and use it to regularize
  the existing id-as-Any conversion peephole.

- Improve various places in SILGen to emit directly into contexts.
2017-07-11 12:45:13 -04:00
Károly Lőrentey
735fe97242 [stdlib] Fix sign extension in word -> multi-word integer conversions
This fixes integer conversion issues on 32-bit platforms.
2017-07-11 04:33:14 +02:00
Károly Lőrentey
6ae2040c42 [stdlib][test] Update integer tests. 2017-07-10 22:40:52 +02:00
Dave Abrahams
076b2e115f Merge pull request #10814 from apple/index-interchange
Index interchange
2017-07-07 15:01:17 -07:00
Joe Groff
8793212293 Merge pull request #10741 from jckarter/key-path-generic-computed
Handle generic computed properties in key paths.
2017-07-07 13:50:27 -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
Joe Groff
101788dbd4 IRGen: Support for computed properties with dependent generic context.
Use the KeyPath implementation's new support for instantiating and dealing with captures to lower the generic context required to dispatch computed accessors with dependent generics.
2017-07-06 20:07:41 -07:00
Joe Groff
c142e7d953 KeyPaths: Support captured arguments in computed components.
A necessary precursor to supporting subscripts and unspecialized generic accessors in general. Give get/set components the ability to have an "argument" area that gets instantiated by copying out of the key path pattern arguments at instantiation time, and which holds "witness" information for how to copy, destroy, equate, and hash arguments.
2017-07-06 20:07:41 -07:00
Philippe Hausler
56f509f059 [Foundation] Merge sequence initializer fast paths into one initializer 2017-07-06 19:24:17 -07:00
Philippe Hausler
aeb61e361b [Foundation] Add fast paths for Data initialization for common sequences 2017-07-06 09:45:53 -07: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
a8ba0772cd Merge pull request #10728 from itaiferber/non-optional-coding-paths
Make coding paths non-optional [DO NOT MERGE]
2017-07-01 14:34:40 -07:00
Michael Ilseman
091738cf97 Merge pull request #10693 from milseman/zalgorithmic_complexity
[stdlib] Update non-contiguous NSStrings to Unicode 9
2017-06-30 14:13:39 -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
Robert Widmann
e4fbb381aa Merge pull request #10710 from practicalswift/typos-20170629
[gardening] Fix typos
2017-06-29 18:03:56 -07:00
Michael Ilseman
b6ac8c61ab [tests] Make sure temporary directory exists 2017-06-29 16:52:17 -07:00
practicalswift
d39719ec3f [gardening] Fix typos 2017-06-29 23:09:22 +02: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
Michael Ilseman
a3e892fca5 [stdlib] Relax ephemeralString sanity check
Creating an ephemeral string from a non-contiguous substring does not
reuse the same storage. Relax a sanity check assuming that it did.
2017-06-28 15:48:17 -07:00
Michael Ilseman
5bc20cba08 [stdlib] Clean up non-contiguous string grapheme breaking code.
Removes the legacy grapheme breaking code paths. Simplifies and
clarifies the non-contiguous grapheme breaking code through consistent
naming and handling of absolute positions vs relative offsets.
2017-06-28 15:46:44 -07:00
Michael Ilseman
a37a823e6e [stdlib] Update non-contiguous NSStrings to Unicode 9
This adds Unicode 9 grapheme breaking support for non-contiguous
NSStrings. Non-contiguous NSStrings that don't hit our fast paths are
very rare, but should still behave identically to contiguous
strings.

We first copy a fixed number of code units into a fixed size buffer
(currently 16 in size) and try to grapheme break inside of that
buffer. This is sufficient storage for all known non-pathological
graphemes. Any graphemes larger than the buffer are handled by copying
larger portions of the string into an Array.

Test cases added, including pathological "zalgo" text that stresses
extremely long graphemes.
2017-06-28 15:35:25 -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
59c5e5623f Merge pull request #10598 from moiseev/dispatch-oneshot
[overlay] Rename scheduleOneShot and scheduleRepeating
2017-06-27 09:44:23 -07:00
Philippe Hausler
e5504cdf15 [Foundation] slices of slices that use range expressions incorrectly calculated relative indexing 2017-06-26 16:35:40 -07:00
Joe Groff
d07441651f Merge pull request #10556 from jckarter/key-path-optionals
KeyPaths: Add support for optional chaining/forcing components.
2017-06-26 18:57:42 -04:00
Max Moiseev
eaf20b23ba [overlay] Rename scheduleOneShot and scheduleRepeating
rdar://29587696
2017-06-26 15:38:21 -07:00
Maxim Moiseev
1fc6db7e68 Merge pull request #10551 from moiseev/inparameter
[overlay] Introducing INParameter
2017-06-26 14:27:59 -07:00