Files
swift-mirror/test/Constraints/rdar112264204.swift
Hamish Knight 09bb346b03 [CS] Walk UnresolvedDeclRefExprs in UnresolvedVarCollector
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
2023-07-17 17:32:46 +01:00

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:
()
}
}
}