I'm seeing very strange Scala compilation errors: ...
# general
m
I'm seeing very strange Scala compilation errors:
<none> inherits @experimental and therefore may only be used in an experimental scope.
This started happening without any changes to the Scala or pants version, and the project definitely doesn't use any experimental features (the same code compiles fine using gradle). With pants, if I run the build a second time after the error, it works. Doing a fresh build (on the CI), it fails consistently. This is with Scala 3.4.0/1, pants 2.19/20.
I think tracked it down to a commit going from Scala 3.3.1 to 3.4.0. Strangely, the test run of that commit didn't fail, but it did fail in subsequent runs, and reverting to 3.3.1 seems to stabilize the build.
h
Interesting. Is this a caching issue I wonder.
Some 3.3.1-generated bytecode being cached that confuses 3.4.0
m
Could be, I don't know enough about the caching system, but the failures happened on the CI which starts with an empty cache. Or perhaps some 3.4.0 internals have changed which pants relies on? It does look like something got corrupted, the error messages and line numbers make no sense.
I just noticed the compilation failures always happen in unit test code, which might be a hint. I'll try to disable the tests
h
Did you regenerate lockfiles after the scala upgrade?
m
Yes, I did. This bug seems very tricky, and it's not always reproducible, I'll stick with the older version of Scala for now, and revisit when I have more time.
Sometimes the logs show assertion errors from inside the Scala compiler, so it might even be a problem on another layer.
Copy code
java.lang.AssertionError: NoDenotation.owner
	at dotty.tools.dotc.core.SymDenotations$NoDenotation$.owner(SymDenotations.scala:2615)
	at dotty.tools.dotc.ast.tpd$.ref(tpd.scala:456)
	at dotty.tools.dotc.transform.SelectStatic.transformSelect(SelectStatic.scala:62)
🤯 1