diff --git a/lib/Dialect/FIRRTL/Transforms/LowerClasses.cpp b/lib/Dialect/FIRRTL/Transforms/LowerClasses.cpp index f0e54d3e1e1c..47e11ca2abf3 100644 --- a/lib/Dialect/FIRRTL/Transforms/LowerClasses.cpp +++ b/lib/Dialect/FIRRTL/Transforms/LowerClasses.cpp @@ -384,7 +384,11 @@ LogicalResult LowerClassesPass::processPaths( // We will plumb in the basepath from this module. StringAttr altBasePathModule; if (needsAltBasePath) { - altBasePathModule = cast(path.front()).getModule(); + altBasePathModule = + TypeSwitch(path.front()) + .Case([](auto a) { return a.getAttr(); }) + .Case([](auto a) { return a.getModule(); }); + pathInfoTable.addAltBasePathRoot(altBasePathModule); }