Defining constraint on ops with CPred

Hi Folks.

I am trying to define and use constraints on operand types using CPred and facing this error. Most likely I am not using the idiom properly I believe.

The error is get is :
error: Element type mismatch for list: element type 'IsSameMyType' not convertible to 'OpTrait
My code (i have tried to compact it here) is something like:

def MyDialect : Dialect { ...  }

class MyOpClass<string mnemonic, list<OpTrait> traits = []> :
    Op<MyDialect, mnemonic, traits>;

def MyTensorType :
    DialectType<MyDialect, CPred<"$_self.isa<MyTensorType>()">,
                "my very own tensor type">;

class IsSameMyType<int i, int j> :
    CPred<"$_op.getOperand(" # i # ").getType() == "
          "$_op.getOperand(" # j # ").getType()">;

def AddOp : MyOpClass<"myaddop", [IsSameMyType<0,1>]> {
  let arguments = (ins MyTensorType:$src, MyTensorType:$dst);
}

I understand that it is saying constraint and traits are different. My real question is how in this context one should use ODS to check with some CPred that some conditions on the two types of the operands hold.
Thanks a lot.

With PredOpTrait I was able to achieve mostly what I wanted. If there is better way please do let me know.