[swift-users] Element vs. Iterator.Element

Toni Suter tonisuter at me.com
Tue Nov 1 08:34:10 CDT 2016


Ok, I have filed a bug: https://bugs.swift.org/browse/SR-3102 <https://bugs.swift.org/browse/SR-3102>

Best regards,
Toni

> Am 31.10.2016 um 19:32 schrieb Dave Abrahams via swift-users <swift-users at swift.org>:
> 
> 
> on Mon Oct 31 2016, Toni Suter <swift-users-AT-swift.org <http://swift-users-at-swift.org/>> wrote:
> 
>> Hi,
>> 
>> This extension on Array works as expected:
>> 
>> extension Array where Element: CustomStringConvertible {
>>    func f(_ x: Element) -> String {
>>        return x.description
>>    }
>> }
>> 
>> But when I use Iterator.Element instead, I get an error message (error: value of type 'Element' has
>> no member 'description'):
>> 
>> extension Array where Iterator.Element: CustomStringConvertible {
>>    func f(_ x: Iterator.Element) -> String {
>>        return x.description
>>    }
>> }
>> 
>> I assume this is a type checker bug, but before I report it, I wanted to make sure that that’s
>> really the case. Or is there a difference between Element and
>> Iterator.Element?
> 
> There shouldn't be.  It's a bug, IMO.
> 
> -- 
> -Dave
> 
> _______________________________________________
> swift-users mailing list
> swift-users at swift.org <mailto:swift-users at swift.org>
> https://lists.swift.org/mailman/listinfo/swift-users <https://lists.swift.org/mailman/listinfo/swift-users>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-users/attachments/20161101/e0545f58/attachment.html>


More information about the swift-users mailing list