fix(codegen): resolve inherited PROPERTY through derived FB instance (upstream #183) - #83
Merged
devin-ai-integration[bot] merged 2 commits intoAug 4, 2026
Conversation
External access to a PROPERTY declared on a base FB, made through an instance of a derived FB, emitted raw field access (inst.PROP) instead of the accessor call (inst.get_PROP()/set_PROP()). The C++ failed to compile while strucpp reported success; the error only surfaced at g++. resolvePropertyName looked up only the exact type name and never walked fb.extends, so DERIVED.VAL missed the map and fell through to raw .field access. Methods were unaffected because a method call emits .NAME(), valid via C++ public inheritance, regardless of the lookup. Build an fbExtendsMap (FB -> parent) and walk the EXTENDS chain in resolvePropertyName, consulting each ancestor in turn (with a visited guard against cyclic inheritance). This fixes reads, writes, and chained access, since all five call sites route through that one resolver. Fixes Autonomy-Logic#182
…(upstream Autonomy-Logic#183) Ports Autonomy-Logic/STruCpp PR Autonomy-Logic#183 to our fork with test-conflict resolution. - Adds fbExtendsMap and walks the EXTENDS chain in resolvePropertyName. - Preserved our virtual-public interface inheritance test expectations. - Preserved our property VAR-block test while adding the inherited-property tests. Closes upstream Autonomy-Logic#182 Co-Authored-By: Simon Atti <wattimedia@gmail.com>
Author
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Ports
Autonomy-Logic/STruCppPR Autonomy-Logic#183 to fix inheritedPROPERTYaccess through derived FB instances.What changed
fbExtendsMaptoCodeGeneratorand populated it while scanning FB declarations.resolvePropertyName()to walk theEXTENDSchain, soDerived.Valresolves toBase.Valand emitsd.get_VAL()/d.set_VAL(...)instead of rawd.VAL(which fails C++ compilation because the field lives in the base class).Conflict resolution
Our fork already used
virtual publicfor interface implementations, so the upstream test expectationclass WORKER : public IRUNNABLEwas updated tovirtual public IRUNNABLE. Our existing property VAR-block test was preserved alongside the new inherited-property tests.Verification
npm run typecheckcleannpx eslint src/ --quietcleannpx vitest run tests/backend/codegen-oop.test.ts— 65 tests passednpm testandStruc-ToolTest1downstream are running now.Closes upstream Autonomy-Logic#182
Link to Devin session: https://app.devin.ai/sessions/01bd5a0c3ebc4e3a93e5228eb07cf11b
Requested by: @wattzor