Skip to content

Commit 9b92f0a

Browse files
committed
[MLIR][Python] fix generated value builder type hints
1 parent 30e9cba commit 9b92f0a

File tree

5 files changed

+96
-49
lines changed

5 files changed

+96
-49
lines changed

mlir/test/mlir-tblgen/op-python-bindings.td

Lines changed: 36 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ def AttrSizedOperandsOp : TestOp<"attr_sized_operands",
6060
Optional<AnyType>:$variadic2);
6161
}
6262

63-
// CHECK: def attr_sized_operands(variadic1, non_variadic, *, variadic2=None, loc=None, ip=None)
63+
// CHECK: def attr_sized_operands(variadic1, non_variadic, *, variadic2=None, loc=None, ip=None) -> AttrSizedOperandsOp:
6464
// CHECK: return AttrSizedOperandsOp(variadic1=variadic1, non_variadic=non_variadic, variadic2=variadic2, loc=loc, ip=ip)
6565

6666
// CHECK: @_ods_cext.register_operation(_Dialect)
@@ -108,8 +108,9 @@ def AttrSizedResultsOp : TestOp<"attr_sized_results",
108108
Variadic<AnyType>:$variadic2);
109109
}
110110

111-
// CHECK: def attr_sized_results(variadic1, non_variadic, variadic2, *, loc=None, ip=None)
112-
// CHECK: return _get_op_result_or_op_results(AttrSizedResultsOp(variadic1=variadic1, non_variadic=non_variadic, variadic2=variadic2, loc=loc, ip=ip))
111+
// CHECK: def attr_sized_results(variadic1, non_variadic, variadic2, *, loc=None, ip=None) -> _Union[_ods_ir.OpResult, _ods_ir.OpResultList, AttrSizedResultsOp]:
112+
// CHECK: op = AttrSizedResultsOp(variadic1=variadic1, non_variadic=non_variadic, variadic2=variadic2, loc=loc, ip=ip); results = op.results
113+
// CHECK: return results if len(results) > 1 else (results[0] if len(results) == 1 else op)
113114

114115

115116
// CHECK: @_ods_cext.register_operation(_Dialect)
@@ -159,7 +160,7 @@ def AttributedOp : TestOp<"attributed_op"> {
159160
UnitAttr:$unitAttr, I32Attr:$in);
160161
}
161162

162-
// CHECK: def attributed_op(i32attr, in_, *, optional_f32_attr=None, unit_attr=None, loc=None, ip=None)
163+
// CHECK: def attributed_op(i32attr, in_, *, optional_f32_attr=None, unit_attr=None, loc=None, ip=None) -> AttributedOp:
163164
// CHECK: return AttributedOp(i32attr=i32attr, in_=in_, optionalF32Attr=optional_f32_attr, unitAttr=unit_attr, loc=loc, ip=ip)
164165

165166
// CHECK: @_ods_cext.register_operation(_Dialect)
@@ -196,7 +197,7 @@ def AttributedOpWithOperands : TestOp<"attributed_op_with_operands"> {
196197
let arguments = (ins I32, UnitAttr:$in, F32, OptionalAttr<F32Attr>:$is);
197198
}
198199

199-
// CHECK: def attributed_op_with_operands(_gen_arg_0, _gen_arg_2, *, in_=None, is_=None, loc=None, ip=None)
200+
// CHECK: def attributed_op_with_operands(_gen_arg_0, _gen_arg_2, *, in_=None, is_=None, loc=None, ip=None) -> AttributedOpWithOperands
200201
// CHECK: return AttributedOpWithOperands(_gen_arg_0=_gen_arg_0, _gen_arg_2=_gen_arg_2, in_=in_, is_=is_, loc=loc, ip=ip)
201202

202203
// CHECK: @_ods_cext.register_operation(_Dialect)
@@ -221,7 +222,7 @@ def DefaultValuedAttrsOp : TestOp<"default_valued_attrs"> {
221222
let results = (outs);
222223
}
223224

