2016-04-05 3 views
0

私は以下の3つのプロトコルを持っています。プロトコルの関連付けられたタイプを別の同型タイプに制限する

protocol OperationProtocol { 
    associatedtype Parameter1 
    associatedtype Parameter2 
} 

protocol Protocol1 { 
    associatedtype Type1 
} 

protocol Protocol2: Protocol1 { 
    associatedtype Operation: OperationProtocol 
} 

さて、Protocol2宣言で、私はOperation.Parameter1を制約したい= Type1の

私は、次のようにwhere句をやってみましたが、私は失敗しました。私は質問を投稿:) をここで後未満5分でそれに答えるために管理

protocol Protocol2: Protocol1 { 
    associatedtype Operation: OperationProtocol where Operation.Parameter1 = Self.Type1 
} 

答えて

1

が答えです:

protocol Protocol2: Protocol1 { 
    associatedtype Operation: OperationProtocol 
    associatedtype Type1 = Operation.Parameter1 
} 
関連する問題