I'm observing a weird behavior where IntelliJ does...
# intellij
p
I'm observing a weird behavior where IntelliJ doesn't report some symbols being not available, whereas the Kotlin compiler complains. See the project: https://github.com/krzema12/ko2py, I'm trying to run the tests from
compiler-plugin/ast/src/test/kotlin/python/ast/PythonAstTest.kt
, and (see the screenshot) the compiler reports
Unresolved reference ...
, and in the IDE I can normally navigate to the classes/functions that are unresolved according to the compiler. I've been banging my head for hours, it must be something small... on the other hand, looks like a bug in the compiler or the IDE, they should behave consistently, no?
1
what I checked: • case-sensitivity - I renamed
Python
to
python
, and it works the same way • I thought maybe
generated
is somewhere ignored (although not added to
.gitignore
), so renamed it to something neutral like
astprimitives
- the same problem
I noticed the little IntelliJ icons next to Gradle modules, but it's not a project that uses IntelliJ's build system, it's Gradle... can this symptom be helpful in figuring out what's wrong? I tried reloading the project from the root build.gradle.kts
:compiler-plugin:ast:classes
succeeds and produces some sane output:
I understood that IntelliJ actually behaves like I'd expect, and it may be a Gradle problem, so asked on #C19FD9681 as well
my next step is to check what compiler args are passed when compiling the tests
☝️ it doesn't on Linux, but does reproduce on MacOS: https://github.com/krzema12/ko2py/actions/runs/17897830054/job/50886827822
I'm fairly sure it's about case-insensitivity, and a clash between e.g.:
Copy code
data class Constant(val value: constant, val kind: string?)
and
Copy code
data class constant(val value: String)
I think they're compiled to the same .class file (i.e. with the same name if you assume case-insensitivity)
yeah, confirming it was the root cause - I just put the clashing names in their own Kotlin packages
it would be best to have some kind of warning in IntelliJ
2