[swift2objc] Restore setters on stored global variables #3838
All Vouch review confidence checks passed
Residual risk 0.23 = Change Risk (0.40) × (1 − Review Confidence (0.43)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.40 · 273 lines diff across 3 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.02 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Shallow Review Depth
shallow_review_depth
0.344
Diff Size
diff_size
0.336
Real PR Conversation Timeline
1 comments
"Review active on #3838"
general
weight: 0.35
liamappelbe
Description
Stored global variables are currently wrapped as get-only properties. For example,
public var globalRepresentableVariable = 1generates:so the variable can't be assigned from Dart.
This regressed in #2940. That PR changed
_parsePropertyGetAndSetto return(getter: false, setter: false)for stored properties, and updatedparsePropertyDeclarationto treat that case as settable.parseGlobalVariableDeclarationwas not updated, and still computesisConstant: info.constant || !info.setter, which is now true for every stored global. The expected output of theglobal_variables_and_functionsintegration test was regenerated in that PR without the setters.The fix is to only treat a global as constant if it's declared with
let, or has a getter with no setter. This mirrors thehasSetterlogic inparsePropertyDeclaration.public private(set) varglobals stay get-only, because the symbol graph reports them as{ get }. I added one to theglobal_variables_and_functionstest to cover that.The
availableandoptionalexpected outputs also change, because each contains a stored globalvarthat gets its setter back.Related Issues
I couldn't find an existing issue for this. I found it while writing the integration test for #2049.
PR Checklist
dart tool/ci.dart --alllocally and resolved all issues identified. Two tests outside this package fail on my machine and are unrelated to this change:native_toolchain_c/test/clinker/rust_test.dart(I don't haverustcinstalled) and a 30s timeout inhooks_runner/test/build_runner/build_planner_test.dart.CHANGELOG.mdfor the relevant packages.0.3.2-wip).