57 Commits
Author SHA1 Message Date
Karoy Lorentey d07dc32dfa Sources: Add unsafe keywords where needed 2026-10-01 11:14:29 -07:00
Karoy Lorentey 0ec72a9532 Stop using @_spi attribute and @testable import 2026-09-29 18:32:55 -07:00
Anton Karpov c2b2092f94 Name the documented arguments the way the declarations name them
Twenty-five doc comments in the shipping modules name an argument that the
declaration below them does not have, so DocC has nothing to bind the
description to and drops it. Nothing warns about this.

Most of them are renames that the comment did not follow, and the file itself
usually holds the proof: RigidDeque.prepend says - maxCount while its own
Complexity line already says newItemCount, and append(copying:) has three
overloads where the oldest still takes newElements and the two newer ones take
items with the older one's wording.

Three entries name an argument that no longer exists at all and are removed
rather than renamed.
2026-08-13 16:29:06 +03:00
Karoy Lorentey 8380ca41da Merge pull request #682 from lorentey/container-updates
[ContainersPreview] Update Container protocols
2026-07-22 13:08:25 -07:00
Karoy Lorentey bb0dc189ef maximumCount → maxCount
While we’re here, adjust `RigidSet.insert(maximumCount:initializingWith:)` and similar APIs to be consistent with RangeReplaceableContainer’s methods.
2026-07-07 14:21:53 -07:00
wjdtjq6 62a08e503e docs: fix typos in doc comments and DocC article 2026-07-02 21:17:11 +09:00
Karoy Lorentey 1447248b49 [BitCollections] BitArray.insert(repeating:count:at:): Fix bogus precondition 2026-05-01 14:34:51 -07:00
Karoy Lorentey 80878519f2 [doc] Fix most issues reported by docc
DocC keeps changing its link syntax. The latest iteration appears to have trouble dealing with `Self`-taking or `Self`-returning methods, so change our API to replace `Self` with a direct mention of the concrete type. ¯\\\_(ツ)\_/¯

