Close out review-doc section 5; add const_cast<GenContext&> removal plan#208
Merged
Merged
Conversation
…adability and maintainability
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
Closes §5 (giant-method decomposition) of
docs/MLIRGen-refactoring-review.mdand tees up §3.mlirGenPropertyAccessExpressionBaseLogicis hoisted to a singlecastFnlocal shared by theConstArrayType/ArrayTypecases — the last real duplication in that function.mlirGenClassVirtualTableDefinitionwas already reduced to ~96 lines by Make class vtable slot resolution O(1), deterministic, and kind-safe #200, anddetectAccessLevelwas always ~30 lines (the old survey mislabeled multi-line signatures). A fresh survey confirms nothing over 250 lines remains after Decompose 590-line cast() into named pipeline stages #205–Decompose 304-line inferType into per-template-kind helpers #207; further splitting is diminishing returns.const_cast<GenContext &>mutations (§3), with a census by mutated field (9×funcOp, 4×typeParamsWithArgs, 3 loop-flag sites, 3×generatedStatements, 2×thisType, 2×stop(), 1×inferTypes, 2 inMLIRCodeLogic.h) and four independently shippable phases: legalizestop()viamutable; copy-on-override for downstream-only overrides (flagging unrestored mutations as the latent bugs §3 predicted); honestGenContext&/out-params for the inference family; parameterize theMLIRCodeLogic.hpokes.Test plan
tslangrebuilt cleanly (vs2026 debug)MLIRGenTests.exe: 12/12 pass🤖 Generated with Claude Code