rewrite icon indicating copy to clipboard operation
rewrite copied to clipboard

Assertions.validateTypes can falsely report a missing for a Kotlin method invocation

Open greg-dennis opened this issue 1 month ago • 1 comments

What version of OpenRewrite are you using?

I am using commit d9be625d432c78398b13070e60cdf6ff8d7a8628, an 8.69.0-SNAPSHOT

How are you running OpenRewrite?

Developing a new recipe in rewrite-testing-frameworks.

What is the smallest, simplest way to reproduce the problem?

  • Patch the test in this PR and run it. It should pass, and the equivalent test does pass if added to the rewrite repo.

What did you see instead?

The test fails because the type of the method invocation is determined to be null.

Are you interested in contributing a fix to OpenRewrite?

Yes.

I tracked it down to the FirFunctionCall having a calleeReference that is found to be a FirErrorNamedReference in PsiElementAssociations here. And a null type is apparently acknowledged as expected for some method invocations by KotlinTreeParseVisitor here.

greg-dennis avatar Dec 10 '25 00:12 greg-dennis

Figured this might be interesting to @Laurens-W given his ongoing work on

  • https://github.com/openrewrite/rewrite/pull/6393

timtebeek avatar Dec 10 '25 12:12 timtebeek