Differential D125595 Diff 429397 mlir/test/mlir-tblgen/op-format-verify-trailing-optional-operand.td
Changeset View
Changeset View
Standalone View
Standalone View
mlir/test/mlir-tblgen/op-format-verify-trailing-optional-operand.td
- This file was added.
// RUN: mlir-tblgen -gen-op-decls -asmformat-error-is-fatal=false -I %S/../../include %s -o=%t 2>&1 | FileCheck %s | |||||
include "mlir/IR/OpBase.td" | |||||
def TestDialect : Dialect { | |||||
let name = "test"; | |||||
} | |||||
class TestFormat_Op<string fmt, list<Trait> traits = []> | |||||
: Op<TestDialect, "format_op", traits> { | |||||
let assemblyFormat = fmt; | |||||
} | |||||
//===----------------------------------------------------------------------===// | |||||
// Format ambiguity caused by trailing optional operand(s) | |||||
//===----------------------------------------------------------------------===// | |||||
// Test trailing optional operand. | |||||
// CHECK: error: format ambiguity caused by trailing | |||||
def AmbiguousTypeA : TestFormat_Op<"attr-dict $a">, | |||||
Arguments<(ins Optional<I32>:$a)>; | |||||
// Test trailing optional operand followed by optional elements. | |||||
// CHECK: error: format ambiguity caused by trailing | |||||
def AmbiguousTypeB : TestFormat_Op<"$a attr-dict">, | |||||
Arguments<(ins Optional<I32>:$a)>; |