224-
// CHECK: def default_valued_attrs(*, arr=None, unsupported=None, loc=None, ip=None)
225+
// CHECK: def default_valued_attrs(*, arr=None, unsupported=None, loc=None, ip=None) -> DefaultValuedAttrsOp:
225226
// CHECK: return DefaultValuedAttrsOp(arr=arr, unsupported=unsupported, loc=loc, ip=ip)
226227

227228
// CHECK-LABEL: OPERATION_NAME = "test.derive_result_types_op"
@@ -239,7 +240,7 @@ def DeriveResultTypesOp : TestOp<"derive_result_types_op", [FirstAttrDerivedResu
239240
let results = (outs AnyType:$res, AnyType);
240241
}
241242

242-
// CHECK: def derive_result_types_op(type_, *, results=None, loc=None, ip=None)
243+
// CHECK: def derive_result_types_op(type_, *, results=None, loc=None, ip=None) -> _ods_ir.OpResultList:
243244
// CHECK: return DeriveResultTypesOp(type_=type_, results=results, loc=loc, ip=ip).results
244245

245246
// CHECK-LABEL: OPERATION_NAME = "test.derive_result_types_variadic_op"
@@ -249,8 +250,9 @@ def DeriveResultTypesVariadicOp : TestOp<"derive_result_types_variadic_op", [Fir
249250
let results = (outs AnyType:$res, Variadic<AnyType>);
250251
}
251252

252-
// CHECK: def derive_result_types_variadic_op(res, _gen_res_1, type_, *, loc=None, ip=None)
253-
// CHECK: return _get_op_result_or_op_results(DeriveResultTypesVariadicOp(res=res, _gen_res_1=_gen_res_1, type_=type_, loc=loc, ip=ip))
253+
// CHECK: def derive_result_types_variadic_op(res, _gen_res_1, type_, *, loc=None, ip=None) -> _Union[_ods_ir.OpResult, _ods_ir.OpResultList, DeriveResultTypesVariadicOp]:
254+
// CHECK: op = DeriveResultTypesVariadicOp(res=res, _gen_res_1=_gen_res_1, type_=type_, loc=loc, ip=ip); results = op.results
255+
// CHECK: return results if len(results) > 1 else (results[0] if len(results) == 1 else op)
254256

255257
// CHECK: @_ods_cext.register_operation(_Dialect)
256258
// CHECK: class EmptyOp(_ods_ir.OpView):
@@ -267,7 +269,7 @@ def EmptyOp : TestOp<"empty">;
267269
// CHECK: attributes=attributes, results=results, operands=operands,
268270
// CHECK: successors=_ods_successors, regions=regions, loc=loc, ip=ip)
269271

270-
// CHECK: def empty(*, loc=None, ip=None)
272+
// CHECK: def empty(*, loc=None, ip=None) -> EmptyOp:
271273
// CHECK: return EmptyOp(loc=loc, ip=ip)
272274

273275
// CHECK-LABEL: OPERATION_NAME = "test.infer_result_types_implied_op"
@@ -281,7 +283,7 @@ def InferResultTypesImpliedOp : TestOp<"infer_result_types_implied_op"> {
281283
let results = (outs I32:$i32, F32:$f32);
282284
}
283285

284-
// CHECK: def infer_result_types_implied_op(*, results=None, loc=None, ip=None)
286+
// CHECK: def infer_result_types_implied_op(*, results=None, loc=None, ip=None) -> _ods_ir.OpResultList:
285287
// CHECK: return InferResultTypesImpliedOp(results=results, loc=loc, ip=ip).results
286288

287289
// CHECK-LABEL: OPERATION_NAME = "test.infer_result_types_op"
@@ -295,7 +297,7 @@ def InferResultTypesOp : TestOp<"infer_result_types_op", [InferTypeOpInterface]>
295297
let results = (outs AnyType, AnyType, AnyType);
296298
}
297299

