Sometimes IC raises compilation errors when rebuild succeeds.
This happens because IC uses serialized decriptors
for non-dirty files. Serialized descriptors can be different
from source file descriptors. For example, a source file
may contain an implicit return type or an implicit visibility
for overridden methods, but serialized descriptors always
contain explicit return types & methods' visibilities.
These problems can be solved by expanding a scope of incremental compilation
just after the analysis, but before error reporting & code generation.
In other words, we need to compare descriptors before error reporting and code generation.
If there are new dirty files, current round of IC must be aborted,
next round must be performed with new dirty files.
This commit implements IC scope expansion for JS Klib compiler
#KT-13677
#KT-28233
- enumMemberChanged, flagsAndMemberInSameClassChanged: added top level function results in a file class being generated
- companionObjectNameChanged: one more file is marked as dirty after the changes in build 1.2.70-dev-1439
Private-in-file declarations conflict with public overload-equivalent declarations
in other files in the same package.
Move functions for grouping possible redeclarations to OverloadResolver
(since they are used only there).
Refactor redeclarations / conflicting overloads reporting.
For diagnostics without any parameters, the given text is simply rendered as a
String, so no symbols should be escaped.
For diagnostics with parameters, the format in java.text.MessageFormat is used,
so one single quote is erased and two single quotes become one single quote in
the rendered text.
Skip declarations without sources in reporting, not when determining redeclaration groups:
this allows emitting informative diagnostics for incremental compilation.
Provide containing declaration with "kind", e.g., "package '<root>'", "class A", and so on.
When checking for overloads in package, consider functions and top-level class constructors as possibly conflicting between each other. NB OverloadUtil uses containing package scope from module descriptor.
Change diagnostic message for CONFLICTING_OVERLOAD: it's misleading in case of fun vs constructor conflict.
Add custom multifile test for diagnostics in IDE (probably not the best; should preprocess file content if it's required to check highlighting in multiple files, not only in the first file).
Add test for KT-10765 Incremental compilation misses overload conflict between constructor and function ...