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

Type mapping revisions. #354

Merged
merged 9 commits into from
Nov 2, 2023
Merged

Type mapping revisions. #354

merged 9 commits into from
Nov 2, 2023

Conversation

traceyyoshima
Copy link
Contributor

Changes:

  • Parameterized types with generic bounds will retain the bounded type attribution.
    • Triple<A, B, C> (...) -> Triple(1,2,3) -> kotlin.Triple<kotlin.Int, kotlin.Int, kotlin.Int> instead of kotlin.Triple<Generic{A}, Generic{B}, Generic{C}>
  • TypeMapping:
    • Functions now accept FirElement(s) instead of FirSymbol(s)
    • Added support for various FirElements, which were not covered.
    • Cache the signatures early to prevent recalculations.
    • Added createShallowClass to reuse JavaType$ShallowClass types instead of duplication.
    • Filter out SOURCE retention annotations on JavaElement.
    • Updated signatures to match JavaTypeMapping.
    • FileFile is a default fallback in TypeMapping
  • PsiElementAssociations:
    • Fixed most of the PSI to FIR associations.
    • Moved association code from KotlinTreeParserVisitor to PsiElementAssociations.

Copy link
Contributor

@knutwannheden knutwannheden left a comment

Choose a reason for hiding this comment

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

This PR is very large. I haven't had time to review it all in detail, but I trust your judgement here, @traceyyoshima !

@traceyyoshima traceyyoshima force-pushed the base branch 2 times, most recently from e9e2392 to 8b8a7eb Compare November 1, 2023 19:42
@@ -510,6 +509,47 @@ public K.When visitWhen(K.When when, AtomicBoolean found) {
);
}

@Test
void operatorOverload() {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is a little odd -- the FIR associated with a KtBinaryExpression is the method invocation, so the K.BinaryType is a MethodType.

"n++,kotlin.Int",
"--n,kotlin.Int",
"n += a,kotlin.Int",
"n = a + b,kotlin.Int{name=plus,return=kotlin.Int,parameters=[kotlin.Int]}"
Copy link
Contributor Author

@traceyyoshima traceyyoshima Nov 1, 2023

Choose a reason for hiding this comment

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

The J.Binary has a method type instead of a boolean. The ParserVisitor should probably detect the non-overloaded method and assign the return type instead.

@traceyyoshima traceyyoshima marked this pull request as ready for review November 2, 2023 02:14
@traceyyoshima traceyyoshima merged commit 1c93f44 into main Nov 2, 2023
3 checks passed
@traceyyoshima traceyyoshima deleted the base branch November 2, 2023 02:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

2 participants