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

Unresolved references #302

Closed
GuilhE opened this issue Nov 20, 2024 · 3 comments
Closed

Unresolved references #302

GuilhE opened this issue Nov 20, 2024 · 3 comments

Comments

@GuilhE
Copy link

GuilhE commented Nov 20, 2024

This test will fail:

val code = """
    package com.mycomposable.test
        
    data class ViewState(val field: Int)
    
    @Composable
    fun ScreenA(state: ViewState) { }
""".trimIndent()

With Unresolved reference 'Composable' or any other I put in the test class. Can we somehow make it ignore the references? I was using tschuchort library and this was not an issue, only when I switched to yours. This happens with or without the ksp2 enabled.

Thanks!

@ZacSweers
Copy link
Owner

This is a library for testing compilations and that test does not compile. You need to import the composable annotation

@ZacSweers ZacSweers closed this as not planned Won't fix, can't repro, duplicate, stale Nov 20, 2024
@GuilhE
Copy link
Author

GuilhE commented Nov 20, 2024

When I add import androidx.compose.runtime.Composable it throws Unresolved reference for androidx. I have other tests where I import my custom annotations and it also throws unresolved. Example:

val code = """
            package com.mycomposable.test
            
            import $composeUIViewControllerStateAnnotationName 
            import androidx.compose.runtime.Composable
            
            private data class ViewState(val field: Int)
            
            @Composable
            private fun ScreenA(state: ViewState) { }
            
            @Composable
            private fun ScreenB(@ComposeUIViewControllerState state: ViewState) { }
        """.trimIndent()

all this imports fail.

This is a library for testing compilations and that test does not compile. You need to import the composable annotation

As far as I understand, this is a fork from the tschuchort (which is also a fork etc...) which is a testing compilation lib too, I had no problems related with Unresolved references when using these tests. Why did it stop working with your fork? Honest question.

@GuilhE
Copy link
Author

GuilhE commented Nov 20, 2024

Well, if I only compare the output files (generated) with what I expect, it works, as long as I don't assert the exitCode.

//assertEquals(KotlinCompilation.ExitCode.OK, result.exitCode)

Does it make sense ignore it? 🤔

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

No branches or pull requests

2 participants