Good catch. Seems like an issue with the diagnostic. Can you file a bug at 
bugs.swift.org?

Jordan

> On Apr 18, 2016, at 13:45, David Sweeris via swift-dev <swift-dev@swift.org> 
> wrote:
> 
> I was updating some old code to Swift 2.2, and came across an unexpected 
> tuple splat warning. This code is all you need to generate the deprecation 
> warning:
> public class Value<T> {
>     public typealias Element = T
>     public typealias Ret = T
> }
> public class Expression<A, R> : Value<R> {
>     public typealias Arg = A
>     public var args: Arg! = nil
>     public subscript(arg: Arg) -> Value<Ret> { return self }
> }
> public class Op<A, R> : Expression<A, R> {
>     public typealias OpType = Arg -> Value<R>
>     public let op: OpType
>     init(op: OpType) {
>         self.op = op
>         super.init()
>     }
> }
> public class BinaryOp<A1, A2, R> : Op<(A1, A2), R> {
>     override init(op: OpType) {
>         super.init(op: op)
>     }
>     override public subscript(x: Arg) -> Value<Ret> {
>         return op(x) //Warning: Passing 2 arguments to a callee as a single 
> tuple value is deprecated
>     }
> }
> 
> I don’t understand why the compiler thinks I’m trying to splat the tuple… 
> `op` takes one argument of type `Arg` and I’m giving it one argument of type 
> `Arg`. In the case of a `BinaryOp`, `Arg` does happen to be a tuple, but the 
> proposal 
> (https://github.com/apple/swift-evolution/blob/master/proposals/0029-remove-implicit-tuple-splat.md
>  
> <https://github.com/apple/swift-evolution/blob/master/proposals/0029-remove-implicit-tuple-splat.md>)
>  specifically says "it does not propose removing the ability to pass tuples 
> as values to functions”.
> 
> Am I missing something, or have I found a bug in Swift 2.2?
> 
> - Dave Sweeris
> 
> (PS, Sorry if this is the wrong list… I’m not sure where potential bug 
> reports go.)
> _______________________________________________
> swift-dev mailing list
> swift-dev@swift.org
> https://lists.swift.org/mailman/listinfo/swift-dev

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

Reply via email to