← Back to Pull requests

[swift2objc] Add integration test for restricted setters #3839

Closed
unknown closed this pull request without merging on Dec 02, 2026 23:44 UTC
View on GitHub
unknown unknown commented on Dec 02, 2026 03:04 UTC
Author

Description

Adds the integration test requested in the last comment on #2049.

The test covers private(set), fileprivate(set) and internal(set) stored properties on a class and a struct, including static properties and a property with a non-representable type. They are all wrapped as get-only properties, while the plain public var properties next to them keep their setters.

Two cases are not covered:

  • package(set), which needs a -package-name that the test harness doesn't pass.

  • Computed properties with a restricted setter. These don't work. For
  •   public private(set) var computed: Int {
          get { stored }
          set { stored = newValue }
      }
      

    swiftc -emit-symbol-graph (Swift 6.2) emits the declaration fragments var computed: Int { get set } with accessLevel: public, which is identical to a property with a public setter. swift2objc then generates a setter, and the wrapper fails to compile with cannot assign to property: 'computed' setter is inaccessible. I didn't see anything else in the symbol that distinguishes the two cases, so I left this out of the test rather than guess at a fix. I'm happy to file a separate issue for it if that's useful.

    Related Issues

    Refs #2049. I've used "Refs" rather than "Fixes" because of the computed property case above.

    PR Checklist

  • I’ve reviewed the contributor guide and applied the relevant portions to this PR.

  • I've run dart tool/ci.dart --all locally 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 have rustc installed) and a 30s timeout in hooks_runner/test/build_runner/build_planner_test.dart.

  • All existing and new tests are passing. I added new tests to check the change I am making.

  • The PR is actually solving the issue.

  • I have updated CHANGELOG.md for the relevant packages. (Test only, so no entry.)

  • I have updated the pubspec package version if necessary. (Not needed.)
  • Diff: 267 lines (+200 / -67) across 3 files Reviewer: liamappelbe Review duration: 1239m
    All Vouch review confidence checks passed
    Residual risk 0.17 = Change Risk (0.39) × (1 − Review Confidence (0.57)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.39 · 267 lines diff across 3 files
    0.39
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    56%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    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
    Diff Size diff_size
    0.334
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #3839"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 56.8% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 39.4% (MEDIUM) · Higher = larger blast radius
    39.4%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 56.8% · Lower = rushed or shallow review
    56.8%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 17% · Safe to merge
    17%