Segfault when Associated Type conforms to a protocol

可紊 提交于 2019-12-24 13:16:16

问题


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>()
  }
}

来源:https://stackoverflow.com/questions/27044535/segfault-when-associated-type-conforms-to-a-protocol

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!