Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use abbreviation when returning arguments for a KSType #928

Merged
merged 3 commits into from
Apr 4, 2022

Conversation

yigit
Copy link
Collaborator

@yigit yigit commented Apr 3, 2022

This PR fixes a problem in KSType where it was not returning the right type arguments for TypeAliases.

For input:

typealias MyList = MyList<Int>
val x: MyList = TODO()

Querying the typeArguments of x would return [Int] while also returning its declaration as MyList.
This makes it looks like MyList<Int><Int>.
To fix it, I updated KSType.arguments to use the abbreviation type instead of the KotlinType.
Also, updated the test to add more cases and make it print the arguments for each type. I refactored the
test a bit to print types of properties instead of all found types to make the output more readable (happy to revert that part).

Fixes: #881
Test: typeAlias.kt

@yigit yigit requested a review from ting-yuan April 3, 2022 16:17
Copy link
Collaborator

@ting-yuan ting-yuan left a comment

Choose a reason for hiding this comment

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

Thank you soooo much!

@ting-yuan ting-yuan merged commit f64dce6 into google:main Apr 4, 2022
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.

KSP Processing order doesn't process room class first before typealias
2 participants