Commit Graph

26 Commits

Author SHA1 Message Date
Evan Wilde
ddaf003c56 Get stdlib building again
PR 79186 (https://github.com/swiftlang/swift/pull/79186) moved one of
the mandatory passes from the C++ implementation to the Swift
implementation resulting in a compiler that is unable to build the
standard library. The pass used to ensure that inaccessible control-flow
positions after an infinite loop was marked with `unreachable` in SIL.
Since the pass is no longer running, any function that returns a value
that also has an infinite loop internally must place a fatalError after
the infinite loop or it will fail to compile as the compiler will
determine that the function does not return from all control flow paths
even though some of the paths are unreachable.
2025-03-06 13:32:54 -08:00
Nate Cook
38e1370884 Revert "Revert count(where:)" (#70816)
* Revert "Revert count(where:)"

This reverts commit 779ea19a6a.

Now that SE-0220 has been re-accepted, this adds the `count(where:)` 
Sequence method to the standard library.
2024-03-29 13:53:53 -05:00
Alexander Momchilov
123fd36efb "a equivalence" → "an equivalence" 2024-02-24 19:32:50 -05:00
TappediOS
52adf77ab9 [stdlib] more readable of lexicographicallyPrecedes 2023-04-23 19:27:02 +09:00
William Entriken
81b0d3a27f Correct complexity statement for Sequence compactMap 2022-05-28 14:59:46 -04:00
Alex Martini
b0f339799f Call out the behavior for empty sequences.
Fixes rdar://60543202

(cherry picked from commit d0d4a88823)
2021-08-26 17:03:47 -07:00
Alex Binary
7ea09a9032 Fix comments on _compactMap(_:) 2020-05-24 10:59:47 +02:00
Valeriy Van
933d8a8073 Fixes example snippets in SequenceAlgorithms.swift 2020-05-02 16:38:56 +02:00
Paul Hudson
06f82a53b5 Replaced the majority of ' : ' with ': '. 2019-07-18 20:46:07 +01:00
Ben Cohen
779ea19a6a Revert count(where:) 2019-01-31 18:57:17 -08:00
Nate Cook
f19aca6cb0 [WIP] Revise documentation for Swift 5 stdlib additions (#21333)
* Revise the Unicode scalar/Character properties
* Minor revisions to `compactMapValues` docs.
* Add documentation for AdditiveArithmetic, revise Numeric
* Apply minor style updates to count(where:).
* Revise string interpolation docs.

- Convert table of interpolation examples to a list of examples. Tables
aren't supported by Swift markup, so this wouldn't render properly in
Xcode or on the web.
- Add a description of what a user must implement in a custom
string interpolation type to get the behavior they want.

* Revise isMultiple(of:) docs.

- In particular, add emphasis to mathematical symbols and equations to
match how we document such things elsewhere.
- I'm using asterisks for single symbols, and underscores for equations
because it's easier to read in-source when you don't have to escape
multiplication within emphasis.

* Add some abstracts to the SIMD vector types.

- Adds a dictionary of spelled out numbers. Only numbers < 10
  should be spelled out according to editorial.
- Adds abstracts to some of the basic members.
- Includes parameter descriptions for the xyzw properties and inits,
but not for the unlabeled initializers. Combined with the protocol
extension method abstracts, this should complete coverage of the concrete
types.
2019-01-03 18:19:20 -06:00
Ben Cohen
da614764ed Make reduce(inout:) take its initial value owned 2018-11-28 17:19:39 -08:00
Nate Cook
dfb01b6a6a [stdlib] Minor documentation revisions (#20045)
* [stdlib] Minor documentation revisions
* [docs] Convert 'nonoptional' to 'non-optional'
We're switching to 'non-optional' across the board, as the unhyphenated
form is too easy to read as 'no-noptional'.
2018-10-26 00:05:45 -05:00
Ben Cohen
5e2c815edf Mark reversed as consuming (#19617) 2018-10-01 19:31:22 -07:00
Soroush Khanlou
5736cacc9a Add count(where:) and tests (#16099)
* add count(where:) and tests

* Revise count(where:) documentation

* Remove errant word in abstract

* add a benchmark for ranges and strings with help from @natecook1000

* update benchmark to use Array instead of Range
2018-09-13 12:37:06 -05:00
Karoy Lorentey
2201d0e3c8 [stdlib] Set, Dictionary: Move compatibility typealiases to end of file 2018-08-16 20:05:32 +01:00
Nate Cook
3d7dfc232b [stdlib] Update complexity docs for seq/collection algorithms (#17254)
* [stdlib] Update complexity docs for seq/collection algorithms

This corrects and standardizes the complexity documentation for Sequence
and Collection methods. The use of constants is more consistent, with `n`
equal to the length of the target collection, `m` equal to the length of
a collection passed in as a parameter, and `k` equal to any other passed
or calculated constant.

* Apply notes from @brentdax about complexity nomenclature

* Change `n` to `distance` in `index(_:offsetBy:)`

* Use equivalency language more places; sync across array types

* Use k instead of n for parameter names

* Slight changes to index(_:offsetBy:) discussion.

* Update tests with new parameter names
2018-07-24 01:01:34 -05:00
Nate Cook
2536277362 [stdlib] Various documentation improvements (#18013)
- Revise Bool.toggle() discussion and fix attribute placement
- Revise to Hasher abstracts and discussions
- Correct the name of the remainder operator
- Clean up deprecations and paste-os w/in UnsafePointer
2018-07-18 12:41:22 -05:00
Ben Cohen
c6b41a5ae5 Inlineable: protocol interface only 2018-07-06 12:03:34 -07:00
Ben Cohen
a4230ab2ad [stdlib] Update stdlib to 4.0 and reorganize compatibility shims (#17580)
* Update stdlib to 4.0 and move all compatibility shims into a dedicated source file
2018-06-29 06:26:52 -07:00
Ben Cohen
8f27db3433 underscore inlineable to inlinnable 2018-04-27 10:23:16 -07:00
Ben Cohen
fc60c6c4e0 Delete rogue where: label holdover 2018-04-27 10:09:14 -07:00
Ben Cohen
d6444f5f27 Add Sequence.allSatisfy 2018-04-27 08:53:35 -07:00
crea
247ee7a82f fix documentation comment of flatMap<SegmentOfResult : Sequence> 2018-04-10 01:20:15 -07:00
Slava Pestov
e1f50b2d36 SE-0193: Rename @_inlineable to @inlinable, @_versioned to @usableFromInline 2018-03-30 21:55:30 -07:00
Ben Cohen
143c39bd7c [stdlib] Implement Equatable/Comparable sequence algos in terms predicate ones (#14758)
* Implement Equatable/Comparable sequence algos in terms predicate ones

* Remove IteratorSequence use

* de-gyb SequenceAlgorithms.swift
2018-02-22 07:52:35 -08:00