298-
// CHECK: def infer_result_types_op(*, results=None, loc=None, ip=None)
300+
// CHECK: def infer_result_types_op(*, results=None, loc=None, ip=None) -> _ods_ir.OpResultList:
299301
// CHECK: return InferResultTypesOp(results=results, loc=loc, ip=ip).results
300302

301303
// CHECK: @_ods_cext.register_operation(_Dialect)
@@ -334,7 +336,7 @@ def MissingNamesOp : TestOp<"missing_names"> {
334336
let results = (outs I32:$i32, AnyFloat, I64:$i64);
335337
}
336338

337-
// CHECK: def missing_names(i32, _gen_res_1, i64, _gen_arg_0, f32, _gen_arg_2, *, loc=None, ip=None)
339+
// CHECK: def missing_names(i32, _gen_res_1, i64, _gen_arg_0, f32, _gen_arg_2, *, loc=None, ip=None) -> _ods_ir.OpResultList:
338340
// CHECK: return MissingNamesOp(i32=i32, _gen_res_1=_gen_res_1, i64=i64, _gen_arg_0=_gen_arg_0, f32=f32, _gen_arg_2=_gen_arg_2, loc=loc, ip=ip).results
339341

340342
// CHECK: @_ods_cext.register_operation(_Dialect)
@@ -366,7 +368,7 @@ def OneOptionalOperandOp : TestOp<"one_optional_operand"> {
366368
// CHECK: return None if len(self.operation.operands) < 2 else self.operation.operands[1]
367369
}
368370

369-
// CHECK: def one_optional_operand(non_optional, *, optional=None, loc=None, ip=None)
371+
// CHECK: def one_optional_operand(non_optional, *, optional=None, loc=None, ip=None) -> OneOptionalOperandOp:
370372
// CHECK: return OneOptionalOperandOp(non_optional=non_optional, optional=optional, loc=loc, ip=ip)
371373

372374
// CHECK: @_ods_cext.register_operation(_Dialect)
@@ -399,7 +401,7 @@ def OneVariadicOperandOp : TestOp<"one_variadic_operand"> {
399401
let arguments = (ins AnyType:$non_variadic, Variadic<AnyType>:$variadic);
400402
}
401403

402-
// CHECK: def one_variadic_operand(non_variadic, variadic, *, loc=None, ip=None)
404+
// CHECK: def one_variadic_operand(non_variadic, variadic, *, loc=None, ip=None) -> OneVariadicOperandOp:
403405
// CHECK: return OneVariadicOperandOp(non_variadic=non_variadic, variadic=variadic, loc=loc, ip=ip)
404406

405407
// CHECK: @_ods_cext.register_operation(_Dialect)
@@ -433,8 +435,9 @@ def OneVariadicResultOp : TestOp<"one_variadic_result"> {
433435
let results = (outs Variadic<AnyType>:$variadic, AnyType:$non_variadic);
434436
}
435437

436-
// CHECK: def one_variadic_result(variadic, non_variadic, *, loc=None, ip=None)
437-
// CHECK: return _get_op_result_or_op_results(OneVariadicResultOp(variadic=variadic, non_variadic=non_variadic, loc=loc, ip=ip))
438+
// CHECK: def one_variadic_result(variadic, non_variadic, *, loc=None, ip=None) -> _Union[_ods_ir.OpResult, _ods_ir.OpResultList, OneVariadicResultOp]:
439+
// CHECK: op = OneVariadicResultOp(variadic=variadic, non_variadic=non_variadic, loc=loc, ip=ip); results = op.results
440+
// CHECK: return results if len(results) > 1 else (results[0] if len(results) == 1 else op)
438441

439442
// CHECK: @_ods_cext.register_operation(_Dialect)
440443
// CHECK: class PythonKeywordOp(_ods_ir.OpView):
@@ -458,7 +461,7 @@ def PythonKeywordOp : TestOp<"python_keyword"> {
458461
let arguments = (ins AnyType:$in);
459462
}
460463

