mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
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
20 lines
418 B
Swift
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
|
|
}
|
|
}
|
|
}
|