Skip to content

Fix generic field toIndex assignments - #1216

Merged
Frotty merged 1 commit into
masterfrom
fix-647-generic-field-toindex
Aug 2, 2026
Merged

Fix generic field toIndex assignments#1216
Frotty merged 1 commit into
masterfrom
fix-647-generic-field-toindex

Conversation

@Frotty

@Frotty Frotty commented Aug 2, 2026

Copy link
Copy Markdown
Member

Summary

  • preserve the raw expected type when translating assignment right-hand sides
  • restore legacy generic toIndex conversion for field assignments
  • cover the exact issue reproduction on Jass and Lua

Root cause

Assignment expected-type inference normalized the target type before IM translation. For a legacy generic field, that erased the bound type parameter which carries the stringToIndex conversion, so Jass emitted a string assignment into an integer-backed field.

Validation

  • ./gradlew test --tests "tests.wurstscript.tests.GenericsTests.genericToIndexFieldAssignment" --tests "tests.wurstscript.tests.LuaTranslationTests.legacyGenericToIndexFieldAssignmentRoundTripsInLua"
  • ./gradlew test --tests "tests.wurstscript.tests.GenericsTests" --tests "tests.wurstscript.tests.LuaTranslationTests"

Closes #647

@Frotty
Frotty marked this pull request as ready for review August 2, 2026 18:20
@Frotty

Frotty commented Aug 2, 2026

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 👍

Reviewed commit: 1dfd5b79bf

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@Frotty
Frotty merged commit c865ba9 into master Aug 2, 2026
6 checks passed
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.

Cannot assign to generic fields with toIndex function

1 participant