461-
// CHECK: def python_keyword(in_, *, loc=None, ip=None)
464+
// CHECK: def python_keyword(in_, *, loc=None, ip=None) -> PythonKeywordOp:
462465
// CHECK: return PythonKeywordOp(in_=in_, loc=loc, ip=ip)
463466

464467
// CHECK-LABEL: OPERATION_NAME = "test.same_results"
@@ -471,8 +474,8 @@ def SameResultsOp : TestOp<"same_results", [SameOperandsAndResultType]> {
471474
let results = (outs AnyType:$res);
472475
}
473476

474-
// CHECK: def same_results(in1, in2, *, results=None, loc=None, ip=None)
475-
// CHECK: return SameResultsOp(in1=in1, in2=in2, results=results, loc=loc, ip=ip)
477+
// CHECK: def same_results(in1, in2, *, results=None, loc=None, ip=None) -> _ods_ir.OpResult:
478+
// CHECK: return SameResultsOp(in1=in1, in2=in2, results=results, loc=loc, ip=ip).result
476479

477480
// CHECK-LABEL: OPERATION_NAME = "test.same_results_variadic"
478481
def SameResultsVariadicOp : TestOp<"same_results_variadic", [SameOperandsAndResultType]> {
@@ -481,8 +484,9 @@ def SameResultsVariadicOp : TestOp<"same_results_variadic", [SameOperandsAndResu
481484
let results = (outs Variadic<AnyType>:$res);
482485
}
483486

484-
// CHECK: def same_results_variadic(res, in1, in2, *, loc=None, ip=None)
485-
// CHECK: return _get_op_result_or_op_results(SameResultsVariadicOp(res=res, in1=in1, in2=in2, loc=loc, ip=ip))
487+
// CHECK: def same_results_variadic(res, in1, in2, *, loc=None, ip=None) -> _Union[_ods_ir.OpResult, _ods_ir.OpResultList, SameResultsVariadicOp]:
488+
// CHECK: op = SameResultsVariadicOp(res=res, in1=in1, in2=in2, loc=loc, ip=ip); results = op.results
489+
// CHECK: return results if len(results) > 1 else (results[0] if len(results) == 1 else op)
486490

487491

488492
// CHECK: @_ods_cext.register_operation(_Dialect)
@@ -508,7 +512,7 @@ def SameVariadicOperandSizeOp : TestOp<"same_variadic_operand",
508512
Variadic<AnyType>:$variadic2);
509513
}
510514

511-
// CHECK: def same_variadic_operand(variadic1, non_variadic, variadic2, *, loc=None, ip=None)
515+
// CHECK: def same_variadic_operand(variadic1, non_variadic, variadic2, *, loc=None, ip=None) -> SameVariadicOperandSizeOp:
512516
// CHECK: return SameVariadicOperandSizeOp(variadic1=variadic1, non_variadic=non_variadic, variadic2=variadic2, loc=loc, ip=ip)
513517

514518
// CHECK: @_ods_cext.register_operation(_Dialect)
@@ -534,8 +538,9 @@ def SameVariadicResultSizeOp : TestOp<"same_variadic_result",
534538
Variadic<AnyType>:$variadic2);
535539
}
536540

537-
// CHECK: def same_variadic_result(variadic1, non_variadic, variadic2, *, loc=None, ip=None)
538-
// CHECK: return _get_op_result_or_op_results(SameVariadicResultSizeOp(variadic1=variadic1, non_variadic=non_variadic, variadic2=variadic2, loc=loc, ip=ip))
541+
// CHECK: def same_variadic_result(variadic1, non_variadic, variadic2, *, loc=None, ip=None) -> _Union[_ods_ir.OpResult, _ods_ir.OpResultList, SameVariadicResultSizeOp]:
542+
// CHECK: op = SameVariadicResultSizeOp(variadic1=variadic1, non_variadic=non_variadic, variadic2=variadic2, loc=loc, ip=ip); results = op.results
543+
// CHECK: return results if len(results) > 1 else (results[0] if len(results) == 1 else op)
539544

