Files
swift-mirror/test/Constraints/closures_swift3.swift
Pavel Yaskevich d5fb892515 [ConstraintSolver] NFC: Cleanup dead-code related to contraction of subtype constraints in matchTypes
Since we no longer allow constraction of subtype constraints, workaround
which exists in `matchTypes`, for situations where left-hand side of such
constraint is going to be wrapped in `inout` type, is no longer required.

Resolves: rdar://problem/34137342, rdar://problem/34136625
2017-09-13 15:43:50 -07:00

21 lines
618 B
Swift

// RUN: %target-typecheck-verify-swift -swift-version 3
var _: () -> Int = {a in 0}
var _: (Int, Int) -> Int = {a in 0}
// <rdar://problem/20371273> Type errors inside anonymous functions don't provide enough information
func f20371273() {
let x: [Int] = [1, 2, 3, 4]
let y: UInt = 4
_ = x.filter { ($0 + y) > 42 } // expected-warning {{deprecated}}
}
// rdar://problem/32432145 - compiler should emit fixit to remove "_ in" in closures if 0 parameters is expected
func r32432145(_ a: () -> ()) {}
r32432145 { _ in let _ = 42 } // Ok in Swift 3
r32432145 { _ in // Ok in Swift 3
print("answer is 42")
}