Fix a bug in toy LateLowering where a type conversion was using 'cast' instead of 'dyn_cast'.
--
PiperOrigin-RevId: 249325111
diff --git a/examples/toy/Ch5/mlir/LateLowering.cpp b/examples/toy/Ch5/mlir/LateLowering.cpp
index 845bf7d..7911649 100644
--- a/examples/toy/Ch5/mlir/LateLowering.cpp
+++ b/examples/toy/Ch5/mlir/LateLowering.cpp
@@ -337,7 +337,7 @@
/// Convert a Toy type, this gets called for block and region arguments, and
/// attributes.
Type convertType(Type t) override {
- if (auto array = t.cast<toy::ToyArrayType>())
+ if (auto array = t.dyn_cast<toy::ToyArrayType>())
return array.toMemref();
return t;
}