Segfault when Associated Type conforms to a protocol

306 views Asked by At

I have a problem with Swift compiler segfaulting when trying to compile the code below.

I've already posted a bug report on this, but wonder if:
1) I'm doing anything inherently wrong
2) there is a 'workaround' I could use to achieve a similar result. I suppose not, but I'd appreciate any ideas you might have

class Foo<T, U: AnyObject> {

}

protocol Bar {
  typealias T: AnyObject // <- that appears to be the problem
  func foo() -> Foo<Self, T>
}

extension String: Bar {
  func foo() -> Foo<String, NSString> {
    return Foo<String, NSString>()
  }
}
0

There are 0 answers