Commit Graph

256 Commits

Author SHA1 Message Date
Xiaodi Wu
1fe344b51f [stdlib] Match actual method names in an internal comment 2018-03-04 19:55:37 -06:00
Nate Cook
642cbbad7c [stdlib] Documentation revisions and expansions
- Adding docs for unbounded ranges
- Filling in missing docs for range-expression subscripts
- Equality operators for arrays
- Fix issues with range discussions
- Fill in missing integer docs
2018-02-19 11:49:58 -06:00
Xiaodi Wu
26dac8f5e0 Address reviewer comments for consolidated integer-to-string conversion 2018-02-06 21:40:49 -06:00
Xiaodi Wu
76e23368ad Consolidate integer-to-string implementations 2018-02-03 19:17:48 -06:00
Ben Cohen
9ee856f386 [stdlib][WIP] Eliminate (Closed)CountableRange using conditional conformance (#13342)
* Make Range conditionally a Collection

* Convert ClosedRange to conditionally a collection

* De-gyb Range/ClosedRange, refactoring some methods.

* Remove use of Countable{Closed}Range from stdlib

* Remove Countable use from Foundation

* Fix test errors and warnings resulting from Range/CountableRange collapse

* fix prespecialize test for new mangling

* Update CoreAudio use of CountableRange

* Update SwiftSyntax use of CountableRange

* Restore ClosedRange.Index: Hashable conformance

* Move fixed typechecker slowness test for array-of-ranges from slow to fast, yay

* Apply Doug's patch to loosen test to just check for error
2018-02-01 20:59:28 -08:00
Xiaodi Wu
21d59c415d Address reviewer feedback 2018-01-31 15:09:15 -06:00
Xiaodi Wu
78875d934c Update and fill in documentation for DoubleWidth and integer protocols 2018-01-30 20:52:24 -06:00
Xiaodi Wu
4b9ff41303 Address reviewer comments 2018-01-30 18:55:19 -06:00
Xiaodi Wu
cc0e64dec4 Implement efficient DoubleWidth division and fix division-related bugs 2018-01-28 14:01:06 -06:00
Xiaodi Wu
7e03829aab Improve _binaryLogarithm implementation and add tests 2018-01-18 16:45:41 -06:00
Max Moiseev
c8b12ee282 [stdlib] Adding derived equality/comparison operators to concrete integer types 2018-01-08 17:19:12 -08:00
Xiaodi Wu
d965a13c44 Implement generic conversions to floating point 2018-01-06 19:03:23 -06:00
Nate Cook
0782b482b3 [stdlib] Documentation improvements
- Revise Equatable and Hashable for synthesized requirements
- Complete Strideable and stride(from:...:by:) documentation
- Revise DoubleWidth type docs
- Add complexity notes for Set.index(of:) and .contains(_:)
- Fix typos in Set.formUnion docs
- Add missing axioms for SetAlgebra (SR-6319)
- Improve guidance for description and debugDescription
- Add note about the result of passing duplicate keys to
  Dictionary(uniqueKeysWithValues:)
- Fix typo in BinaryInteger docs
- Update Substring docs with better conversion example
- Improve docs for withMemoryRebound and isKnownUniquelyReferenced
- Add missing docs not propagated from protocols
2018-01-05 17:06:44 -06:00
Xiaodi Wu
cf179dada0 Fix a bug with unsigned integers in FixedWidthInteger._convert(from:) 2018-01-01 14:56:17 -06:00
Ben Cohen
4ddac3fbbd [stdlib] Eradicate IndexDistance associated type (#12641)
* Eradicate IndexDistance associated type, replacing with Int everywhere

* Consistently use Int for ExistentialCollection’s IndexDistance type.

* Fix test for IndexDistance removal

* Remove a handful of no-longer-needed explicit types

* Add compatibility shims for non-Int index distances

* Test compatibility shim

* Move IndexDistance typealias into the Collection protocol
2017-12-08 12:00:23 -08:00
Max Moiseev
8dbaa2a752 Revert "[stdlib] Temporarily exclude DoubleWidth from the standard library" 2017-12-05 15:37:07 -08:00
Max Moiseev
156e6eb848 Exclude DoubleWidth due to the binary size concerns
<rdar://problem/32726173>
2017-12-01 14:29:53 -08:00
Ben Cohen
c4f0b5fe94 [stdlib] Adopt conditional conformance for Indices, Slice, ReversedCollection (#12913)
* Refactor Indices and Slice to use conditional conformance

* Replace ReversedRandomAccessCollection with a conditional extension

* Refactor some types into struct+extensions

* Revise Slice documentation

* Fix test cases for adoption of conditional conformances.

* [RangeReplaceableCollection] Eliminate unnecessary slicing subscript operator.

* Add -enable-experimental-conditional-conformances to test.

* Gruesome workaround for crasher in MutableSlice tests
2017-11-30 09:10:22 -08:00
Philip Ridgeway
6926fd3412 Removes a superfluous "the" in a documentation comment. 2017-11-20 11:04:04 -08:00
Max Moiseev
93afb243ca Merge pull request #11917 from natecook1000/nc-uint-advance
[stdlib] Fix strideable methods for large unsigned values
2017-10-11 10:08:29 -07:00
Nate Cook
37b4083ac7 [stdlib] Try inlining integer stride methods 2017-10-10 13:00:36 -05:00
Max Moiseev
a24998a5b1 [stdlib] Add missing @_fixed_layout attributes to fix resilience build 2017-10-02 15:19:06 -07:00
Doug Gregor
31ad22df45 Make Numeric.Magnitude conform to Numeric 2017-10-01 15:08:22 -07:00
Xiaodi Wu
d88836bbf8 [stdlib] Fix strideable methods for large unsigned values
Int is still an insufficient stride type for binary integers,
but this improves the situation for values at the extremes of the
concrete integer types.
2017-09-29 22:58:11 -05:00
Max Moiseev
53b8419279 [stdlib] Make all the stdlib APIs @_inlineable
This change in theory should allow us to remove a special stdlib-only
sil-serialize-all compilation mode.

<rdar://problem/34138683>
2017-09-29 11:26:56 -07:00
swift-ci
79a3f9c415 Merge pull request #11670 from natecook1000/nc-rev-77-2 2017-09-19 10:15:59 -07:00
Nate Cook
4a1b74c266 [stdlib] Additional revisions
- Incorporate feedback from @xwu
- Add parameters for `dump`
- Duplicate some missing integer comments
2017-09-12 11:21:54 -05:00
Xiaodi Wu
d661204d7e Remove operators from Integers.swift.gyb 2017-09-02 12:05:18 -05: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
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
317e681a5b Mark more functions as @_inlineable to improve the performance of the stdlib in resilient mode 2017-08-21 16:16:07 -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
Nate Cook
1698fd388b [stdlib] Manually propagate integer documentation 2017-08-01 15:17:20 -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
Maxim Moiseev
47e78c071a Merge pull request #11044 from apple/rationalize-bitshifting
[stdlib] Rationalize bitshifting in protocols
2017-07-27 14:50:14 -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
Xiaodi Wu
f817803d01 Conform fixed-width integer types to LosslessStringConvertible 2017-07-25 21:57:42 -05:00
swift-ci
92898618cb Merge pull request #10982 from apple/stdlib-swift4-modernization 2017-07-20 18:56:23 -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
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
Dave Abrahams
c497969987 [stdlib] Swift4 Modernizations Compatible with Swift 3.2 2017-07-14 17:54: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