Commit Graph

3590 Commits

Author SHA1 Message Date
Xiaodi Wu
2d92c3969e Update documentation for init(truncatingIfNeeded:) 2017-08-27 14:43:20 -05:00
Xiaodi Wu
7e11f1822c Implement fixed-width integer conversions from binary floating point
Make internal stdlib function public because it is called from stdlib tests

Add some first-thought optimizations
2017-08-22 19:52:33 -05:00
Roman Levenstein
762731940d Force specialization of a very big function quotientAndRemainder for the most popular values of generic type parameters.
This reduces the amount of work to be done on the client side, because specializations from the stdlib can be used there.
2017-08-21 16:16:16 -07:00
Roman Levenstein
317e681a5b Mark more functions as @_inlineable to improve the performance of the stdlib in resilient mode 2017-08-21 16:16:07 -07:00
Michael Ilseman
70b836baab Merge pull request #10971 from an0/master
Fix String.UTF8View.Index's conversion init
2017-08-14 14:59:32 -07:00
Michael Ilseman
7c705c3a75 [stdlib] Deprecate String/Substring.CharacterView
CharacterView is now entirely redundant in Swift 4. Deprecate its
use. This also allows us to schedule the unbreaking of
String.CharacterView leakiness without a hard source break.
2017-08-10 17:24:06 -07:00
Michael Ilseman
64e0e1859e [stdlib] Deprecate popFirst in Swift 3.2
Add a deprecation warning for use of popFirst even with -swift-version
3, as it's prone to leaks under the old model. Test cases added.
2017-08-10 15:27:05 -07:00
Michael Ilseman
3243b8a59f [stdlib] Availability checking for String.*View.popFirst
Collection's popFirst is only present when the Collection is its own
SubSequence type. String and String's views are no longer their own
SubSequenes, so popFirst is no longer present. Unfortunately, this
breaks code in swift-version 3 and it also gives a terrible diagnostic
to users. This change introduces an implementation for swift-version 3
mode and better diagnostics for Swift 4 code. Tests included.
2017-08-09 19:41:52 -07:00
Michael Ilseman
2415a4df52 [stdlib] Drop Unicode 8 tries in stdlib (entirely)
This drops the last vestage of Unicode 8 tries from the standard
library. Switches everything over to use ICU.
2017-08-09 19:17:56 -07:00
Roman Levenstein
03dba709f3 [stdlib-code-size] Do not produce useless partial specializations for the shift operations on integers
This reduces the stdlib binary size by 200KB.
2017-08-07 17:12:26 -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
e3da1b4254 Rename methods to not conflict w/ existing names
Fixes unit test failues stemming from fileprivate "init(from:)" visibility on Decodable things.
2017-08-02 16:03:02 -07:00
Nate Cook
ff5b2f7c21 Merge pull request #11273 from natecook1000/nc-concrete-integer
[stdlib] Manually propagate integer documentation
2017-08-02 16:24:22 -05:00
Itai Ferber
fbdcbee7a2 Remove previous hack for SR-5206
As a temporary workaround for SR-5206, certain Foundation types which had custom behavior in JSONEncoder and JSONDecoder were granted special knowledge of those types internally in order to preserve strategies on encode/decode.

This replaces that special knowledge with a more general-purpose fix that works for all types and all encoders/decoders.
2017-08-02 14:11:29 -07:00
Nate Cook
4e45358a49 Merge branch 'master' into nc-dwformatting 2017-08-02 14:54:56 -05:00
Nate Cook
2df17f2a63 [stdlib] Minor doc edits 2017-08-01 15:59:23 -05:00
Nate Cook
1698fd388b [stdlib] Manually propagate integer documentation 2017-08-01 15:17:20 -05:00
Nate Cook
8329ca9da0 [stdlib] Improve docs for FP comparison predicates 2017-07-31 10:56:55 -05:00
Nate Cook
a51e32ad37 [stdlib] String API revisions
- Clarify StringProtocol conformance
- Deprecate ExpressibleByStringInterpolation
- String index conversions docs
- Describe shared string indices
2017-07-31 10:56:54 -05:00
Nate Cook
beeb816520 [stdlib] Manually propagate floating point documentation 2017-07-31 10:56:54 -05:00
Nate Cook
311e1dc7b0 [stdlib] Add documentation for key-path appending methods 2017-07-31 10:56:54 -05:00
Nate Cook
781f6326bd [stdlib] Various documentation revisions and fixes
- Revisions to unsafeDowncast and withVaList
- Fix the Int64/UInt64 discussion
- Buffer pointer revisions
- Fix Optional example to use new integer methods
- Revise and correct some UnsafeRawBufferPointer docs
- Fix symmetricDifference examples
- Fix wording in FloatingPoint.nextDown
- Update ImplicitlyUnwrappedOptional
- Clarify elementsEqual
- Minor integer doc fixes
- Comment for _AppendKeyPath
- Clarification re collection indices
- Revise RangeExpression.relative(to:)
- Codable revisions
2017-07-31 10:56:53 -05:00
Maxim Moiseev
52259b714b Merge pull request #11193 from xwu/lossless-integers
[stdlib] Conform fixed-width integer types to LosslessStringConvertible
2017-07-28 20:10:07 -07:00
Max Moiseev
5563ed1999 [stdlib] Remove reintroduced extendingOrtruncating call 2017-07-28 12:16:56 -07:00
Nate Cook
a7ce287a53 Merge branch 'master' into integers-revised 2017-07-28 12:23:48 -05:00
Nate Cook
1952128dca DoubleWidth feedback from @moiseev 2017-07-27 22:51:46 -05:00
Nate Cook
9a6fb39701 Merge pull request #11233 from natecook1000/nc-appendkeypath
[stdlib] Mark _AppendKeyPath as visible in interface
2017-07-27 22:49:55 -05:00
Michael Ilseman
befe6933a9 Merge pull request #11212 from milseman/massive_subview_controller
[stdlib] Give Substring its own views
2017-07-27 20:36:52 -07:00
Maxim Moiseev
47e78c071a Merge pull request #11044 from apple/rationalize-bitshifting
[stdlib] Rationalize bitshifting in protocols
2017-07-27 14:50:14 -07:00
Nate Cook
4c646d0da0 [stdlib] Mark _AppendKeyPath as visible in interface 2017-07-27 16:41:42 -05:00
Maxim Moiseev
2ba6cc9bd6 Merge pull request #11157 from airspeedswift/stringprotocolify
[stdlib] Switch Int/Float inits + join to be on StringProtocol
2017-07-27 14:22:25 -07:00
Xiaodi Wu
add2bce944 Revise doc comments and add test 2017-07-26 22:57:28 -05:00
Dave Abrahams
3c6f0c3c67 [stdlib] Repair Substring -> String conversion 2017-07-26 16:02:18 -07:00
Dave Abrahams
41c53ae729 [stdlib] Give Substring its own views
This necessary for ensuring the property that String doesn't keep
inaccessible memory alive.  For example, before this change,

    String(s.dropFirst().unicodeScalars)

would compile and produce a String that owned inaccessible memory.
Now it no longer compiles.

String's view's SubSequences are the same as the Substring's
view. E.g. String.UnicodeScalarView.SubSequence is
Substring.UnicodeScalarView.

New compatibility inits added, to work around the fact that many
previously failable initializers are now non-failable.
2017-07-26 15:59:51 -07:00
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