Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SR-1964] String(count:, repeatedValue:) and String.append() are ambiguous without an explicit cast to Character #44573

Closed
gribozavr opened this issue Jul 1, 2016 · 2 comments
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

Comments

@gribozavr
Copy link
Collaborator

Previous ID SR-1964
Radar rdar://problem/17028332
Original Reporter @gribozavr
Type Bug
Status Closed
Resolution Done
Additional Detail from JIRA
Votes 0
Component/s Standard Library
Labels Bug, AffectsABI, swift-evolution-proposal-needed
Assignee None
Priority Medium

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.

@gribozavr
Copy link
Collaborator Author

Also affects Also String.append().

@natecook1000
Copy link
Member

This was implemented in a798852

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
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
Projects
None yet
Development

No branches or pull requests

2 participants