-
Notifications
You must be signed in to change notification settings - Fork 15
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
Conversation
There was a problem hiding this 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 !
src/main/java/org/openrewrite/kotlin/internal/KotlinTreeParserVisitor.java
Show resolved
Hide resolved
e9e2392
to
8b8a7eb
Compare
@@ -510,6 +509,47 @@ public K.When visitWhen(K.When when, AtomicBoolean found) { | |||
); | |||
} | |||
|
|||
@Test | |||
void operatorOverload() { |
There was a problem hiding this comment.
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]}" |
There was a problem hiding this comment.
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.
Fixed alias type. Updated method invocation types to retain parameterized type attribution to match java. Updated method invocation signatures to match method type logic.
Changes:
Triple<A, B, C> (...)
->Triple(1,2,3)
->kotlin.Triple<kotlin.Int, kotlin.Int, kotlin.Int>
instead ofkotlin.Triple<Generic{A}, Generic{B}, Generic{C}>
FirElement
(s) instead ofFirSymbol
(s)createShallowClass
to reuseJavaType$ShallowClass
types instead of duplication.SOURCE
retention annotations onJavaElemen
t.JavaTypeMapping
.FileFile
is a default fallback inTypeMapping
KotlinTreeParserVisitor
toPsiElementAssociations
.