Repository navigation
Drop unused declaring type and rename GenericType to GenericTypeResolver - #845
Merged
Merged
Conversation
Since type variables are resolved against the most specific type, the declaring type was only used in an error message. Fold RelativeTo into GenericType and stop passing a declaring type from the field resolvers. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Add ParameterizedType.isSubtypeOf and use it in TypeClassMatcher in place of GenericType.isTypeAssignableFromRawClass - Remove the isListType helpers in favor of the same check - Rename mostSpecificType to containingType and document unwrapGenericType
- Rename GenericType to GenericTypeResolver and unwrapGenericType to resolve - Rename the fields holding it to typeResolver Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Checklist
Description
Follow up to #825.
Since #825, type variables are resolved against the most specific type, so
RelativeTo.declaringTypewas only used in an error message. I foldedRelativeTointoGenericTypeand removedrelativeToPotentialParentandrelativeToType, so the field resolvers don't pass a declaring type anymore. Also removedgetGenericSuperTypeandgetGenericInterface, which weren't used.Some of the names didn't make much sense without the declaring type, so I renamed them too:
GenericType->GenericTypeResolver,unwrapGenericType->resolve, and the fields holding it ->typeResolvermostSpecificType->containingTypereplaceTypeVariable->resolveTypeVariablesisTypeAssignableFromRawClasswas named backwards (it checks if the type is a subtype of the class), so it's now aParameterizedType.isSubtypeOfextension and theisListTypehelpers are goneI also added a KDoc on
resolveexplaining what the "real" type is.Two error messages changed:
Could not resolve type variableno longer saysof <declaring type>.TypeUtils.toLongStringalready prints the class or method declaring the variable, so nothing is lost.Unable to find generic type of class ...is gone. It could only happen if a property's declaring class wasn't a superclass of the data class, and the scanner never finds a property like that.No other behaviour change. Existing tests pass.
🤖 Generated with Claude Code