Do I need to enable a flag to use `MutableList.rem...
# stdlib
m
Do I need to enable a flag to use
MutableList.removeLast
? The IDE finds it but I get an error at compile time:
Unresolved reference: removeLast
. I'm using Kotlin 1.4.10 (And Happy New Year !! 🎉 🌟 )
l
The compiler? Or the IDE?
m
IDE is fine, compiler doesn't see the "new" 1.4 symbols
l
Can you show your
plugins { }
from the
build.gradle.kts
file of the affected module?
We do have a setup where the plugin are added to the buildscript classpath through buildSrc dependencies: https://github.com/apollographql/apollo-android/blob/d59f2a1b07c62b7094a8ecfd56dd57fe5f89cd63/buildSrc/build.gradle.kts#L25
Maybe that can explain things
Interestinglly, typing
./gradlew buildEnvironment
outputs:
Copy code
classpath
No dependencies
🤔
l
Is auto-stdlib dependency from Kotlin 1.4 disabled explicitly somehow?
m
No that I know
The dependencies show ok in ./gradle dependencies
l
If you add the stdlib dependency explicitly for the JVM, does compilation still fail?
m
I'll try that as soon as my Gradle test finish running 😅
Same thing by adding the stdlib explicitely
Ah ! got it. We have a
-api-version 1.3
compiler flag to make sure the plugin doesn't use any 1.4 symbol when used with Gradle < 6.8🤦‍♂️
Thanks for the help !!
l
I think even 6.8 is on Kotlin 1.3
And 7.0 is on Kotlin 1.4
m
😕
Will have to wait a bit more then...
l
So, the problem is that the IDE doesn't take into consideration the compiler flag that sets the language level
m
Yep
Good point, I'll write a bug report
l
Should it show an underline error telling you that it's not possible because of the flag or should it simply show an unresolved reference and not show it in autocomplete at all in the first place?
m
I'd vote for underlining
This way you know what' you're missing
In my case, this is a reminder that I should remove the flag once Gradle uses 1.4
Else, I'll be missing on
removeLast
potentially forever!
So... I made a small reproducer and the IDE picks up
apiVersion="1.3"
and does not resolve the symbols....
So there must be something else in my configuration that confuses IntelliJ
l
Since your project is open source, you already have a reproducer you can permalink to by pressing the key Y to change the url to commit sha.
l
So you finally could reproduce it?
Oh, it only affects multiplatform modules, I see.
m
Yep