540545
// CHECK: @_ods_cext.register_operation(_Dialect)
541546
// CHECK: class SimpleOp(_ods_ir.OpView):
@@ -575,7 +580,7 @@ def SimpleOp : TestOp<"simple"> {
575580
let results = (outs I64:$i64, AnyFloat:$f64);
576581
}
577582

578-
// CHECK: def simple(i64, f64, i32, f32, *, loc=None, ip=None)
583+
// CHECK: def simple(i64, f64, i32, f32, *, loc=None, ip=None) -> _ods_ir.OpResultList:
579584
// CHECK: return SimpleOp(i64=i64, f64=f64, i32=i32, f32=f32, loc=loc, ip=ip).results
580585

581586
// CHECK: class VariadicAndNormalRegionOp(_ods_ir.OpView):
@@ -603,7 +608,7 @@ def VariadicAndNormalRegionOp : TestOp<"variadic_and_normal_region"> {
603608
// CHECK: return self.regions[2:]
604609
}
605610

606-
// CHECK: def variadic_and_normal_region(num_variadic, *, loc=None, ip=None)
611+
// CHECK: def variadic_and_normal_region(num_variadic, *, loc=None, ip=None) -> VariadicAndNormalRegionOp:
607612
// CHECK: return VariadicAndNormalRegionOp(num_variadic=num_variadic, loc=loc, ip=ip)
608613

609614
// CHECK: class VariadicRegionOp(_ods_ir.OpView):
@@ -627,7 +632,7 @@ def VariadicRegionOp : TestOp<"variadic_region"> {
627632
// CHECK: return self.regions[0:]
628633
}
629634

630-
// CHECK: def variadic_region(num_variadic, *, loc=None, ip=None)
635+
// CHECK: def variadic_region(num_variadic, *, loc=None, ip=None) -> VariadicRegionOp:
631636
// CHECK: return VariadicRegionOp(num_variadic=num_variadic, loc=loc, ip=ip)
632637

633638
// CHECK: @_ods_cext.register_operation(_Dialect)
@@ -636,7 +641,7 @@ def VariadicRegionOp : TestOp<"variadic_region"> {
636641
def WithSpecialCharactersOp : TestOp<"123with--special.characters"> {
637642
}
638643

639-
// CHECK: def _123with__special_characters(*, loc=None, ip=None)
644+
// CHECK: def _123with__special_characters(*, loc=None, ip=None) -> WithSpecialCharactersOp:
640645
// CHECK: return WithSpecialCharactersOp(loc=loc, ip=ip)
641646

642647
// CHECK: @_ods_cext.register_operation(_Dialect)
@@ -651,11 +656,11 @@ def WithSuccessorsOp : TestOp<"with_successors"> {
651656
VariadicSuccessor<AnySuccessor>:$successors);
652657
}
653658

654-
// CHECK: def with_successors(successor, successors, *, loc=None, ip=None)
659+
// CHECK: def with_successors(successor, successors, *, loc=None, ip=None) -> WithSuccessorsOp:
655660
// CHECK: return WithSuccessorsOp(successor=successor, successors=successors, loc=loc, ip=ip)
656661

657662
// CHECK: class snake_case(_ods_ir.OpView):
658663
// CHECK-LABEL: OPERATION_NAME = "test.snake_case"
659664
def already_snake_case : TestOp<"snake_case"> {}
660-
// CHECK: def snake_case_(*, loc=None, ip=None)
665+
// CHECK: def snake_case_(*, loc=None, ip=None) -> snake_case:
661666
// CHECK: return snake_case(loc=loc, ip=ip)

