Are typealiases within protocols supposed to be visible from conforming types?


(Karl) #1

Straightforward question - Are typealiases within protocols supposed to be visible from conforming types?

For example:

protocol MyProto {
  
  typealias ComplexFunctionType = (_ paramOne: (Int, Bool?), _ paramTwo: (Bool, String?, String)) throws -> (Array<Int>, Float)?

  func doSomething(callback: ComplexFunctionType)
}

struct Conformist : MyProto {
  
  // do I really have to write that whole thing out again?
  // or copy-paste and sync changes for all conforming types?
}

Currently they are not visible from the conforming type (so you would need to duplicate the definition of ComplexFunctionType), but I’m not sure if that's a bug or feature.

Karl