Skip to content

GROOVY-12228: STC: multiple assignment ignores the declared type of t… - #2759

Merged
paulk-asert merged 1 commit into
apache:masterfrom
paulk-asert:groovy12228
Aug 4, 2026
Merged

GROOVY-12228: STC: multiple assignment ignores the declared type of t…#2759
paulk-asert merged 1 commit into
apache:masterfrom
paulk-asert:groovy12228

Conversation

@paulk-asert

Copy link
Copy Markdown
Contributor

…he target variables

@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 69.9755%. Comparing base (7a34d45) to head (a05304a).

Additional details and impacted files

Impacted file tree graph

@@                Coverage Diff                 @@
##               master      #2759        +/-   ##
==================================================
+ Coverage     69.9738%   69.9755%   +0.0017%     
+ Complexity      35505      35504         -1     
==================================================
  Files            1557       1557                
  Lines          131675     131679         +4     
  Branches        24169      24170         +1     
==================================================
+ Hits            92138      92143         +5     
- Misses          31193      31194         +1     
+ Partials         8344       8342         -2     
Files with missing lines Coverage Δ
...roovy/transform/stc/StaticTypeCheckingVisitor.java 87.4618% <100.0000%> (+0.0128%) ⬆️

... and 7 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@testlens-app

testlens-app Bot commented Aug 3, 2026

Copy link
Copy Markdown

✅ All tests passed ✅

🏷️ Commit: a05304a
▶️ Tests: 108573 executed
⚪️ Checks: 31/31 completed


Learn more about TestLens at testlens.app.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Addresses GROOVY-12228 by making static type checking for positional multiple assignment preserve the declared type of each target variable when the RHS requires implicit conversion/coercion, aligning multi-assignment behavior with single-assignment STC typing.

Changes:

  • Update typeCheckMultipleAssignmentPositional to store the LHS declared/origin type (instead of the raw RHS value type) when assignment relies on implicit conversion (e.g., GString -> String, Integer -> Long).
  • Add regression tests covering multi-assignment into pre-declared typed variables and typed tuple-declaration forms.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
src/test/groovy/groovy/transform/stc/STCAssignmentTest.groovy Adds GROOVY-12228 regression tests ensuring multi-assignment retains declared target types (e.g., String, Long).
src/main/java/org/codehaus/groovy/transform/stc/StaticTypeCheckingVisitor.java Adjusts STC multi-assignment positional typing to prefer original declared types when implicit conversion is involved.

@paulk-asert
paulk-asert merged commit bda3529 into apache:master Aug 4, 2026
32 checks passed
@paulk-asert
paulk-asert deleted the groovy12228 branch August 4, 2026 00:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants