Michael Ilseman
442029607b
[stdlib] Add in sanity checks for out-of-bounds legacyOffsets.
...
UTF8View's endIndex needs to potentially apply a legacyOffset. This
adds a sanity check that it is in range, and a fast-path for the
common case of 0.
2017-07-26 15:58:04 -07:00
Michael Ilseman
6cb48529a9
[stdlib] Refactor out StdlibUnittest SPI from the stdlib.
...
Move _lines and _split out of the standard library and into
StdlibUnittest, which is why they were there in the first place. NFC.
2017-07-26 15:58:04 -07:00
Max Moiseev
1c3e597928
[stdlib] Get rid of ArithmeticOverflow type
2017-07-26 11:09:36 -07:00
Maxim Moiseev
5d47a0d98d
[stdlib] init<T : FloatingPoint> ==> init<T : BinaryFloatingPoint>
2017-07-26 11:09:36 -07:00
Maxim Moiseev
a5ff35cd41
[stdlib] extendingOrTruncating: => truncatingIfNeeded:
2017-07-26 11:09:36 -07:00
Michael Ilseman
2f0dafbac3
Merge pull request #11191 from milseman/very_persistent
...
[stdlib] Fix bug in Substring's _persistentContent
2017-07-26 08:57:53 -07:00
Rintaro Ishizaki
c36cb57054
[stdlib] Fix warnings in non-ObjC platforms. ( #11200 )
2017-07-26 22:42:55 +09:00
Xiaodi Wu
f817803d01
Conform fixed-width integer types to LosslessStringConvertible
2017-07-25 21:57:42 -05:00
Omar Sharif Fathi
888fe8df3d
Update String.swift
2017-07-26 02:40:45 +02:00
Michael Ilseman
10e9e336fe
[stdlib] Fix bug in Substring's _persistentContent
...
Substring's _persistentContent has a fast path that avoids a copy when
the Substring represents the entire outer String. It correctly
detected situations where the wrapped _StringCore was not itself a
slice, but was omitting the extra checks to make sure the Substring's
own range covered the entire String.
Test added.
2017-07-25 14:28:57 -07:00
Ben Cohen
92bc5b7829
Switch Int/Float inits + join to be on StringProtocol
2017-07-25 08:28:22 -07:00
Nate Cook
7e5c78c1d4
[stdlib] DoubleWidth formatting and bit shift audit
2017-07-24 19:37:32 -05:00
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