Commit Graph

3744 Commits

Author SHA1 Message Date
Nate Cook
47d050ecb3 [gardening] Fix inconsistencies in DoubleWidth 2017-07-24 19:35:59 -05:00
Michael Ilseman
b37417bdb5 [String] Delete dead code; NFC 2017-07-24 16:09:54 -07:00
Ben Cohen
ddea636951 [stdlib] Have Substring.filter return a String (#10871)
* Have Substring.filter return a String

* fix spacing nits

new machine so editor misconfigured excuses excuses

* fix spacing nits
2017-07-24 15:23:30 -07:00
swift-ci
4d5dfdd42c Merge pull request #10966 from rintaro/stdlib-hashedcollection-switchcase 2017-07-24 00:51:08 -07:00
Dave Abrahams
31341e6753 Merge pull request #10976 from d-ronnqvist/reduce-with-inout
[stdlib] Implement SE-0171: Reduce with inout
2017-07-23 19:57:25 -07:00
Yuka Ezura
73ba66abe1 fix expression CountablePartialRangeFrom
This PR is fix expression `CountablePartialRangeFrom` in Range.swift.gyb.
We can not treat `5.0...` as `CountablePartialRangeFrom`...?
(`CountablePartialRangeFrom`'s `Bound` is `Strideable`)
2017-07-23 15:53:17 +09:00
Itai Ferber
580332b062 Rename encodeWeak to encodeConditional
As part of updates to the Codable API, we are renaming encodeWeak to encodeConditional for clarity.
2017-07-21 10:55:05 -07:00
swift-ci
92898618cb Merge pull request #10982 from apple/stdlib-swift4-modernization 2017-07-20 18:56:23 -07:00
Dave Abrahams
1f6867892a [stdlib] Correct a comment 2017-07-20 18:11:57 -07:00
Dave Abrahams
e8ba44a8d5 Merge pull request #11027 from apple/backward-compatible-utf8-view-slicing
Backward compatible utf8 view slicing
2017-07-20 18:05:27 -07:00
Itai Ferber
409473781d Merge pull request #10350 from inamiy/CodingKey-CustomStringConvertible
Let CodingKey inherit CustomStringConvertible for better debugging
2017-07-20 15:19:57 -07:00
Dave Abrahams
05ff40d125 [stdlib] Backward-compatible String.UTF8View slicing
When slicing String.UTF8View in Swift 3 mode, in the absence of type
context, produce String.UTF8View.
2017-07-20 14:54:16 -07:00
Dave Abrahams
33e9ec4690 [stdlib] Rationalize bitshifting in protocols
Only FixedWidthInteger, not BinaryInteger, should have masking shifts.
BinaryInteger should have a non-masking shift requirement.

Removed some dead code.
2017-07-18 16:00:44 -07:00
Dave Abrahams
879e8e548f Merge pull request #10994 from apple/drop-introduced-annotations
[stdlib] Drop some @available(introduced:...)
2017-07-18 14:30:26 -07:00
Dave Abrahams
ff07df8df3 Merge pull request #11006 from apple/bidirectional-utf8-view
[stdlib] Make String.UTF8View bidirectional
2017-07-17 21:40:34 -07:00
Dave Abrahams
e6519fbd2b [stdlib] Make String.UTF8View bidirectional
This is a step along the way toward handling backward-compatiblity of UTF8View
slicing and preventing inadvertent creation of String instances that keep
inaccessible memory alive.
2017-07-17 13:53:45 -07:00
Ben Cohen
4d7ae8ca85 [stdlib] Fix array slice self-assignment bug (#10958)
* Fix bug where assigning from self wasn't checking bounds of the assigned slice matched

* break up if statement
2017-07-17 13:09:35 -07:00
Joe Groff
e2dc62b207 Merge pull request #11004 from jckarter/iuo-key-path
Handle IUO unwraps in key paths.
2017-07-17 12:02:30 -07:00
Joe Groff
69a290edda Handle IUO unwraps in key paths.
In the type checker, we need to recognize when a member lookup succeeded through an IUO unwrap, and insert the implicit optional-unwrap component into the key path. In the standard library, we need to cope with the fact that IUO is still a first-class type with unique type metadata in a few places. Fix for rdar://problem/33230845.
2017-07-17 11:21:36 -07:00
Yasuhiro Inami
e017508a9b Simplify CodingKey description 2017-07-17 12:02:56 +09:00
Dave Abrahams
fb35257511 [stdlib] Drop some @available(introduced:...)
These annotations make it hard to write code that works in both Swift 3 and Swift 4, so if they aren't needed we should remove them.
2017-07-16 07:22:09 -07:00
Yasuhiro Inami
98ed5f97de Improve CodingKey description (add double-quote) 2017-07-16 12:50:08 +09:00
Yasuhiro Inami
33582e61e7 Improve CodingKey description 2017-07-16 12:46:37 +09:00
Yasuhiro Inami
f4e8cbb4e5 Let CodingKey inherit CustomStringConvertible for better debugging 2017-07-16 12:13:10 +09:00
Ling Wang
c781dc1598 Fix code formatting issues 2017-07-15 12:32:33 -05:00
Dave Abrahams
c497969987 [stdlib] Swift4 Modernizations Compatible with Swift 3.2 2017-07-14 17:54:33 -07:00
swift-ci
efb7d75489 Merge pull request #10970 from apple/rdar-33307780 2017-07-14 17:14:44 -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
David Rönnqvist
e15ea5fcf3 [stdlib] Implement reduce with inout (SE-0171)
Implement and document `reduce(into:_:)`, with a few notes:

 - The `initial` parameter was renamed `initialResult` to match the first parameter in `reduce(_:_:)`.
 - The unnamed `combining` parameter was renamed `updateAccumulatingResult` to try and resemble the naming of the closure parameter in `reduce(_:_:)`.
 - The closure throws and `reduce(into:_)` re-throws.
 - This documentation mentions that `reduce(into:_)` is preferred over `reduce(_:_:)` when the result is a copy-on-write type and an example where the result is a dictionary.

Add benchmarks for reduce with accumulation into a scalar, an array, and a dictionary.

Update expected error message in closures test (since there are now two `reduce` methods, the diagnostic is different).
2017-07-14 23:24:42 +02:00
Ling Wang
6bbb96b97d String.UTF8View.Index's conversion init should check whether sourcePosition is already a utf8 index first. Otherwise it may return nil for a valid utf8 sourcePosition. 2017-07-14 14:27:41 -05:00
Rintaro Ishizaki
d2eab3c342 [stdlib] Use #if guarded switch case
_Cocoa{Set,Dictionary}{Buffer,Index,Iterator} can be completely
eliminated from non-ObjC runtime environments.
2017-07-14 18:14:34 +09: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
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
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
Max Moiseev
d9e0eef4aa Add an @available initializer for source compatibility 2017-07-12 15:12:39 -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
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
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
lynn
51eac53c4a fix minor mistake (#10839)
* fix minor mistake

Use the `flatMap` method. Parameter transform: A closure that takes the unwrapped value, right?

* revert unwrapped
2017-07-11 00:46:33 -07:00
Károly Lőrentey
9996d071c4 [stdlib] Define custom Words types for each standard fixed with integer
This adds 8 more collection views, but makes integer definitions
more consistent across all the available bit widths and
between 32-bit and 64-bit platforms.
2017-07-11 04:53:23 +02: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
e975445b70 [stdlib] Make UInt.Words.var internal
We don’t need Words’ members to be @_transparent;
simple conversions use _lowWord instead.
2017-07-11 03:26:20 +02:00
Károly Lőrentey
1dccb45278 [stdlib] Revert @_transparent to prevent SIL size explosion 2017-07-11 03:17:56 +02:00
Xiaodi Wu
9df52168ab Merge branch 'silence-warnings' of github.com:xwu/swift into silence-warnings 2017-07-10 16:46:40 -05:00
Xiaodi Wu
fbbe21331c Address reviewer comment 2017-07-10 16:45:24 -05:00