@@ -139,29 +139,23 @@ static LogicalResult resolveClassStructBody(ClassDeclOp op,
139139 if (auto baseClass = op.getBaseAttr ()) {
140140
141141 ModuleOp mod = op->getParentOfType <ModuleOp>();
142- // It's possible the base class does not resolve since it materialzes
143- // no methods or properties. In that case we can simply ignore inheritance.
144- if (auto *opSym = mod.lookupSymbol (baseClass)) {
145- auto classDeclOp = dyn_cast<ClassDeclOp>(opSym);
146- if (!classDeclOp)
147- return op.emitError () << " Found symbol corresponding to " << baseClass
148- << " but it wasn't a classdeclop!" ;
149-
150- if (failed (resolveClassStructBody (classDeclOp, typeConverter, cache)))
151- return failure ();
142+ auto *opSym = mod.lookupSymbol (baseClass);
143+ auto classDeclOp = cast<ClassDeclOp>(opSym);
152144
153- // Process base class' struct layout first
154- auto baseClassStruct = cache.getStructInfo (baseClass);
155- structBodyMembers.push_back (baseClassStruct->classBody );
156- derivedStartIdx = 1 ;
157-
158- // Inherit base field paths with a leading 0.
159- for (auto &kv : baseClassStruct->propertyPath ) {
160- SmallVector<unsigned , 2 > path;
161- path.push_back (0 ); // into base subobject
162- path.append (kv.second .begin (), kv.second .end ());
163- structBody.setFieldPath (kv.first , path);
164- }
145+ if (failed (resolveClassStructBody (classDeclOp, typeConverter, cache)))
146+ return failure ();
147+
148+ // Process base class' struct layout first
149+ auto baseClassStruct = cache.getStructInfo (baseClass);
150+ structBodyMembers.push_back (baseClassStruct->classBody );
151+ derivedStartIdx = 1 ;
152+
153+ // Inherit base field paths with a leading 0.
154+ for (auto &kv : baseClassStruct->propertyPath ) {
155+ SmallVector<unsigned , 2 > path;
156+ path.push_back (0 ); // into base subobject
157+ path.append (kv.second .begin (), kv.second .end ());
158+ structBody.setFieldPath (kv.first , path);
165159 }
166160 }
167161
0 commit comments