[swift-dev] Swift 2.2 regression bug: Using generic parameter as a generic argument in the same clause

Joe Pamer jpamer at apple.com
Wed Feb 10 11:20:33 CST 2016


Hi Alex,

I’m pretty sure Joe Groff pushed a fix for this yesterday (it landed in swift-2.2-branch with 9e9537 and master as c165811). I’ll double-check.

Thanks!
- Joe

> On Feb 9, 2016, at 11:56 PM, Alex Hoppen via swift-dev <swift-dev at swift.org> wrote:
> 
> Hi everyone,
> 
> I just found a major regression bug in Swift 2.2 (it’s tracked under SR-706 <https://bugs.swift.org/browse/SR-706>). Since Swift 2.2 development seems to come to an end I wanted to raise some attention for this bug by posting it here as well.
> 
> - Alex
> 
> 
> 
> When using the generic argument of a function as a parameter of another generic class that is used in the signature, the compiler crashes with Illegal instruction: 4
>  <>Example
> class GenericClass<T> { }
> 
> protocol MyProtocol { }
> 
> class MyClass {
>   func myFunction<T, O: GenericClass<T> where T: MyProtocol>(myArg: O) -> T {
>     fatalError()
>   }
> }
>  <>Interesting crash facts
> This used to work with Swift 2.1
> This works with the version of Swift that is shipped with Xcode 7.3 beta 2 (7D129n)
> It crashes the Swift 2.2 and Swift 3 compiler since the snapshot of 01/11/2016 (that’s the oldest snapshot I have installed)
> The code compiles fine with the current master (as of 02/10/2016, commit 073df63) iff myFunction is a global function and not a method in a class
> _______________________________________________
> swift-dev mailing list
> swift-dev at swift.org
> https://lists.swift.org/mailman/listinfo/swift-dev

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-dev/attachments/20160210/e71f7ef0/attachment.html>


More information about the swift-dev mailing list