mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
This matches what we do in VarRefCollector, and is needed because we currently delay the pre-checking of patterns due to the fact that we don't resolve them until CSGen. We ought to consider changing this, but until then, adjust the logic here to ensure we properly connect an ExprPattern that references an outer var with any type variables it may involve. rdar://112264204
16 lines
237 B
Swift
16 lines
237 B
Swift
// RUN: %target-typecheck-verify-swift
|
|
|
|
// rdar://112264204: Make sure we can type-check this.
|
|
func foo(_ fn: (Int) -> Void) {}
|
|
|
|
func bar(_ x: Int) {
|
|
foo { [x] y in
|
|
switch y {
|
|
case x:
|
|
()
|
|
default:
|
|
()
|
|
}
|
|
}
|
|
}
|