Skip to content

Commit 87db7b4

Browse files
committed
update validation tests to modern syntax.
1 parent 06d0959 commit 87db7b4

File tree

10 files changed

+28
-28
lines changed

10 files changed

+28
-28
lines changed

validation-test/Evolution/Inputs/function_change_transparent_body.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ public func getVersion() -> Int {
1515
#endif
1616
}
1717

18-
public func getFunction(_ x: Int) -> Int -> Int {
18+
public func getFunction(_ x: Int) -> (Int) -> Int {
1919
// Force a re-abstraction thunk for (T -> T) => (Int -> Int) to be
2020
// emitted from a non-transparent context first
2121

@@ -28,7 +28,7 @@ public func getFunction(_ x: Int) -> Int -> Int {
2828
return id
2929
}
3030

31-
@_transparent public func getTransparentFunction(_ x: Int) -> Int -> Int {
31+
@_transparent public func getTransparentFunction(_ x: Int) -> (Int) -> Int {
3232
// The mangled name and calling convention of the local function
3333
// will change -- so we must serialize it and inline it into
3434
// the calling module

validation-test/compiler_crashers_2_fixed/0013-rdar19519590.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ protocol SourceTargetTransformable {
55
associatedtype Target
66

77
// FIXME: should really be a typealias once we support that
8-
associatedtype Transformer = Source -> Target
8+
associatedtype Transformer = (Source) -> Target
99
}
1010

1111

@@ -32,7 +32,7 @@ struct PiecewiseTransformedIteratorOf<
3232
if let source: Transformable.Source = source {
3333
let transformer: Transformable.Transformer? = transformerIterator.next()
3434
if let transformer: Transformable.Transformer = transformer {
35-
let tfunc: (Source -> Target)? = transformer as? (Source -> Target)
35+
let tfunc: ((Source) -> Target)? = transformer as? ((Source) -> Target)
3636
if let tfunc = tfunc {
3737
return tfunc(source)
3838
}

validation-test/compiler_crashers_2_fixed/0022-rdar21625478.swift

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20,19 +20,19 @@ public protocol MySequence {
2020
var underestimatedCount: Int { get }
2121

2222
func map<T>(
23-
@noescape _ transform: (Iterator.Element) -> T
23+
_ transform: @noescape (Iterator.Element) -> T
2424
) -> [T]
2525

2626
func filter(
27-
@noescape _ includeElement: (Iterator.Element) -> Bool
27+
_ includeElement: @noescape (Iterator.Element) -> Bool
2828
) -> [Iterator.Element]
2929

3030
func _customContainsEquatableElement(
3131
_ element: Iterator.Element
3232
) -> Bool?
3333

3434
func _preprocessingPass<R>(
35-
@noescape _ preprocess: (Self) -> R
35+
_ preprocess: @noescape (Self) -> R
3636
) -> R?
3737

3838
func _copyToNativeArrayBuffer()
@@ -48,13 +48,13 @@ extension MySequence {
4848
}
4949

5050
public func map<T>(
51-
@noescape _ transform: (Iterator.Element) -> T
51+
_ transform: @noescape (Iterator.Element) -> T
5252
) -> [T] {
5353
return []
5454
}
5555

5656
public func filter(
57-
@noescape _ includeElement: (Iterator.Element) -> Bool
57+
_ includeElement: @noescape (Iterator.Element) -> Bool
5858
) -> [Iterator.Element] {
5959
return []
6060
}
@@ -66,7 +66,7 @@ extension MySequence {
6666
}
6767

6868
public func _preprocessingPass<R>(
69-
@noescape _ preprocess: (Self) -> R
69+
_ preprocess: @noescape (Self) -> R
7070
) -> R? {
7171
return nil
7272
}
@@ -111,7 +111,7 @@ extension MyCollection {
111111
return startIndex == endIndex
112112
}
113113
public func _preprocessingPass<R>(
114-
@noescape _ preprocess: (Self) -> R
114+
_ preprocess: @noescape (Self) -> R
115115
) -> R? {
116116
return preprocess(self)
117117
}
@@ -249,14 +249,14 @@ extension LoggingSequenceType
249249
}
250250

251251
public func map<T>(
252-
@noescape _ transform: (Base.Iterator.Element) -> T
252+
_ transform: @noescape (Base.Iterator.Element) -> T
253253
) -> [T] {
254254
Log.map[selfType] += 1
255255
return base.map(transform)
256256
}
257257

258258
public func filter(
259-
@noescape _ includeElement: (Base.Iterator.Element) -> Bool
259+
_ includeElement: @noescape (Base.Iterator.Element) -> Bool
260260
) -> [Base.Iterator.Element] {
261261
Log.filter[selfType] += 1
262262
return base.filter(includeElement)
@@ -273,7 +273,7 @@ extension LoggingSequenceType
273273
/// `preprocess` on `self` and return its result. Otherwise, return
274274
/// `nil`.
275275
public func _preprocessingPass<R>(
276-
@noescape _ preprocess: (Self) -> R
276+
_ preprocess: @noescape (Self) -> R
277277
) -> R? {
278278
Log._preprocessingPass[selfType] += 1
279279
return base._preprocessingPass { _ in preprocess(self) }
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// RUN: %target-swift-frontend %s -emit-silgen
22

33
func a() {
4-
func f(x: Void -> Any) { }
4+
func f(x: (Void) -> Any) { }
55
var g = { 3 }
66
f { g }
77
}

validation-test/compiler_crashers_fixed/00012-emitdirecttypemetadataref.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
// http://www.openradar.me/17822208
1313
// https://twitter.com/rob_rix/status/493199478879682561
1414

15-
func a<T>() -> (T, T -> T) -> T {
16-
var b: ((T, T -> T) -> T)!
15+
func a<T>() -> (T, (T) -> T) -> T {
16+
var b: ((T, (T) -> T) -> T)!
1717
return b
1818
}

validation-test/stdlib/Arrays.swift.gyb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,7 @@ ArrayTestSuite.test("${array_type}/map") {
306306
}
307307

308308
ArrayTestSuite.test("${array_type}/flatMap") {
309-
let enumerate : Int -> ${array_type}<Int> =
309+
let enumerate : (Int) -> ${array_type}<Int> =
310310
{ return ${array_type}(1..<($0 + 1)) }
311311
expectEqualSequence([], ${array_type}().flatMap(enumerate))
312312
expectEqualSequence([ 1 ], ${array_type}([ 1 ]).flatMap(enumerate))

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ CollectionTests.test("LazyFilterCollection instances (${traversal}${kind})") {
9696
% end
9797
}
9898
do {
99-
let predicate: Int -> Bool = { $0 % 3 == 0 || $0 % 5 == 0 }
99+
let predicate: (Int) -> Bool = { $0 % 3 == 0 || $0 % 5 == 0 }
100100

101101
let base = randArray(500)
102102
var expected : [Int] = []

validation-test/stdlib/FixedPointArithmeticTraps.swift.gyb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import StdlibUnittest
1818
func expectOverflow<T>(
1919
_ res: (T, overflow: Bool),
2020
//===--- TRACE boilerplate ----------------------------------------------===//
21-
@autoclosure _ message: () -> String = "",
21+
_ message: @autoclosure () -> String = "",
2222
showFrame: Bool = true,
2323
stackTrace: SourceLocStack = SourceLocStack(),
2424
file: String = #file, line: UInt = #line
@@ -31,7 +31,7 @@ func expectOverflow<T>(
3131
func expectNoOverflow<T>(
3232
_ res: (T, overflow: Bool),
3333
//===--- TRACE boilerplate ----------------------------------------------===//
34-
@autoclosure _ message: () -> String = "",
34+
_ message: @autoclosure () -> String = "",
3535
showFrame: Bool = true,
3636
stackTrace: SourceLocStack = SourceLocStack(),
3737
file: String = #file, line: UInt = #line

validation-test/stdlib/SequenceType.swift.gyb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -770,7 +770,7 @@ struct MinimalSequenceWith${Implementation}Map<Element> : Sequence {
770770
}
771771

772772
func map<T>(
773-
@noescape _ transform: (Element) throws -> T
773+
_ transform: @noescape (Element) throws -> T
774774
) rethrows -> [T] {
775775
MinimalSequenceWithCustomMap.timesMapWasCalled += 1
776776
return try _data.map(transform)
@@ -783,7 +783,7 @@ struct MinimalSequenceWith${Implementation}Map<Element> : Sequence {
783783

784784
func callStaticSequenceMap<T>(
785785
_ sequence: MinimalSequenceWithDefaultMap<OpaqueValue<Int>>,
786-
@noescape transform: (OpaqueValue<Int>) -> T
786+
transform: @noescape (OpaqueValue<Int>) -> T
787787
) -> [T] {
788788
var result = sequence.map(transform)
789789
expectType([T].self, &result)
@@ -792,7 +792,7 @@ func callStaticSequenceMap<T>(
792792

793793
func callStaticSequenceMap<T>(
794794
_ sequence: MinimalSequenceWithCustomMap<OpaqueValue<Int>>,
795-
@noescape transform: (OpaqueValue<Int>) -> T
795+
transform: @noescape (OpaqueValue<Int>) -> T
796796
) -> [T] {
797797
var result = sequence.map(transform)
798798
expectType([T].self, &result)
@@ -801,7 +801,7 @@ func callStaticSequenceMap<T>(
801801

802802
func callGenericSequenceMap<S : Sequence, T>(
803803
_ sequence: S,
804-
@noescape transform: (S.Iterator.Element) -> T
804+
transform: @noescape (S.Iterator.Element) -> T
805805
) -> [T] {
806806
var result = sequence.map(transform)
807807
expectType([T].self, &result)

validation-test/stdlib/SequenceWrapperTest.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,11 @@ let indirect = LoggingSequence(wrapping: direct)
2929
let dispatchLog = base.log
3030

3131
func expectWrapperDispatch<R1, R2>(
32-
@autoclosure _ directOperation: () -> R1,
33-
@autoclosure _ indirectOperation: () -> R2,
32+
_ directOperation: @autoclosure () -> R1,
33+
_ indirectOperation: @autoclosure () -> R2,
3434
_ counters: TypeIndexed<Int>,
3535
//===--- TRACE boilerplate ----------------------------------------------===//
36-
@autoclosure _ message: () -> String = "",
36+
_ message: @autoclosure () -> String = "",
3737
showFrame: Bool = true,
3838
stackTrace: SourceLocStack = SourceLocStack(),
3939
file: String = #file, line: UInt = #line

0 commit comments

Comments
 (0)