Swift StringLiteralConvertible Doesn't Work With Interpolated String Literal

Originator:DaNmarner
Number:rdar://21607799 Date Originated:6/30/2015
Status:Open Resolved:
Product:Swift Product Version:
Classification: Reproducible:Always
 
Summary:
If a string literal includes interpolated value, then it's not getting automatically converted to types conforming to StringLiteralConvertible.

Steps to Reproduce:
Try to compile the following code in Xcode 7 beta 2

struct SomeT: StringLiteralConvertible {
    typealias ExtendedGraphemeClusterLiteralType = String
    typealias UnicodeScalarLiteralType = String
    var value: String
    init(unicodeScalarLiteral value: UnicodeScalarLiteralType) {
        self.value = "\(value)"
    }

    init(extendedGraphemeClusterLiteral value: ExtendedGraphemeClusterLiteralType) {
        self.value = value
    }

    init(stringLiteral value: StringLiteralType) {
        self.value = value
    }
}
func g() -> SomeT { return "\(1)" }

Expected Results:
This code should compile.

Actual Results:
It does not.

Version:
Xcode Version 7.0 beta (7A121l)

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!