Karoy Lorentey
ea60d293b4
Fix test issues with single-module variant
2023-03-21 18:43:46 -07:00
Karoy Lorentey
cbab9e3737
Introduce COLLECTIONS_SINGLE_MODULE condition
2023-03-21 18:42:33 -07:00
Karoy Lorentey
cc181a3bce
HeapModule: _Node → _HeapNode
...
This makes this name unique throughout the package, allowing this code to be built as a single, huge module.
2023-03-21 16:39:03 -07:00
Karoy Lorentey
424c8ece98
HashTreeCollections: Qualify internal type names with “Hash”
...
This makes them unique throughout the package, allowing this code to be built as a single, huge module.
2023-03-21 16:37:22 -07:00
Karoy Lorentey
8394ea7575
Clean up test definitions
2023-03-21 01:30:03 -07:00
Karoy Lorentey
28010b2f6c
Use COLLECTIONS_INTERNAL_CHECKS
2023-03-21 01:28:13 -07:00
Karoy Lorentey
ad82bc3f80
Naming review
2023-03-21 01:21:43 -07:00
Karoy Lorentey
dc23b4d621
Rope: Fix splitting logic after insertions
...
I changed the minNodeSize formula to match with the B-tree definition, but I failed to match the insertion logic, so it left trees with undersized nodes. D’oh!
2023-03-21 01:06:53 -07:00
Karoy Lorentey
88286b661d
BigString: Fix Issue in utf16.distance when endpoint is on the trailing surrogate of the first scalar in a chunk
2023-03-21 01:04:12 -07:00
Karoy Lorentey
6f3f19d1c5
_Rope → Rope
2023-03-20 23:49:57 -07:00
Karoy Lorentey
51ef8613c2
Underscore more internals
2023-03-20 22:27:32 -07:00
Karoy Lorentey
0ad7f0ce38
_BString → BigString
2023-03-20 21:20:30 -07:00
Karoy Lorentey
706be4d9df
Also, don’t forget to call super.setUp
2023-03-20 19:54:44 -07:00
Karoy Lorentey
24e58e86fc
Don’t override XCTestCase.invokeTest on non-Darwin systems
2023-03-20 19:49:42 -07:00
Karoy Lorentey
44cff40712
Work around SPM limitations around test case availability 💗
2023-03-20 19:34:52 -07:00
Karoy Lorentey
b022b7fee5
Make _BString and _Rope public
2023-03-20 18:36:37 -07:00
Karoy Lorentey
73de433eef
Restore workaround for SR-14663
2023-03-20 16:47:58 -07:00
Karoy Lorentey
09577a31ee
RopeModule→_RopeModule. Stop reexporting it from Collections.
...
This module is not source stable; mark it as such by prepending
the module name with an underscore.
2023-03-20 16:47:56 -07:00
Karoy Lorentey
79f1e16afd
Don’t skip building/testing BitCollections and HeapModule
2023-03-20 16:38:38 -07:00
Karoy Lorentey
975a8902ff
Disable modules that haven’t gone through API review yet
...
These are disabled on the package manifest level.
To locally reenable them, Package.swift needs to be manually edited to enable COLLECTIONS_ENABLE_UNSTABLE_MODULES.
To mark a module as ready for production use, it has to be defined using `registerLibrary` instead of `registerUnstableLibrary`. This can only be done once the module has gone through API review. (Or if it becomes an underscored — i.e., explicitly unstable — module.)
2023-03-20 15:26:11 -07:00
Karoy Lorentey
535b8b8562
Fix compatbility with Swift toolchains below 5.8
2023-03-20 14:25:28 -07:00
Karoy Lorentey
ddcd1788aa
Unconditionally enable use of _CharacterRecognizer’s Equatable conformance if we aren’t building a package
2023-03-20 13:12:14 -07:00
Karoy Lorentey
da78365bef
_BString: Add isIdentical(to:) to all string views
2023-03-20 13:12:14 -07:00
Karoy Lorentey
b50fb5aab5
_BString.resolve: Don’t crash when resolving indices in the empty string
2023-03-20 13:12:14 -07:00
Karoy Lorentey
64a8098bf9
_BSubstring.UnicodeScalarView: Fix range-replacing mutations that don’t take indices
2023-03-20 13:12:14 -07:00
Karoy Lorentey
b355480eb7
_BString: Make unicodeScalars properties mutable
2023-03-20 13:12:13 -07:00
Karoy Lorentey
b8927d819b
BigString: Flesh out views, make them consistent with _BString
2023-03-20 13:12:13 -07:00
Karoy Lorentey
d79a752fc8
_BString: Review views & add missing functionality/shortcuts
2023-03-20 13:12:13 -07:00
Karoy Lorentey
cffcd517a2
BigString: Start modernizing
2023-03-20 13:12:13 -07:00
Karoy Lorentey
6a7f53c3da
_BString: Add conversion initializers from all views
2023-03-20 13:12:12 -07:00
Karoy Lorentey
03d7c43c22
_BString: Add index rounding methods to all views
2023-03-20 13:12:12 -07:00
Karoy Lorentey
258d22947c
_BString: Review Equatable implementations
2023-03-20 13:12:12 -07:00
Karoy Lorentey
abf5dfd260
_BSubstring: Conform to Comparable
2023-03-20 13:12:12 -07:00
Karoy Lorentey
1182398068
_BString: Give each view a custom iterator by hooking up the existing implementations
2023-03-20 13:12:12 -07:00
Karoy Lorentey
59b5c634d0
_Rope.UnsafeHandle._removeChild(at:): Fix buffer overflow uncovered by ASan
2023-03-20 13:12:12 -07:00
Karoy Lorentey
a10439bc32
_BString, _BSubstring: Merge character views into top-level types. Add RangeReplaceableCollection conformances.
...
This emulates the standard String.
2023-03-20 13:12:12 -07:00
Karoy Lorentey
eda72e344f
_BString: Fix character index rounding; use it when accessing character data
...
Oops, `_BString.subscript(character:)` failed to round down to a character boundary before trying to access the addressed character. It also resolved the index with `preferEnd` set to true, which isn’t what we actually want.
2023-03-20 13:12:12 -07:00
Karoy Lorentey
e0f8305a99
_BString.hashUTF8(into:from:end:): Fix typo
...
- The original code accidentally used `start` instead of `end` to normalize the end of the range, so it did not actually hash any actual string contents.
- While we’re here, extract the task of iterating over substring chunks into a reusable standalone method.
2023-03-20 13:12:11 -07:00
Karoy Lorentey
28727f7c56
_BString: Implement views
...
Having all core functionality exposed by the top-level type is not a bad idea; unfortunately substrings are tricky to get right, so it’s better to implement that out of the box.
2023-03-20 13:12:11 -07:00
Karoy Lorentey
b5e3bee275
_BString.Index: Add alignment bits
...
Use them to speed up index rounding.
(And, somewhat questionably, subscripting.)
2023-03-20 13:12:11 -07:00
Karoy Lorentey
7444bb24cb
_CharacterRecognizer don’t use conformances that aren’t in the Xcode 14.3 beta
2023-03-20 13:12:11 -07:00
Karoy Lorentey
4f2024c44d
_BString: Elaborate on the swift 5.8 dependency a bit
2023-03-20 13:12:11 -07:00
Karoy Lorentey
85a43d9ac6
_BString: Add a substring types and actual collection views
...
This is more of a technical workaround, as it allows
running generic algorithms on these things. That said,
we could embrace this in general, and sink the
`utf8Index(after:)`, `characterIndex(before:)` etc
function down into these views, instead of having them
on the top level.
2023-03-20 13:12:11 -07:00
Karoy Lorentey
fe54fdaa47
More fixes.
2023-03-20 13:12:10 -07:00
Karoy Lorentey
605e45b9b9
_BString: Additional fixes and new functionality
...
- New methods for rounding up indices
- Sendable conformances
- Fix UTF-16 strings sometimes leaking into chunks
- Iterator improvements / rewrites, incl. a chunked UTF-8
buffer iterator.
- Support for comparing and hashing UTF-8 slices.
2023-03-20 13:12:10 -07:00
Karoy Lorentey
9bbdfdc497
Cosmetic updates to _BString.CharacterIterator
2023-03-20 13:12:10 -07:00
Karoy Lorentey
79bdcb66eb
Implement path caching in indices
2023-03-20 13:12:10 -07:00
Karoy Lorentey
575937f6ff
Remove _Rope._leaf(at:)
2023-03-20 13:12:09 -07:00
Karoy Lorentey
b6f9d83c60
Replace Rope iterator with indices in most index-like use cases
2023-03-20 13:12:09 -07:00
Karoy Lorentey
3cc5a3888a
_Rope: Add a leaf node reference to indices. Implement explicit index invalidation
2023-03-20 13:12:09 -07:00