Files
swift-mirror/test/Constraints/rdar105782480.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

20 lines
418 B
Swift

// RUN: %target-typecheck-verify-swift
// rdar://105782480
enum MyEnum {
case second(Int?)
}
func takeClosure(_ x: () -> Void) {}
func foo(value: MyEnum) {
takeClosure {
switch value {
case .second(let drag).invalid:
// expected-error@-1 {{value of type 'MyEnum' has no member 'invalid'}}
// expected-error@-2 {{'let' binding pattern cannot appear in an expression}}
break
}
}
}