When using scratch files, this code does not work even though it does not show any issue in the code editor in IntelliJ:
import Scratch_2.MyEnum.*
enum class MyEnum {
WORD, NUMBER, WHITESPACE
}
val myPairs = listOf(
"example" to WORD,
"42" to NUMBER,
" " to WHITESPACE
)
println(myPairs)
It does not work because of the import on line 1.
Unresolved reference: Scratch_2
(note that I use
Scratch_n
where n is whatever IntelliJ suggests in the autocompletion menu)
If I replace the first line by
import MyEnum.*
directly, then the error is
Unresolved reference: MyEnum
The only way of making this code work is by removing the import and specifying
MyEnum
every time. Is there any way to make this work?