[SR-1964] String(count:, repeatedValue:) and String.append() are ambiguous without an explicit cast to Character #44573
Labels
affects ABI
Flag: Affects ABI
bug
A deviation from expected or documented behavior. Also: expected but undesirable behavior.
standard library
Area: Standard library umbrella
swift evolution proposal needed
Flag → feature: A feature that warrants a Swift evolution proposal
Additional Detail from JIRA
md5: b4799e02c04aec2ddff12f01bc8cb278
Issue Description:
Trying to call this:
var string = String(count: 5, repeatedValue: "a")
results in this error:
<REPL>:1:14: error: could not find an overload for 'init' that accepts the supplied arguments
If I provide an explicit cast to Character for the repeatedValue: value, it works:
var string = String(count: 5, repeatedValue: "a" as Character)
A possible solution is to add “init(count:Int, repeatedValue s: String)” and remove existing API for UnicodeScalar and Character. This would be more powerful anyway.
NOTE: Requires a swift-evolution proposal.
The text was updated successfully, but these errors were encountered: