Files
swift-mirror/test/Constraints/rdar107724970.swift
Pavel Yaskevich 10c794e568 [CSDiagnostics] Produce a diagnostic for patterns with extraneous elements
Extend `ExtraneousArgumentsFailure` to handle enum element
pattern mismatches.

Resolves: rdar://123466496
2024-02-26 14:30:29 -08:00

17 lines
342 B
Swift
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
// RUN: %target-typecheck-verify-swift
// rdar://107724970 Make sure we don't crash.
enum E {
case e(Int)
}
func foo(_ x: E) {
// https://github.com/apple/swift/issues/65062
let fn = {
switch x {
case E.e(_, _):
// expected-error@-1 {{tuple pattern has the wrong length for tuple type 'Int'}}
break
}
}
}