<div dir="ltr">Could someone who knows the generics system better than I give me a pointer for my question in <a href="https://bugs.swift.org/browse/SR-1052" target="_blank">https://bugs.swift.org/browse/SR-1052</a> (support for @discardableResult attribute)?<div><br></div><div>Question:<br><br><p style="margin:0px;padding:0px;color:rgb(51,51,51);font-family:Arial,sans-serif;font-size:14px;line-height:20px;background-color:rgb(245,245,245)">I&#39;m starting to look at Part 5 (having the compiler use the new attr). What I have so far appears to be working with the exception of signatures like this:</p><p style="margin:10px 0px 0px;padding:0px;color:rgb(51,51,51);font-family:Arial,sans-serif;font-size:14px;line-height:20px;background-color:rgb(245,245,245)"><tt style="border:1px solid rgb(204,204,204);border-radius:2px;padding:1px 3px;background-image:initial;background-repeat:initial">public mutating func withMutableCharacters&lt;R&gt;(_ body: (inout CharacterView) -&gt; R) -&gt; R</tt></p><p style="margin:10px 0px 0px;padding:0px;color:rgb(51,51,51);font-family:Arial,sans-serif;font-size:14px;line-height:20px;background-color:rgb(245,245,245)">where the return type is generic.</p><p style="margin:10px 0px 0px;padding:0px;color:rgb(51,51,51);font-family:Arial,sans-serif;font-size:14px;line-height:20px;background-color:rgb(245,245,245)">For regular functions, I can skip the warning if the result type in the decl is <tt style="border:1px solid rgb(204,204,204);border-radius:2px;padding:1px 3px;background-image:initial;background-repeat:initial">Void</tt>.</p><p style="margin:10px 0px 0px;padding:0px;color:rgb(51,51,51);font-family:Arial,sans-serif;font-size:14px;line-height:20px;background-color:rgb(245,245,245)">Any ideas on how to tell if a call to a generic function like <tt style="border:1px solid rgb(204,204,204);border-radius:2px;padding:1px 3px;background-image:initial;background-repeat:initial">withMutableCharacters</tt> has a return type of <tt style="border:1px solid rgb(204,204,204);border-radius:2px;padding:1px 3px;background-image:initial;background-repeat:initial">Void</tt> in context?</p><div><br></div><div>My branch with the work for Part 5 so far is at <a href="https://github.com/tanadeau/swift/commits/sr-1052-use-attr">https://github.com/tanadeau/swift/commits/sr-1052-use-attr</a>.</div><div><br></div>-- <br><div>Trent Nadeau</div>
</div></div>