mlir/test/python/dialects/python_test.py

Lines changed: 42 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
# RUN: %PYTHON %s pybind11 | FileCheck %s
22
# RUN: %PYTHON %s nanobind | FileCheck %s
3-
3+
import inspect
44
import sys
5+
from typing import Union
6+
57
from mlir.ir import *
68
import mlir.dialects.func as func
79
import mlir.dialects.python_test as test
@@ -323,6 +325,7 @@ def resultTypesDefinedByTraits():
323325
# CHECK: f32 index
324326
print(no_infer.single.type, no_infer.doubled.type)
325327

328+
326329
# CHECK-LABEL: TEST: testOptionalOperandOp
327330
@run
328331
def testOptionalOperandOp():
@@ -594,6 +597,17 @@ def testInferTypeOpInterface():
594597
# CHECK: f32
595598
print(two_operands.result.type)
596599

600+
assert (
601+
inspect.signature(
602+
test.infer_results_variadic_inputs_op
603+
).return_annotation
604+
is OpResult
605+
)
606+
assert isinstance(
607+
test.infer_results_variadic_inputs_op(single=zero, doubled=zero),
608+
OpResult,
609+
)
610+
597611

598612
# CHECK-LABEL: TEST: testVariadicOperandAccess
599613
@run
@@ -621,6 +635,15 @@ def values(lst):
621635
# CHECK: ['Value(%{{.*}} = arith.constant 3 : i32)', 'Value(%{{.*}} = arith.constant 4 : i32)']
622636
print(values(variadic_operands.variadic2))
623637

638+
assert (
639+
inspect.signature(test.same_variadic_operand).return_annotation
640+
is test.SameVariadicOperandSizeOp
641+
)
642+
assert isinstance(
643+
test.same_variadic_operand([zero, one], two, [three, four]),
644+
test.SameVariadicOperandSizeOp,
645+
)
646+
624647

625648
# CHECK-LABEL: TEST: testVariadicResultAccess
626649
@run
@@ -642,6 +665,15 @@ def types(lst):
642665
# CHECK: [IntegerType(i3), IntegerType(i4)]
643666
print(types(op.variadic2))
644667

