I'd definitely consider that a bug. Can you file it at bugs.swift.org?

Jordan

> On Jul 4, 2016, at 14:56, Neil Faiman via swift-users <swift-users@swift.org> 
> wrote:
> 
> (Resending — this didn’t get any responses when I sent it a month ago.)
> 
> Swift 2.2 in Xcode 7.3.1.
> 
> Apparently you cannot use a named tuple constant as an expression pattern in 
> a case label.
> 
> func test(x: Int, y: Int) -> Int {
>   let int_1 = 1
>   switch x {
>   case 0:
>       return 0
>   case int_1:
>       return 1
>   default:
>       break
>   }
> 
>   let int_1_1: (Int, Int) = (1, 1)
>   switch (x, y) {
>   case (0, 0):
>       return 0
>   case int_1_1:       // <<<<
>       return 1
>   default:
>       return -1
>   }
> }
> 
> error: expression pattern of type '(Int, Int)' cannot match values of type 
> '(Int, Int)'
>   case int_1_1:
>        ^~~~~~~
> 
> The error message is particularly amusing.
> 
>       - Neil Faiman
> _______________________________________________
> swift-users mailing list
> swift-users@swift.org
> https://lists.swift.org/mailman/listinfo/swift-users

_______________________________________________
swift-users mailing list
swift-users@swift.org
https://lists.swift.org/mailman/listinfo/swift-users

Reply via email to