Add `report_fatal_error` to `getTypeForScalarType` (#1722)

Functions like `getTypeForScalarType` that do a mapping from one set
of types to another should not fail, and if they do it
should be obvious to the developer that that function has an
unhandled case.

Instead of silently failing when encountering an unsupported type,
this commit adds a `report_fatal_error` at the end, similar to other
type translation functions in this file.
pull/1727/head
Ramiro Leal-Cavazos 2022-12-15 08:33:14 -08:00 committed by GitHub
parent 60db793feb
commit 211cf8fc36
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -96,7 +96,7 @@ Type Torch::getTypeForScalarType(
case torch_upstream::ScalarType::Char:
return mlir::IntegerType::get(context, 8, signedness);
default:
return Type();
llvm::report_fatal_error("unhandled type for getTypeForScalarType");
}
}