Since the compile function was designed to serialize the CompilationUnit, if there is at least one error before serialization, the function must throw an error. However, due to technical reasons, we must serialize the CompilationUnit before calling CompilationUnit.resolveAndValidate, which means we might miss information about unresolved data reference errors.
To address this issue, the compile function has been refactored. If the out parameter is passed as null, it indicates that the method is being used solely for syntax checking. In this case, all errors, including unresolved data references, will be reported before the function throws the final error.
Checklist:
[X] There are tests for this feature.
[X] The code follows Kotlin conventions (run ./gradlew ktlintCheck).
[X] The code passes all tests (run ./gradlew check).
[ ] There is specific documentation in the docs directory.
Description
Since the
compile
function was designed to serialize theCompilationUnit
, if there is at least one error before serialization, the function must throw an error. However, due to technical reasons, we must serialize theCompilationUnit
before callingCompilationUnit.resolveAndValidate
, which means we might miss information about unresolved data reference errors.To address this issue, the
compile
function has been refactored. If theout
parameter is passed asnull
, it indicates that the method is being used solely for syntax checking. In this case, all errors, including unresolved data references, will be reported before the function throws the final error.Checklist:
./gradlew ktlintCheck
)../gradlew check
).docs
directory.