Files
swift-mirror/test/Constraints/issue-66553.swift
Hamish Knight c6dd3ad839 [CS] Diagnose UnresolvedPatternExprs as part of constraint solving
Instead of diagnosing in CSApply, let's create a
fix and diagnose in the solver instead.
Additionally, make sure we assign ErrorTypes to
any VarDecls bound by the invalid pattern, which
fixes a crash.

rdar://110638279
2023-06-13 12:14:25 +01:00

13 lines
258 B
Swift

// RUN: %target-typecheck-verify-swift
// https://github.com/apple/swift/issues/66553
func baz(y: [Int], z: Int) -> Int {
switch z {
case y[let z]: // expected-error {{'let' binding pattern cannot appear in an expression}}
z
default:
z
}
}