@@ -36,21 +36,25 @@ extension LazyMapCollection where Base : TestProtocol1, Element : TestProtocol1
36
36
// CHECK: testing...
37
37
print ( " testing... " )
38
38
39
- // Test mapping a collection
40
- // CHECK-NEXT: [6, 9, 12, 15, 18, 21]
41
- let a = Array ( ( 2 ..< 8 ) . lazy. map { $0 * 3 } )
42
- print ( a)
43
-
44
- // Test mapping a sequence
45
- let s = a. makeIterator ( ) . lazy. map { $0 / 3 }
46
- // CHECK-NEXT: <2, 3, 4, 5, 6, 7>
47
- print ( " < " , terminator: " " )
48
- var prefix = " "
49
- for x in s {
50
- print ( " \( prefix) \( x) " , terminator: " " )
51
- prefix = " , "
39
+ do {
40
+ // Test mapping a collection
41
+ // CHECK-NEXT: [6, 9, 12, 15, 18, 21]
42
+ let lazyRange = ( 2 ..< 8 ) . lazy
43
+ let a = Array ( lazyRange. map { $0 * 3 } )
44
+ print ( a)
45
+
46
+ // Test mapping a sequence
47
+ let lazySeq = a. makeIterator ( ) . lazy
48
+ let s = lazySeq. map { $0 / 3 }
49
+ // CHECK-NEXT: <2, 3, 4, 5, 6, 7>
50
+ print ( " < " , terminator: " " )
51
+ var prefix = " "
52
+ for x in s {
53
+ print ( " \( prefix) \( x) " , terminator: " " )
54
+ prefix = " , "
55
+ }
56
+ print ( " > " )
52
57
}
53
- print ( " > " )
54
58
55
59
//===--- Avoid creating gratuitously self-destructive sequences -----------===//
56
60
0 commit comments