[SR-8951] Adding an init with matching type of another init should error with ambiguous reference #51456
Labels
bug
A deviation from expected or documented behavior. Also: expected but undesirable behavior.
compiler
The Swift compiler in itself
regression
swift 4.0
Environment
macOS 10.13.6
Swift 4.2
Xcode 10.0 (10A255)
Additional Detail from JIRA
md5: d8d439d344924ff347951eb1e0ab863e
Issue Description:
I went to add an extension to
RangeReplaceableCollection
today, and some tests started failing because someString
s in our codebase started behaving funny. It turns out that aflatMap
picked a differentinit
without warning, which changed behavior and failed our tests.Consider the following code:
As is, this code prints |100|, but if you un-comment the extension, it prints ||. I would expect uncommenting the extension to cause a compiler error because that would make
String.init
ambiguous.The text was updated successfully, but these errors were encountered: