Commit Graph

39 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
Guillaume Lessard
a27d9c426a Merge pull request #71912 from oscbyspro/better-joined-distance-from-to-int-min
FlattenSequence/distance(from:to:) untrapping Int.min
2024-05-17 16:17:01 -07:00
Oscar Byström Ericsson
af0c9fae8e FlattenSequence/distance(from:to:) untrapping Int.min (v6).
1. Put the first region inside the if-else (same branch condition).
2. Use the forward distance in the highest region (as done in the middle).
2024-03-07 13:19:45 +01:00
Alejandro Alonso
f9f640b141 Sendablize the standard library
oops dont add this flag

no more nonisolated
2024-03-05 15:02:09 -08:00
Oscar Byström Ericsson
7703ae4a3b FlattenSequence/distance(from:to:) untrapping Int.min (v5).
1. FlattenSequence/distance(from:to:) cleanup.
2. FlattenDistanceFromToTests cleanup.
3. FlattenDistanceFromToTests availability checks.
2024-03-01 11:11:54 +01:00
Oscar Byström Ericsson
e8db705e43 FlattenSequence/distance(from:to:) untrapping Int.min (v2).
A better, albeit a bit more verbose, method.
2024-02-27 11:51:08 +01:00
Oscar Byström Ericsson
401f8d13fe FlattenSequence/distance(from:to:) untrapping Int.min
This patch makes it so FlattenSequence/distance(from:to:) can return Int.min without trapping.
2024-02-27 07:14:46 +01:00
Oscar Byström Ericsson
9abed8c833 FlattenSequence/distance(from:to:) enhancements v3.
A half-open range is a better expression of intent.
2024-02-21 09:59:54 +01:00
Oscar Byström Ericsson
e7b9fbbe12 FlattenSequence/distance(from:to:) enhancements v2.
1. The unchecked and force-unwrapped stuff did not matter.
2. Calling distance(from:to:) is a bit faster than SubSequence/count.
2024-02-16 11:41:10 +01:00
Oscar Byström Ericsson
11c0231d20 FlattenSequence/distance(from:to:) enhancements.
I was looking through Swift's issues tab and found this issue (#57496), which points out the poor performance of `FlattenSequence/count`. The current `count` implementation calls `distance(from:to:)`, which iterates through the entire collection, so I thought I'd improve that method. The new version computes the distance as the sum of three parts, with a fast path when both indices belong to the same underlying collection. Note that it does this by calling either `count` or `distance(from:to:)` on each underlying collection, which makes `[repeatElement(0, count: Int.max)].joined().count` instant, for example.
2024-02-15 12:45:42 +01:00
Matt Zanchelli
be13b470aa Fix typos
becuase -> because
preceeds -> precedes
initalizer -> initializer
intialize -> initialize
libary -> library
notfication -> notification
reciever -> receiver
collecton -> collection
exlcusive -> exclusive
techincal -> technical
compatability -> compatibility
setps -> steps
accomodate -> accommodate
brakcet -> bracket
fraciton -> fraction
programm -> program
concequently -> consequently
ecoding -> encoding
timeIntervalforSelfEnd -> timeIntervalForSelfEnd
2020-12-21 18:44:03 -05:00
Paul Hudson
06f82a53b5 Replaced the majority of ' : ' with ': '. 2019-07-18 20:46:07 +01:00
Ben Cohen
e9d4687e31 De-underscore @frozen, apply it to structs (#24185)
* De-underscore @frozen for enums

* Add @frozen for structs, deprecate @_fixed_layout for them

* Switch usage from _fixed_layout to frozen
2019-05-30 17:55:37 -07:00
Slava Pestov
3917268b35 stdlib: Work around associated type inference bugs 2019-05-28 22:08:31 -04:00
Ben Cohen
1673c12d78 [stdlib] Replace "sanityCheck" with "internalInvariant" (#20616)
* Replace "sanityCheck" with "internalInvariant"
2018-11-15 20:50:22 -08:00
Ben Cohen
df2307e035 [stdlib][DNM] Collapse sequence and collection wrappers (#20221)
* Concretize dropFirst/Last/sufix/prefix from Sequence

Remove split customization point

Eliminate SubSequence from Sequence protocol

Collapse LazyCollection

Collapse LazyMapCollection

Eliminate _SequenceWrapper

Collapse LazyFilterCollection

Collapse LazyDrop/PrefixWhileCollection

Fix tests, ABI stability update

Collapse FlattenSequence

* Add entries to source/ABI compatible expected results.

* Update tests to avoid pre-10.14 objc runtime bug

* Expunge _preprocessingPass
2018-11-14 10:05:58 -08:00
Ben Cohen
9ce2143335 Additional ownership annotations 2018-10-03 19:10:22 -07:00
Ben Cohen
ae6f5dd604 [stdlib] Add consuming/owned annotations to Collection implementations (#19360)
* Add consuming/owned annotations to Collection implementations

* Update SILOptimizer tests

* Fix access_marker_verify test

* XFAIL reconstruct_type_from_mangled_name
2018-09-21 12:06:56 -07:00
Ben Cohen
dd2f3b4386 [stdlib] More inalienable auditing (#18925)
* Removing FIXME from methods also marked always/never

* Unavailable/deprecated things don't need inlining

* Trivial implementations

* Enum namespaces

* Unsafe performance of opaque/raw pointer

* Dump doesn't need to be fast

* Error paths shouldn't require inlining

* Consistency with surrounding code

* Lazy performance needs specialization
2018-08-23 18:52:21 -07:00
Ben Cohen
074dc43c3e Restore Sequence conformance to FlattenSequence.Iterator (#18024) 2018-07-17 20:00:30 -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
Karoy Lorentey
07c1b74cc4 [stdlib] Audit inlinability of Hashable implementations
As a general rule, it is safe to mark the implementation of hash(into:) and _rawHashValue(seed:) for @_fixed_layout structs as inlinable.

However, some structs (like String guts, Character, KeyPath-related types) have complicated enough hashing that it seems counterproductive to inline them. Mark these with @effects(releasenone) instead.
2018-05-31 18:24:59 -07:00
Nate Cook
7a4e0a32f6 [stdlib] Revise documentation
This includes various revisions to the APIs landing in Swift 4.2, including:
- Random and other randomness APIs
- Hashable changes
- MemoryLayout.offset(of:)
2018-05-18 11:31:54 -05:00
Karoy Lorentey
0342ce3b96 [SE-0206][stdlib] Remove obsolete hashValue implementations
These are now synthesized by the compiler.
(Inlinability will be different, but that seems fine.)
2018-04-30 10:17:09 +01:00
Karoy Lorentey
0fb3e88110 [SE-0206][stdlib] De-underscore Hashable.hash(into:) 2018-04-24 17:42:42 +01:00
Karoy Lorentey
45cb8b7123 [SE-0206][stdlib] De-underscore Hasher 2018-04-24 17:42:42 +01:00
Karoy Lorentey
ccdc218cbd [stdlib] _Hasher: append => combine 2018-04-18 14:18:44 +01:00
Slava Pestov
2e5aef9c8d stdlib: Remove redundant @usableFromInline attributes 2018-04-06 00:02:30 -07:00
Slava Pestov
e1f50b2d36 SE-0193: Rename @_inlineable to @inlinable, @_versioned to @usableFromInline 2018-03-30 21:55:30 -07:00
Karoy Lorentey
08c3f8a610 [stdlib] Use _Hasher in conditional Hashable implementations
Implement _hash(into:) rather than hashValue.
2018-03-23 19:09:28 +00:00
Karoy Lorentey
6530c8870c [stdlib] Remove unnecessary attributes and clarify comments 2018-03-23 19:09:28 +00:00
Xiaodi Wu
4675fc9a28 [stdlib] Add @_inlineable attribute with FIXME to hashValue implementations 2018-03-23 19:09:04 +00:00
Xiaodi Wu
c6a56a2805 [stdlib] Add availability annotation to other new conformances and members 2018-03-23 19:09:04 +00:00
Karoy Lorentey
f8ce96273e [stdlib] Implement _hash(into:) for standard Hashable types. 2018-03-09 14:35:22 +00:00
Nate Cook
fa762786d8 [stdlib] Remove redundant joined() methods (#14590)
* [stdlib] Improve FlattenCollection.Index hashValue

* [stdlib] Remove redundant joined() methods
2018-02-13 13:13:22 -08:00
Doug Gregor
fc253e8a23 [Stdlib] Fix requirements on FlattenCollectionIndex.
FlattenCollectionIndex recently became a typealias, but overstated its
requirements.
2017-12-21 10:07:11 -08:00
Max Moiseev
f5e93f63e9 [tests] Add conformance tests for FlattenSequence/FlattenCollection 2017-12-19 14:58:25 -08:00
Ben Cohen
9361a6b66f [stdlib] Nest Iterator and Index types for various stdlib types (#13489)
* Nest various top-level Iterator and Index types, and flatten extensions.

* Fix tests from nesting iterator

* Nest Unsafe*BufferPointer.Iterator, extensionify UnsafeBufferPointer

* Degyb LazyCollection

* Nest Flatten iterator and index
2017-12-18 15:27:35 -08:00
Max Moiseev
c27b366f46 [stdlib] Utilize conditional conformances for FlattenCollection (#13476)
* [stdlib] Utilize conditional conformances for FlattenCollection

* Fix indentation [NFC]
2017-12-16 10:57:02 -08:00