Literal initialization via coercion does not work on array literals

From SE-0213 it seems like T(literal) should call into the corresponding literal initializer for any literal (integer, float, boolean, string, and array), but it's currently not the case for array literals. Is this a bug?

protocol P {}
extension Int: P {}

struct Foo: ExpressibleByArrayLiteral {
    init(arrayLiteral: Int...) {
        print("init(arrayLiteral:) is called")
    }

    init<T: P>(_: [T]) {
        print("init(_:) is called")
    }
}

_ = Foo([1, 2])

Actual result:

init(_:) is called

Expected result:

init(arrayLiteral:) is called
3 Likes

I observe the same thing for dictionary literals as well.

Sure seems like a bug to me!