Skip to content

Commit 9e73d09

Browse files
author
Max Moiseev
committed
Fix tests
(cherry picked from commit a1b1778)
1 parent 1f78f39 commit 9e73d09

File tree

4 files changed

+19
-22
lines changed

4 files changed

+19
-22
lines changed

stdlib/public/core/Map.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,8 @@ public struct LazyMapIterator<
4545
}
4646
}
4747

48-
/// A `Sequence` whose elements consist of those in a `Base` /// `Sequence` passed through a transform function returning `Element`.
48+
/// A `Sequence` whose elements consist of those in a `Base`
49+
/// `Sequence` passed through a transform function returning `Element`.
4950
/// These elements are computed lazily, each time they're read, by
5051
/// calling the transform function on a base element.
5152
@_fixed_layout

stdlib/public/core/Reverse.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,7 @@ extension LazyCollectionProtocol
312312
///
313313
/// - Complexity: O(1)
314314
@_inlineable
315-
public func reversed() -> LazyCollection<
315+
public func reversed() -> LazyBidirectionalCollection<
316316
ReversedCollection<Elements>
317317
> {
318318
return ReversedCollection(_base: elements).lazy

validation-test/stdlib/Collection/LazyFilterCollection.swift.gyb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,12 @@ variations = [('', 'Sequence'), ('', 'Collection'), ('Bidirectional', 'Collectio
1515
// Test collections using value types as elements.
1616
% for (traversal, kind) in variations:
1717
CollectionTests.add${traversal}${kind}Tests(
18-
make${kind}: { (elements: [OpaqueValue<Int>]) -> LazyFilter${traversal}${kind}<Minimal${traversal}${kind}<OpaqueValue<Int>>> in
18+
make${kind}: { (elements: [OpaqueValue<Int>]) -> LazyFilter${kind}<Minimal${traversal}${kind}<OpaqueValue<Int>>> in
1919
Minimal${traversal}${kind}(elements: elements).lazy.filter { _ in return true }
2020
},
2121
wrapValue: identity,
2222
extractValue: identity,
23-
make${kind}OfEquatable: { (elements: [MinimalEquatableValue]) -> LazyFilter${traversal}${kind}<Minimal${traversal}${kind}<MinimalEquatableValue>> in
23+
make${kind}OfEquatable: { (elements: [MinimalEquatableValue]) -> LazyFilter${kind}<Minimal${traversal}${kind}<MinimalEquatableValue>> in
2424
Minimal${traversal}${kind}(elements: elements).lazy.filter { _ in return true }
2525
},
2626
wrapValueIntoEquatable: identityEq,
@@ -31,7 +31,7 @@ CollectionTests.add${traversal}${kind}Tests(
3131
// Test collections using reference types as elements.
3232
% for (traversal, kind) in variations:
3333
CollectionTests.add${traversal}${kind}Tests(
34-
make${kind}: { (elements: [LifetimeTracked]) -> LazyFilter${traversal}${kind}<Minimal${traversal}${kind}<LifetimeTracked>> in
34+
make${kind}: { (elements: [LifetimeTracked]) -> LazyFilter${kind}<Minimal${traversal}${kind}<LifetimeTracked>> in
3535
// FIXME: create a better sequence and filter
3636
Minimal${traversal}${kind}(elements: elements).lazy.filter { _ in return true }
3737
},
@@ -41,7 +41,7 @@ CollectionTests.add${traversal}${kind}Tests(
4141
extractValue: { (element: LifetimeTracked) in
4242
OpaqueValue(element.value, identity: element.identity)
4343
},
44-
make${kind}OfEquatable: { (elements: [LifetimeTracked]) -> LazyFilter${traversal}${kind}<Minimal${traversal}${kind}<LifetimeTracked>> in
44+
make${kind}OfEquatable: { (elements: [LifetimeTracked]) -> LazyFilter${kind}<Minimal${traversal}${kind}<LifetimeTracked>> in
4545
// FIXME: create a better sequence and filter
4646
Minimal${traversal}${kind}(elements: elements).lazy.filter { _ in return true }
4747
},

validation-test/stdlib/Lazy.swift.gyb

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -507,7 +507,7 @@ LazyTestSuite.test("MapCollection<${TraversalCollection}>/underestimatedCount")
507507
OpaqueValue(Int32(input.value))
508508
}
509509
expectType(
510-
LazyMap${TraversalCollection}<
510+
LazyMapCollection<
511511
Minimal${TraversalCollection}<OpaqueValue<Int>>, OpaqueValue<Int32>
512512
>.self,
513513
&lazyMap)
@@ -810,7 +810,7 @@ tests.test("LazyMap${TraversalCollection}/Collection") {
810810
expectEqual(0, calls)
811811

812812
expectType(
813-
LazyMap${TraversalCollection}<
813+
LazyMapCollection<
814814
Minimal${TraversalCollection}<OpaqueValue<Int>>,
815815
OpaqueValue<Double>>.self,
816816
&mapped)
@@ -926,7 +926,7 @@ tests.test("lazy.mapped/TypeInference") {
926926
var mapped = MinimalBidirectionalCollection(elements: baseArray)
927927
.lazy.map { _ in OpaqueValue<Int8>(0) }
928928
expectType(
929-
LazyMapBidirectionalCollection<
929+
LazyMapCollection<
930930
MinimalBidirectionalCollection<OpaqueValue<Int>>,
931931
OpaqueValue<Int8>
932932
>.self,
@@ -960,14 +960,14 @@ tests.test("ReversedCollection") {
960960
}
961961

962962
checkBidirectionalCollection(
963-
"raboof".characters,
964-
"foobar".characters.reversed())
963+
"raboof",
964+
"foobar".reversed())
965965

966966
// Check that the reverse collection is still eager
967967
do {
968968
var calls = 0
969-
_ = "foobar".characters.reversed().map { _ in calls += 1 }
970-
expectEqual("foobar".characters.count, calls)
969+
_ = "foobar".reversed().map { _ in calls += 1 }
970+
expectEqual("foobar".count, calls)
971971
}
972972
}
973973

@@ -1002,12 +1002,8 @@ tests.test("ReversedCollection/Lazy") {
10021002
}
10031003

10041004
do {
1005-
typealias Expected = LazyBidirectionalCollection<
1006-
ReversedCollection<String.CharacterView>
1007-
>
1008-
1009-
let base = "foobar".characters.lazy.map { $0 }
1010-
typealias Base = LazyMapCollection<String.CharacterView, Character>
1005+
let base = "foobar".lazy.map { $0 }
1006+
typealias Base = LazyMapCollection<String, Character>
10111007
ExpectType<Base>.test(base)
10121008

10131009
typealias LazyReversedBase = LazyBidirectionalCollection<
@@ -1019,7 +1015,7 @@ tests.test("ReversedCollection/Lazy") {
10191015
var calls = 0
10201016
let reversedAndMapped = reversed.map { (x) -> Character in calls += 1; return x }
10211017
expectEqual(0, calls)
1022-
checkBidirectionalCollection("raboof".characters, reversedAndMapped)
1018+
checkBidirectionalCollection("raboof", reversedAndMapped)
10231019
expectNotEqual(0, calls)
10241020
}
10251021
}
@@ -1160,7 +1156,7 @@ tests.test("LazyFilterCollection/AssociatedTypes") {
11601156
collectionType: Subject.self,
11611157
iteratorType: LazyFilterIterator<Base.Iterator>.self,
11621158
subSequenceType: LazyFilterCollection<Base.SubSequence>.self,
1163-
indexType: LazyFilterIndex<Base>.self,
1159+
indexType: Base.Index.self,
11641160
indicesType: DefaultIndices<Subject>.self)
11651161
}
11661162

@@ -1171,7 +1167,7 @@ tests.test("LazyFilterBidirectionalCollection/AssociatedTypes") {
11711167
collectionType: Subject.self,
11721168
iteratorType: LazyFilterIterator<Base.Iterator>.self,
11731169
subSequenceType: LazyFilterCollection<Base.SubSequence>.self,
1174-
indexType: LazyFilterIndex<Base>.self,
1170+
indexType: Base.Index.self,
11751171
indicesType: DefaultBidirectionalIndices<Subject>.self)
11761172
}
11771173

0 commit comments

Comments
 (0)