Skip to content

Fix inherited type member refinement subtype checks - #596

Open
HubeCrew wants to merge 1 commit into
zio:developfrom
HubeCrew:fix-481-inherited-type-member-refinements
Open

Fix inherited type member refinement subtype checks#596
HubeCrew wants to merge 1 commit into
zio:developfrom
HubeCrew:fix-481-inherited-type-member-refinements

Conversation

@HubeCrew

Copy link
Copy Markdown

Fixes #481.

This updates full inheritance DB generation so concrete subclasses that resolve inherited abstract type members are also represented as children of the corresponding refined parent type.

For example:

  • Issue481AInt <: Issue481A { type T = Int }
  • Issue481AString <: Issue481A { type T = String }
  • Issue481AInt <: Issue481A { type T <: AnyVal }
  • Issue481AString !<:< Issue481A { type T <: AnyVal }

The implementation covers both Scala 2 and Scala 3 tag generation. It only synthesizes refined parent edges for abstract/deferred type members declared by base types, keeping the added inheritance DB entries scoped to the relevant case.

Tested:

  • Scala 3: izumi-reflectJVM / Test / testOnly izumi.reflect.test.LightTypeTagTest
  • Scala 2.13.14: ++2.13.14; izumi-reflectJVM / Test / testOnly izumi.reflect.test.LightTypeTagTest
  • Scala 2.12.20: ++2.12.20; izumi-reflectJVM / Test / testOnly izumi.reflect.test.LightTypeTagTest
  • Scala 2.11.12: ++2.11.12; izumi-reflectJVM / Test / testOnly izumi.reflect.test.LightTypeTagTest

Also verified with git diff --check.

@CLAassistant

CLAassistant commented May 11, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@HubeCrew

Copy link
Copy Markdown
Author

Note: I saw #579 also addresses #481 with a similar synthetic refined-parent approach.

This PR adds coverage for bounded inherited type-member refinements as well, specifically:

  • Issue481AInt <: Issue481A { type T <: AnyVal }
  • Issue481AString !<:< Issue481A { type T <: AnyVal }

It also narrows the synthesized refinement generation to abstract/deferred type members declared by base types to avoid broad tag-size growth.

@HubeCrew

Copy link
Copy Markdown
Author

CLA is now signed.

I also checked the failed build jobs. They appear to fail before running the Scala build because GitHub blocks carabiner-dev/actions/ampel/verify under the repository allowed-actions policy:

The action carabiner-dev/actions/ampel/verify@... is not allowed in zio/izumi-reflect

I attempted to rerun failed jobs after the CLA passed, but GitHub reports the workflow cannot be rerun, likely because of that workflow/action policy issue.

Local validation passed for:

  • Scala 3 LightTypeTagTest
  • Scala 2.13.14 LightTypeTagTest
  • Scala 2.12.20 LightTypeTagTest
  • Scala 2.11.12 LightTypeTagTest
  • git diff --check

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.

Subtype relation for refined type fails

2 participants