Commit Graph

3606 Commits

Author SHA1 Message Date
Doug Gregor
6ce063f769 Merge pull request #11769 from DougGregor/stdlib-recursive-constraints
[Stdlib] Make Sequence.SubSequence conform to Sequence.
2017-09-12 09:19:20 -07:00
swift-ci
8c65f6e785 Merge pull request #11751 from DougGregor/gsb-nested-same-type-match 2017-09-12 07:20:33 -07:00
Doug Gregor
7dc8737c9c [Sequence] Make Sequence.SubSequence conform to Sequence.
Addressed ABI FIXME’s #4, #5, #104 and #105, making Sequence’s
SubSequence conform to Sequence, with the same element type, and for
which the SubSequence of a SubSequence is the same SubSequence.

Fixes SR-318 / rdar://problem/31418206.
2017-09-12 06:52:01 -07:00
Doug Gregor
3b47b16a47 [Stdlib] Eliminate the _UnicodeEncoding_ protocol.
This protocol was only used to fake recursive protocol conformances;
collapse it into _UnicodeEncoding.
2017-09-12 06:34:10 -07:00
Michael Ilseman
de5968cbb4 [stdlib] Remove trivial FIXME; NFC 2017-09-11 17:27:37 -07:00
Michael Ilseman
29d0d142bb [stdlib] Better message for unavailable String.init(_:UTF8Buffer) 2017-09-11 17:14:32 -07:00
Slava Pestov
852cb30d04 stdlib: Explicitly define an _ObjectiveCType typealias for _SwiftNewtypeWrapper where the RawValue is _ObjectiveCBridgeable
Previously we relied on associated type inference inferring that
_ObjectiveCType should be Self.RawValue._ObjectiveCType, but this
doesn't work if we import a newtype wrapper after Sema has been
torn down.
2017-09-07 01:53:09 -07:00
Maxim Moiseev
29562f05bf Merge pull request #11746 from xwu/patch-3
[stdlib] Put new standard operators in the right place [NFC]
2017-09-05 17:10:23 -07:00
Maxim Moiseev
6c7d93491f Merge pull request #11627 from moiseev/swift-2-artifacts
[stdlib] Remove the Grand Renaming artifacts of Swift 3 era
2017-09-05 11:41:18 -07:00
Xiaodi Wu
d661204d7e Remove operators from Integers.swift.gyb 2017-09-02 12:05:18 -05:00
Xiaodi Wu
a4ac677bae Put new standard operators in the right place 2017-09-02 12:02:12 -05:00
Mark Lacey
b64551b853 [stdlib] Restore signatures to use UnsafeMutableBufferPointer.
Resolves rdar://problem/21933004.
2017-08-31 22:33:36 -07:00
Max Moiseev
1e51177fec Add back the Generator typealias in the name of source stability 2017-08-29 14:22:21 -07:00
Kuba (Brecka) Mracek
d03a575279 Unify the capitalization across all user-visible error messages (#11599)
* Unify the capitalization across all user-visible error messages (fatal errors, assertion failures, precondition failures) produced by the runtime, standard library and the compiler.

* Update some more tests to the new expectations.
2017-08-29 12:16:04 -07:00
Nate Cook
050268d876 [stdlib] Documentation revisions
- Update NSRange -> Range guidance
- Fix example in Optional
- Improve RangeExpression docs
- Fix issue in UnsafeRawBufferPointer.initializeMemory
- Code point -> scalar value most places
- Reposition the dot above the scripty `i'
- Fix ExpressibleByArrayLiteral code sample
2017-08-29 09:41:55 -05:00
Maxim Moiseev
ee5fb33656 [stdlib] Remove the Grand Renaming artifacts of Swift 3 era 2017-08-28 15:54:11 -07:00
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