Catch invalid element type in fir.box in the verifier so
it does not propagate later in lowering.
Reviewed By: PeteSteinfeld
Differential Revision: https://reviews.llvm.org/D146078
mlir::LogicalResult
fir::BoxType::verify(llvm::function_ref<mlir::InFlightDiagnostic()> emitError,
mlir::Type eleTy) {
+ if (eleTy.isa<fir::BaseBoxType>())
+ return emitError() << "invalid element type\n";
// TODO
return mlir::success();
}
// expected-error@+1 {{invalid element type}}
func.func private @upe() -> !fir.class<!fir.box<i32>>
+
+// -----
+
+// expected-error@+1 {{invalid element type}}
+func.func private @upe() -> !fir.box<!fir.class<none>>