File tree Expand file tree Collapse file tree 3 files changed +14
-2
lines changed Expand file tree Collapse file tree 3 files changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -1603,10 +1603,12 @@ class OpAsmParser : public AsmParser {
16031603 SmallVectorImpl<Value> &result) {
16041604 size_t operandSize = llvm::range_size (operands);
16051605 size_t typeSize = llvm::range_size (types);
1606- if (operandSize != typeSize)
1607- return emitError (loc)
1606+ if (operandSize != typeSize) {
1607+ // If no location was provided, report errors at the beginning of the op.
1608+ return emitError (loc.isValid () ? loc : getNameLoc ())
16081609 << " number of operands and types do not match: got " << operandSize
16091610 << " operands and " << typeSize << " types" ;
1611+ }
16101612
16111613 for (auto [operand, type] : llvm::zip_equal (operands, types))
16121614 if (resolveOperand (operand, type, result))
Original file line number Diff line number Diff line change @@ -118,3 +118,8 @@ func.func @invalid_splat(%v : f32) { // expected-note {{prior use here}}
118118
119119// expected-error@+1 {{expected ':' after block name}}
120120" g" ()({^a :^b })
121+
122+ // -----
123+
124+ // expected-error@+1 {{number of operands and types do not match: got 0 operands and 1 types}}
125+ test.variadic_args_types_split " hello_world" : i32
Original file line number Diff line number Diff line change @@ -767,4 +767,9 @@ def FormatInferTypeVariadicOperandsOp
767767 }];
768768}
769769
770+ def VariadicArgsTypesSplit : TEST_Op<"variadic_args_types_split"> {
771+ let arguments = (ins StrAttr:$str, Variadic<AnyType>:$args);
772+ let assemblyFormat = "$str (`,` $args^)? attr-dict (`:` type($args)^)?";
773+ }
774+
770775#endif // TEST_OPS_SYNTAX
You can’t perform that action at this time.
0 commit comments