I'm trying to upgrade my plugin from 1.9.10 to 2.0...
# compiler
t
I'm trying to upgrade my plugin from 1.9.10 to 2.0.0-RC2. In my test cases I get this error, have anyone seen something like this? If there is any available information about how to upgrade, please let me know. Thanks in advance.
com.intellij.rt.execution.junit.FileComparisonFailure: Actual data differs from file content:
Copy code
fun Adaptive.higherFun(higherI: Int, lowerFun: Adaptive.(lowerFunI: Int) -> Unit) {
    higherFunInner(higherI * 2) { lowerFunInnerI ->
        lowerFun(higherI + lowerFunInnerI)
    }
}
Copy code
fun Adaptive.higherFun(higherI: Int, lowerFun: Adaptive.(lowerFunI: Int) -> Unit) {
    higherFunInner(higherI <!MISSING_DEPENDENCY_SUPERCLASS!>*<!> 2) { lowerFunInnerI ->
        lowerFun(higherI <!MISSING_DEPENDENCY_SUPERCLASS!>+<!> lowerFunInnerI)
    }
}
d
You didn't provide some dependency to the test runtime classpath
t
The error is for the multiply operator between two integers. All I did was to change Kotlin version from 1.9.10 to 2.0.0-RC2. On 1.9.10 everything works well.
d
You can add
("")
to the diagnostic in the testdata and rerun the test to see what exact class is missing
Copy code
<!MISSING_DEPENDENCY_SUPERCLASS!("")>*<!> 2
t
Thank you, I'll try that.
Hm... I can't add the
("")
. This test is not a diagnostic test but a box test that is supposed to be successful. Actually, I get the
fir.ir.txt
and
ir.txt
files generated and they do not contain this missing dependency line. But when I run the test it fails with (in this case it is String.startsWith):
Copy code
Actual data differs from file content: basic.kt
<Click to see difference>

com.intellij.rt.execution.junit.FileComparisonFailure: Actual data differs from file content: basic.kt expected:<...return if (response.[startsWith("i:1 s:hello BasicServiceContext(")) "OK" else "Fail (response=$response)"
}]> but was:<...return if (response.[<!MISSING_DEPENDENCY_SUPERCLASS!>startsWith<!>("i:1 s:hello BasicServiceContext(")) "OK" else "Fail (response=$response)"
}
]>
	at org.jetbrains.kotlin.test.services.JUnit5Assertions.assertEqualsToFile(JUnit5Assertions.kt:74)
	at org.jetbrains.kotlin.test.services.JUnit5Assertions.assertEqualsToFile(JUnit5Assertions.kt:28)
d
You can apply te diff with diagnostic to the file even for box tests (temporary) Or create similar diagnostics test
Regarding the issue: K2 compiler become more strict in reporting about missing dependencies
t
I can understand that, but these are the very basic Kotlin operators, like multiplying two integers. Hm: • cloned https://github.com/demiurg906/kotlin-compiler-plugin-template.git • run tests, all OK • changed it Kotlin to 2.0.0-RC2 • run tests, all OK • changed
testData/box/simple.kt
(result == "Hello world")
to
result.startsWith("Hello world")
• run tests, simple fails with:
Copy code
Multiple Failures (2 failures)
	com.intellij.rt.execution.junit.FileComparisonFailure: Content is not equal: simple.fir.txt expected:<...en () {
            [==(R|<local>/result|, ]String(Hello world))...> but was:<...en () {
            [R|<local>/result|.R|kotlin/text/startsWith|(]String(Hello world))...>
	com.intellij.rt.execution.junit.FileComparisonFailure: Actual data differs from file content: simple.fir.ir.txt
<Click to see difference>
d
I'll check it tomorrow
t
Ok, thank you, have a nice evening.
d
I've checked, the tests fails as expected, as both dumps were changed IDEA doesn't show it nicely, as two file diff assertions is too much for it, but if you remove both dumps and rerun the test, you'll see updated dumps
t
Yes, that's my bad, I haven't noticed the generated files (I don't generate them by default). I've noticed you have a
// WITH_STDLIB
in the first line of the file, I don't have that. I tried to add it but the error is still there. I use
useCustomRuntimeClasspathProviders
to add the shadow jar file I generate with the base library, probably that's not compatible with the changes in the compiler. I'll try to figure out what's wrong with that. Thx for the help.
Oh, it wasn't the custom provider, this was the missing part from
BaseTestRunner
:
Copy code
+ JvmEnvironmentConfigurationDirectives.FULL_JDK
👍 1