diff --git a/mlir/lib/Dialect/EmitC/IR/EmitC.cpp b/mlir/lib/Dialect/EmitC/IR/EmitC.cpp --- a/mlir/lib/Dialect/EmitC/IR/EmitC.cpp +++ b/mlir/lib/Dialect/EmitC/IR/EmitC.cpp @@ -217,7 +217,7 @@ std::string value; SMLoc loc = parser.getCurrentLocation(); if (parser.parseOptionalString(&value) || value.empty()) { - parser.emitError(loc) << "expected non empty string"; + parser.emitError(loc) << "expected non empty string in !emitc.opaque type"; return Type(); } if (parser.parseGreater()) diff --git a/mlir/test/Dialect/EmitC/invalid_types.mlir b/mlir/test/Dialect/EmitC/invalid_types.mlir new file mode 100644 --- /dev/null +++ b/mlir/test/Dialect/EmitC/invalid_types.mlir @@ -0,0 +1,6 @@ +// RUN: mlir-opt %s -split-input-file -verify-diagnostics + +func @illegal_opaque_type_1() { + // expected-error @+1 {{expected non empty string in !emitc.opaque type}} + %1 = "emitc.variable"(){value = "42" : !emitc.opaque<"">} : () -> !emitc.opaque<"mytype"> +}