Is this a compiler bug?

Hi All,

Is this a compiler bug?

struct Box<T> {
    var value: T
    init(_ value: T) { self.value = value }
    /// Unboxing operator.
    static func >> <T>(left: Box<T>, right: inout T?) {
        right = left.value
    }
}

var u: String?
let b = Box("Test")
b >> &u // ERROR: Cannot convert value of type 'Box<String>' to expected
argument type 'Box<_>'

Am I missing something?

Thanks in advance for any help,
  -- Howard.

Yeah, looks like a bug. Do you mind filing a JIRA?

Slava

···

On Sep 4, 2017, at 8:55 PM, Howard Lovatt via swift-users <swift-users@swift.org> wrote:

Hi All,

Is this a compiler bug?

struct Box<T> {
    var value: T
    init(_ value: T) { self.value = value }
    /// Unboxing operator.
    static func >> <T>(left: Box<T>, right: inout T?) {
        right = left.value
    }
}

var u: String?
let b = Box("Test")
b >> &u // ERROR: Cannot convert value of type 'Box<String>' to expected argument type 'Box<_>'
Am I missing something?

Thanks in advance for any help,

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

Thanks for prompt reply - link is:

  -- Howard.

···

On 5 September 2017 at 11:58, Slava Pestov <spestov@apple.com> wrote:

Yeah, looks like a bug. Do you mind filing a JIRA?

Slava

On Sep 4, 2017, at 8:55 PM, Howard Lovatt via swift-users < > swift-users@swift.org> wrote:

Hi All,

Is this a compiler bug?

struct Box<T> {
    var value: T
    init(_ value: T) { self.value = value }
    /// Unboxing operator.
    static func >> <T>(left: Box<T>, right: inout T?) {
        right = left.value
    }
}

var u: String?
let b = Box("Test")
b >> &u // ERROR: Cannot convert value of type 'Box<String>' to expected
argument type 'Box<_>'

Am I missing something?

Thanks in advance for any help,
  -- Howard.
_______________________________________________
swift-users mailing list
swift-users@swift.org
https://lists.swift.org/mailman/listinfo/swift-users