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 attribution issue: missing types on Annotations of assignment operations. #511

Open
traceyyoshima opened this issue Dec 8, 2023 · 1 comment

Comments

@traceyyoshima
Copy link
Contributor

traceyyoshima commented Dec 8, 2023

Annotations on expressions += and -= will not contain an associated FIR element. The issue is caused by the compiler and is fixed in 1.9.20.

https://youtrack.jetbrains.com/issue/KT-62473

@traceyyoshima traceyyoshima changed the title Type attribution issue: on Annotations of assignment operations. Type attribution issue: missing types on Annotations of assignment operations. Dec 8, 2023
@nmck257
Copy link

nmck257 commented Dec 13, 2023

Hey @traceyyoshima - this might be a separate issue, but I'm seeing missing types on a variety of annotation usages (in 1.8.1):

All these fail for me:

@Test
void fmtConstructorParamAnnotation() {
    rewriteRun(
            spec -> spec.recipe(new FindMissingTypes()).parser(KotlinParser.builder().logCompilationWarningsAndErrors(true)),
            kotlin("""
                    import org.openrewrite.internal.lang.NonNull
                    
                    class Foo(
                        @NonNull val x: String
                    )
                    """
            ));
}

@Test
void fmtMethodParamAnnotation() {
    rewriteRun(
            spec -> spec.recipe(new FindMissingTypes()).parser(KotlinParser.builder().logCompilationWarningsAndErrors(true)),
            kotlin("""
                    import org.openrewrite.internal.lang.NonNull
                    
                    class Foo {
                        fun foo(@NonNull x: String) = ""
                    }
                    """
            ));
}

@Test
void fmtClassAnnotation() {
    rewriteRun(
            spec -> spec.recipe(new FindMissingTypes()).parser(KotlinParser.builder().logCompilationWarningsAndErrors(true)),
            kotlin("""
                    import org.openrewrite.internal.lang.NonNull
                    
                    @NonNull
                    class Foo
                    """
            ));
}

@timtebeek timtebeek moved this to Backlog in OpenRewrite May 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Backlog
Development

No branches or pull requests

3 participants