Open najder-k opened 2 years ago
It seems that there is a problem with com.avsystem.scex.compiler.ScexCompiler.Reporter#errorsBuilder
and the fact that errors are cleared both by scex code and the Scala Presentation Compiler code (scala.tools.nsc.interactive.Global#backgroundCompile
) by calling reporter.reset()
. The latter runs arbitrarily and sometimes interferes with accumulated errors and clears them.
Since I didn't find any direct connection between cache/getterAdapters and errorsBuilder
I assume they affect validation time and thus contribute to different results.
Workaround is presented here: https://github.com/AVSystem/scex/pull/36
Example code:
This code tries to check for errors on the same invalid expression 1000 times (with added spaces to avoid hitting the cache). The number and order of FPs is nondeterministic, and seems to get higher the longer the code runs, e.g. for 1k times it's around 50-70%:
But for 100 times it's between 10-30%:
It seems to not happen with either setting the
noGetterAdapters = true
in ScexSettings, or when using aScexCompiler
withoutCachingScexCompiler
mixed in, even though those seem to be completely unrelated.Some other findings:
s"missingSymbol$i"
)profileCompilationResultsCache
andjavaGetterAdaptersCache
. With either of them being removed, and the rest of caches still in place, there are no more FPsScexPresentationCompiler#Completer.workaroundAssertionError
looks like the culprit, but it doesn't affect this at all