[swift-dev] Potential Bug in SE-0029 (Remove implicit tuple splat behavior from function applications)

davesweeris at mac.com davesweeris at mac.com
Mon Apr 18 17:53:58 CDT 2016


Done. https://bugs.swift.org/browse/SR-1261

Out of curiosity, what happens if I click “Assign to me”? I think it’d be kinda fun to try to fix the glitch, but I don’t have the faintest idea where to start.

- Dave Sweeris

> On Apr 18, 2016, at 5:31 PM, David Sweeris via swift-dev <swift-dev at swift.org> wrote:
> 
> Sure
>> On Apr 18, 2016, at 4:25 PM, Jordan Rose <jordan_rose at apple.com <mailto:jordan_rose at apple.com>> wrote:
>> 
>> Good catch. Seems like an issue with the diagnostic. Can you file a bug at bugs.swift.org <http://bugs.swift.org/>?
>> 
>> Jordan
>> 
>>> On Apr 18, 2016, at 13:45, David Sweeris via swift-dev <swift-dev at swift.org <mailto:swift-dev at 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 at swift.org <mailto:swift-dev at swift.org>
>>> https://lists.swift.org/mailman/listinfo/swift-dev <https://lists.swift.org/mailman/listinfo/swift-dev>
>> 
> 
> _______________________________________________
> swift-dev mailing list
> swift-dev at swift.org
> https://lists.swift.org/mailman/listinfo/swift-dev

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-dev/attachments/20160418/8a42d6e1/attachment.html>


More information about the swift-dev mailing list