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\) 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.)
jrose
(Jordan Rose)
2
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\) 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
Done. [SR-1261] Swift incorrectly identifies passing a tuple to a function as a tuple splat · Issue #43869 · apple/swift · GitHub
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@swift.org> wrote:
Sure
On Apr 18, 2016, at 4:25 PM, Jordan Rose <jordan_rose@apple.com <mailto:jordan_rose@apple.com>> wrote:
Good catch. Seems like an issue with the diagnostic. Can you file a bug at bugs.swift.org <Issues · apple/swift · GitHub?
Jordan
On Apr 18, 2016, at 13:45, David Sweeris via swift-dev <swift-dev@swift.org <mailto: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\) 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 <mailto: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
Austin
(Austin Zheng)
5
Nothing much happens, except other people who see the ticket will know someone else is working on it and not start on it themselves. You can always release the ticket if you decide you can't or don't want to work on it anymore.
Austin
···
On Apr 18, 2016, at 3:53 PM, David Sweeris via swift-dev <swift-dev@swift.org> wrote:
Done. [SR-1261] Swift incorrectly identifies passing a tuple to a function as a tuple splat · Issue #43869 · apple/swift · GitHub
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@swift.org <mailto:swift-dev@swift.org>> wrote:
Sure
On Apr 18, 2016, at 4:25 PM, Jordan Rose <jordan_rose@apple.com <mailto:jordan_rose@apple.com>> wrote:
Good catch. Seems like an issue with the diagnostic. Can you file a bug at bugs.swift.org <Issues · apple/swift · GitHub?
Jordan
On Apr 18, 2016, at 13:45, David Sweeris via swift-dev <swift-dev@swift.org <mailto: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\) 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 <mailto:swift-dev@swift.org>
https://lists.swift.org/mailman/listinfo/swift-dev
_______________________________________________
swift-dev mailing list
swift-dev@swift.org <mailto: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
Oh, ok, thanks. I’ll be sure to *not* click on it until I figure out how LLVM works! :-D
- Dave Sweeris
···
On Apr 18, 2016, at 5:55 PM, Austin Zheng <austinzheng@gmail.com> wrote:
Nothing much happens, except other people who see the ticket will know someone else is working on it and not start on it themselves. You can always release the ticket if you decide you can't or don't want to work on it anymore.
Austin
On Apr 18, 2016, at 3:53 PM, David Sweeris via swift-dev <swift-dev@swift.org <mailto:swift-dev@swift.org>> wrote:
Done. [SR-1261] Swift incorrectly identifies passing a tuple to a function as a tuple splat · Issue #43869 · apple/swift · GitHub
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@swift.org <mailto:swift-dev@swift.org>> wrote:
Sure
On Apr 18, 2016, at 4:25 PM, Jordan Rose <jordan_rose@apple.com <mailto:jordan_rose@apple.com>> wrote:
Good catch. Seems like an issue with the diagnostic. Can you file a bug at bugs.swift.org <Issues · apple/swift · GitHub?
Jordan
On Apr 18, 2016, at 13:45, David Sweeris via swift-dev <swift-dev@swift.org <mailto: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\) 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 <mailto:swift-dev@swift.org>
https://lists.swift.org/mailman/listinfo/swift-dev
_______________________________________________
swift-dev mailing list
swift-dev@swift.org <mailto:swift-dev@swift.org>
https://lists.swift.org/mailman/listinfo/swift-dev
_______________________________________________
swift-dev mailing list
swift-dev@swift.org <mailto:swift-dev@swift.org>
https://lists.swift.org/mailman/listinfo/swift-dev