That said, the new compiler also found a large number of mismatching parameter names, and that was really helpful.
2026-03-09 14:14:51 -07:00
Karoy Lorentey 1c69635852 Add SPDX-License-Identifier tags 2026-03-05 19:39:24 -08:00
Karoy Lorentey d9b09ecde8 Update copyright dates 2026-03-05 19:39:20 -08:00
Nate Cook 54ca53612f Include notes about index mutation in span(after/before:)
The indexes passed to span(after:) and friends on UniqueArray
and RigidArray are modified before return. This adds notes
about the updated values to the method documentation, along
with a few other minor formatting changes (dropping smart
quotes, single-sentence abstracts).
2026-03-02 16:38:48 -08:00
Karoy Lorentey bf9a7033a0 [BasicContainers] Add early drafts for RigidSet/RigidDictionary 2026-02-16 17:15:59 -08:00
Karoy Lorentey 9503f8fe57 Improve consistency of precondition failure messages
More uniform message strings should feel better, and they should ever so slightly reduce code size.
2026-02-04 10:27:17 -08:00
Karoy Lorentey eac10abae2 Stop using @_exported import
- Stop using unstable import attributes with undefined/flaky semantics in package contexts.
- Freeze the contents of the Collections module. Do not make the new RigidDeque/UniqueDeque types from there, at least not yet. Replace reexported types with typealiases, and reexported protocol extensions with redefinitions forwarding to a common implementation in the original module.
2026-01-30 12:07:28 -08:00
Karoy Lorentey 8687ef52ea [BitCollections] Add missing imports for InternalCollectionsUtilities
Recent development compiler versions have started emitting errors for previously undiagnosed cases where a conformance in another module is referenced by a source file that does not itself explicitly import that module. Add the missing imports.
2025-12-11 14:49:27 -08:00
faimin f6256df262 Add the missing macro condition when import InternalCollectionsUtilities 2025-07-30 14:44:22 +08:00
Tony Parker c883a1729a Add support for embedded Swift mode
Remove calls to `debugPrint` (which does not exist), and ifdef out support for `Codable` and `Reflection`.
2025-07-17 16:36:56 -07:00
Karoy Lorentey 6819c6d149 Enable MemberImportVisibility and fix issues uncovered 2025-05-20 18:11:44 -07:00
Karoy Lorentey 35d5746117 Rename _CollectionsUtilities to InternalCollectionsUtilities
We are forced to do this due to an Xcode issue (#364) with underscored module names.

This module remains unstable, despite the removal of the underscore. Directly importing it from outside the package remains unsupported. This module and/or its entire contents may go away or change in incompatible ways in any future swift-collections release.
2024-05-29 14:00:13 -07:00
Karoy Lorentey a0da2df799 [BitArray] Update LosslessStringConvertible initializer to accept new description format 2024-01-31 19:34:36 -08:00
Karoy Lorentey ae641c3d5d [BitArray] Fix description implementation; update tests 2024-01-31 19:34:36 -08:00
Karoy Lorentey e01391e562 [BitArray] Fix logic error in toggleAll()
D’oh — lucky the test coverage caught this; unlucky that the test wasn’t deterministic, and the chances of this occurring were quite low.
2024-01-31 19:34:36 -08:00
Karoy Lorentey 3bc1c3be46 [BitCollections] Update copyright dates 2024-01-30 18:09:37 -08:00
Karoy Lorentey db3bd17b40 [BitCollections] Adopt some instead of classic generic where possible 2024-01-30 18:07:00 -08:00
Karoy Lorentey 0da60c2075 [BitArray] Enclose description in angle brackets
This prevents producing an empty string for the `description` of an empty bit set, and thus prevents us from having to include a diverging `debugDescription`.
2024-01-30 17:58:52 -08:00
Karoy Lorentey de8ba5d7ad [BitArray] Disable bitwise operators for now
The current family of operations is far too restrictive, and the generalization is a topic of ongoing investigation. In particular, the operator syntax seems unlikely to survive when we want to support operations over slices.

Don’t ship BitArray with API that we’ll potentially regret; instead, just leave these off for now.
2024-01-29 17:01:00 -08:00
Karoy Lorentey 09c09f0f73 Fix CustomStringConvertible/CustomDebugStringConvertible conformances
- For CustomStringConvertible, `description` should print elements using `String(reflecting:)` rather than `String(describing:)`, to avoid element output from interfering with syntactically relevant punctuation within structured list displays.
- To make this work without making displays overly verbose, make `debugDescription` mostly the same as `description`, except for escaping raw string displays when and if needed.
- Avoid printing type names in `debugDescription` — it is generally not helpful, as the type is already easily accessible elsewhere. Including it makes for overly verbose displays when the type serves as an Element of a collection.
- Avoid having `debugDescription` return the empty string — it can be confusing when such a description appears in list displays.

Resolves #301.
2023-07-06 17:25:11 -07:00
Karoy Lorentey a8dad62bc9 Remove obsolete swift(>=5.5)/swift(>=5.6) checks 2023-04-10 18:33:52 -07:00
Karoy Lorentey 8ca5c0367f Merge pull request #263 from lorentey/bitcollections-finalization
BitArray API refinements & additions
2023-04-10 17:32:10 -07:00
Karoy Lorentey cbab9e3737 Introduce COLLECTIONS_SINGLE_MODULE condition 2023-03-21 18:42:33 -07:00
Karoy Lorentey a360969ec6 [BitArray] Add masking and resizing shifts 2023-01-31 18:04:30 -08:00
Karoy Lorentey 866d00798f [BitArray] Add LosslessStringConvertible conformance 2023-01-31 18:02:16 -08:00
Karoy Lorentey 17343b752a [BitArray] fill(in:with:), insert(repeating:count:at:), append(repeating:count:) 2023-01-31 18:01:46 -08:00
Karoy Lorentey a90b73966a [BitArray] Add conformance to ExpressibleByStringLiteral 2023-01-31 18:00:27 -08:00
Karoy Lorentey a8bde63439 [BitArray] Add toggleAll(), toggleAll(in:) 2023-01-31 17:59:56 -08:00
Karoy Lorentey c15b0d9889 [BitArray] Add BitArray → BinaryInteger conversion initializers
extension BinaryInteger {
  public init(truncatingIfNeeded source: BitArray)
  public init?(exactly source: BitArray)
  public init(_ source: BitArray)
}
2023-01-31 17:59:24 -08:00
Karoy Lorentey c15e484f5a [BitArray] Add init(minimumCapacity:) 2023-01-31 17:43:06 -08:00
Karoy Lorentey 4281dc4482 [BitArray] Change description to print bit arrays as binary numerals
This matches std::bitset, and it seems to be the more logical option.
2023-01-31 17:39:46 -08:00
Karoy Lorentey 03b62ffb6e [BitArray] random(count:using:) → randomBits(count:using:) 2023-01-31 17:33:55 -08:00
Karoy Lorentey 6cb03fee98 [BitCollections] Update file headers 2023-01-31 17:30:39 -08:00
Karoy Lorentey a2f4b18ae0 [BitSet, OrderedCollections] Unify UnsafeBitSet implementations 2022-11-28 16:30:55 -08:00
Karoy Lorentey f76630db8e [Internals] Add missing internal checking predicates & docs for all 2022-10-18 22:13:19 -07:00
Karoy Lorentey 541bd53958 [BitCollections] Move shared utilities to _CollectionsUtilities 2022-10-09 20:11:51 -07:00
Karoy Lorentey 14432582dc [BitArray] Explicitly conform to Sendable 2022-10-05 11:33:31 -07:00
Károly Lőrentey 141ef3c706 [BitArray] Use a platform-independent Codable encoding 2022-09-04 19:26:46 -07:00
Karoy Lorentey 5fe91efeba [BitArray] Add Codable conformance 2022-08-28 17:32:46 -07:00
Karoy Lorentey bae950193f [BitArray] Add Custom[Debug]StringConvertible and CustomReflectable conformances 2022-08-26 14:19:56 -07:00
Karoy Lorentey 5bc22eaf9b [BitArray] Add docs. 2022-08-25 23:50:35 -07:00
Karoy Lorentey fcac09d86a [BitSet, BitArray] Add random factories 2022-08-25 22:21:34 -07:00
Karoy Lorentey 544507ee62 [BitArray] Add some docs. 2022-08-25 20:26:48 -07:00