I'm getting a compiler error, the Kotlin plugin is...
# intellij
j
I'm getting a compiler error, the Kotlin plugin is also struggling to syntax highlight.
Copy code
sealed class Permit<K> {

    companion object {
        operator fun <K> invoke(lookup : K, permission : Permissions) = FailedPermit(lookup, permission)
    }

    class FailedPermit<K>(val lookup : K, val permission : Permissions) : Permit<K>()

    fun orElse(closure : (K, Permissions) -> Unit) = when (this) {         //Dies on this line
        is FailedPermit -> closure(lookup, permission)
        else -> {}
    }
}
I've trimmed the code to just the necessary bits. Permissions is just a simple enum class.
Copy code
2020-03-17 23:23:21,834 [ 759312]  ERROR - aemon.impl.PassExecutorService - IntelliJ IDEA 2019.3.4  Build #IC-193.6911.18 
2020-03-17 23:23:21,834 [ 759312]  ERROR - aemon.impl.PassExecutorService - JDK: 11.0.6; VM: OpenJDK 64-Bit Server VM; Vendor: JetBrains s.r.o 
2020-03-17 23:23:21,835 [ 759313]  ERROR - aemon.impl.PassExecutorService - OS: Windows 10 
2020-03-17 23:23:21,835 [ 759313]  ERROR - aemon.impl.PassExecutorService - Plugin to blame: Kotlin version: 1.3.70-release-IJ2019.3-1 
2020-03-17 23:23:21,835 [ 759313]  ERROR - aemon.impl.PassExecutorService - Last Action: $Undo 
2020-03-17 23:23:21,835 [ 759313]  ERROR - aemon.impl.PassExecutorService - Kotlin resolution encountered a problem while analyzing KtCallExpression 
org.jetbrains.kotlin.idea.caches.resolve.KotlinIdeaResolutionException: Kotlin resolution encountered a problem while analyzing KtCallExpression
...
Caused by: org.jetbrains.kotlin.util.ReenteringLazyValueComputationException
d
The example works as soon as you explicitly declare the return type of
orElse
as
Unit
, but not before.
a
Yep, this is a frontend compiler exception, please report to http://kotl.in/issue. Thanks!
j
@Alexey Belkov [JB] Will do