Implemented a verification to ensure that the shape.assuming_all
operation always has at least one operand.
let assemblyFormat = "$inputs attr-dict";
let hasFolder = 1;
+
+ let verifier = [{ return ::verify(*this); }];
}
def Shape_AssumingOp : Shape_Op<"assuming",
return BoolAttr::get(true, getContext());
}
+static LogicalResult verify(AssumingAllOp op) {
+ // Ensure that AssumingAllOp contains at least one operand
+ if (op.getNumOperands() == 0)
+ return op.emitOpError("no operands specified");
+
+ return success();
+}
+
//===----------------------------------------------------------------------===//
// BroadcastOp
//===----------------------------------------------------------------------===//
shape.yield %c0 : index
}
}
+
+// -----
+
+func @assuming_all_op_too_few_operands() {
+ // expected-error@+1 {{no operands specified}}
+ %w0 = shape.assuming_all
+ return
+}