mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
This changed to be resolved by overload resolution in Swift 4, and so can suddenly be shadowed by similarly named properties and functions that are visible at the expression's location. When in Swift 3 mode, if there is a visible declaration named "type", add the `Swift.` prefix to disambiguate in Swift 4 mode. rdar://problem/31997321
42 lines
1.1 KiB
Plaintext
42 lines
1.1 KiB
Plaintext
// rdar://problem/32025974
|
|
// XFAIL: linux
|
|
|
|
// RUN: %target-swift-frontend -typecheck %s -swift-version 3
|
|
// RUN: %target-swift-frontend -typecheck -update-code -primary-file %s -emit-migrated-file-path %t.result -disable-migrator-fixits -swift-version 3
|
|
// RUN: diff -u %s.expected %t.result
|
|
// RUN: %target-swift-frontend -typecheck %s.expected -swift-version 4
|
|
|
|
func test1(_: ()) {}
|
|
test1(())
|
|
test1(())
|
|
func test2() {}
|
|
test2()
|
|
|
|
enum Result<T> {
|
|
case success(T)
|
|
}
|
|
func test3(_: Result<()>) {}
|
|
test3(.success(()))
|
|
|
|
func test4(_: (Int, Int) -> ()) {}
|
|
test4({ (x,y) in })
|
|
func test5(_: (Int, Int, Int) -> ()) {}
|
|
test5({ (x,y,z) in })
|
|
|
|
func test6(_: ((Int, Int)) -> ()) {}
|
|
test6({ let (x,y) = $0; })
|
|
func test7(_: ((Int, Int, Int)) -> ()) {}
|
|
test7({ let (x,y,z) = $0; })
|
|
test6({ let (x, y) = $0; })
|
|
test6({ let (_, _) = $0; })
|
|
test6({ (__val:(Int, Int)) in let (x,y) = __val; })
|
|
test6({ (__val:(Int, Int)) ->() in let (_,_) = __val; })
|
|
|
|
func toString(indexes: Int?...) -> String {
|
|
let _ = indexes.enumerated().flatMap({ (__val:(Int, Int?)) -> String? in let (i,index) = __val;
|
|
let _: Int = i
|
|
if index != nil {}
|
|
return ""
|
|
})
|
|
}
|