Skip to content

Correctly type check Class<T>#1698

Draft
HT154 wants to merge 1 commit into
apple:mainfrom
HT154:class-no-erasure
Draft

Correctly type check Class<T>#1698
HT154 wants to merge 1 commit into
apple:mainfrom
HT154:class-no-erasure

Conversation

@HT154

@HT154 HT154 commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

Ref apple/pkl-intellij#222, depends on #1715.

This PR removes the unconditional type-erasure of Class<T> to Class.

This is a breaking change when T is a union type, nullable type, string literal type, parameterized type, type alias, or nothing; these are now error conditions.

For convenience, erasure still occurs when T is unknown or Any. Similarly, the subclass check is skipped when T is an un-replaced type variable, e.g. in generic classes/methods (type aliases replace the type arg during instantiation).

@HT154 HT154 force-pushed the class-no-erasure branch 9 times, most recently from 7c64e69 to 5adcbf7 Compare June 27, 2026 20:26
@HT154 HT154 force-pushed the class-no-erasure branch 2 times, most recently from c2f4029 to d31129f Compare June 27, 2026 21:33
@HT154 HT154 force-pushed the class-no-erasure branch from d31129f to 20e15db Compare June 28, 2026 22:44
@HT154 HT154 force-pushed the class-no-erasure branch 3 times, most recently from 4db0cdc to 17b645c Compare June 30, 2026 06:59
@HT154 HT154 force-pushed the class-no-erasure branch from 17b645c to bfb8210 Compare June 30, 2026 19:36
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.

1 participant