668+
assert (
669+
inspect.signature(test.same_variadic_result_vfv).return_annotation
670+
is Union[OpResult, OpResultList, test.SameVariadicResultSizeOpVFV]
671+
)
672+
assert isinstance(
673+
test.same_variadic_result_vfv([i[0], i[1]], i[2], [i[3], i[4]]),
674+
OpResultList,
675+
)
676+
645677
# Test Variadic-Variadic-Variadic
646678
op = test.SameVariadicResultSizeOpVVV(
647679
[i[0], i[1]], [i[2], i[3]], [i[4], i[5]]
@@ -713,3 +745,12 @@ def types(lst):
713745
print(types(op.variadic2))
714746
# CHECK: i4
715747
print(op.non_variadic3.type)
748+
749+
assert (
750+
inspect.signature(test.results_variadic).return_annotation
751+
is Union[OpResult, OpResultList, test.ResultsVariadicOp]
752+
)
753+
assert isinstance(
754+
test.results_variadic([i[0]]),
755+
OpResult,
756+
)

mlir/test/python/ir/auto_location.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ def testInferLocations():
5151
_cext.globals.register_traceback_file_inclusion(_arith_ops_gen.__file__)
5252
three = arith.constant(IndexType.get(), 3)
5353
# fmt: off
54-
# CHECK: loc(callsite("ConstantOp.__init__"("{{.*}}[[SEP]]mlir[[SEP]]dialects[[SEP]]_arith_ops_gen.py":397:4 to :235) at callsite("testInferLocations"("{{.*}}[[SEP]]test[[SEP]]python[[SEP]]ir[[SEP]]auto_location.py":52:16 to :50) at callsite("run"("{{.*}}[[SEP]]test[[SEP]]python[[SEP]]ir[[SEP]]auto_location.py":13:4 to :7) at "<module>"("{{.*}}[[SEP]]test[[SEP]]python[[SEP]]ir[[SEP]]auto_location.py":26:1 to :4)))))
54+
# CHECK: loc(callsite("ConstantOp.__init__"("{{.*}}[[SEP]]mlir[[SEP]]dialects[[SEP]]_arith_ops_gen.py":396:4 to :235) at callsite("testInferLocations"("{{.*}}[[SEP]]test[[SEP]]python[[SEP]]ir[[SEP]]auto_location.py":52:16 to :50) at callsite("run"("{{.*}}[[SEP]]test[[SEP]]python[[SEP]]ir[[SEP]]auto_location.py":13:4 to :7) at "<module>"("{{.*}}[[SEP]]test[[SEP]]python[[SEP]]ir[[SEP]]auto_location.py":26:1 to :4)))))
5555
# fmt: on
5656
print(three.location)
5757

@@ -60,14 +60,14 @@ def foo():
6060
print(four.location)
6161

6262
# fmt: off
63-
# CHECK: loc(callsite("ConstantOp.__init__"("{{.*}}[[SEP]]mlir[[SEP]]dialects[[SEP]]_arith_ops_gen.py":397:4 to :235) at callsite("testInferLocations.<locals>.foo"("{{.*}}[[SEP]]test[[SEP]]python[[SEP]]ir[[SEP]]auto_location.py":59:19 to :53) at callsite("testInferLocations"("{{.*}}[[SEP]]test[[SEP]]python[[SEP]]ir[[SEP]]auto_location.py":65:8 to :13) at callsite("run"("{{.*}}[[SEP]]test[[SEP]]python[[SEP]]ir[[SEP]]auto_location.py":13:4 to :7) at "<module>"("{{.*}}[[SEP]]test[[SEP]]python[[SEP]]ir[[SEP]]auto_location.py":26:1 to :4))))))
63+
# CHECK: loc(callsite("ConstantOp.__init__"("{{.*}}[[SEP]]mlir[[SEP]]dialects[[SEP]]_arith_ops_gen.py":396:4 to :235) at callsite("testInferLocations.<locals>.foo"("{{.*}}[[SEP]]test[[SEP]]python[[SEP]]ir[[SEP]]auto_location.py":59:19 to :53) at callsite("testInferLocations"("{{.*}}[[SEP]]test[[SEP]]python[[SEP]]ir[[SEP]]auto_location.py":65:8 to :13) at callsite("run"("{{.*}}[[SEP]]test[[SEP]]python[[SEP]]ir[[SEP]]auto_location.py":13:4 to :7) at "<module>"("{{.*}}[[SEP]]test[[SEP]]python[[SEP]]ir[[SEP]]auto_location.py":26:1 to :4))))))
6464
# fmt: on
6565
foo()
6666

6767
_cext.globals.register_traceback_file_exclusion(__file__)
6868

6969
# fmt: off
70-
# CHECK: loc("ConstantOp.__init__"("{{.*}}[[SEP]]mlir[[SEP]]dialects[[SEP]]_arith_ops_gen.py":397:4 to :235))
70+
# CHECK: loc("ConstantOp.__init__"("{{.*}}[[SEP]]mlir[[SEP]]dialects[[SEP]]_arith_ops_gen.py":396:4 to :235))
7171
# fmt: on
7272
foo()
7373

mlir/test/python/python_test_ops.td

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -265,4 +265,8 @@ def SameVariadicResultSizeOpFVFVF : TestOp<"same_variadic_result_fvfvf",
265265
AnyType:$non_variadic3);
266266
}
267267

268+
def ResultsVariadicOp : TestOp<"results_variadic"> {
269+
let results = (outs Variadic<AnyType>:$res);
270+
}
271+
268272
#endif // PYTHON_TEST_OPS

0 commit comments

Comments
 (0)