Add error reporting on the options parsing errors in scripting
also report standard parsing warnings also fix language version test, since it is not possible anymore to use version 1.0
This commit is contained in:
+2
@@ -99,6 +99,8 @@ open class KJvmReplCompilerBase<AnalyzerT : ReplCodeAnalyzerBase> protected cons
|
||||
if (firstFailure != null)
|
||||
return firstFailure
|
||||
|
||||
if (messageCollector.hasErrors()) return failure(messageCollector)
|
||||
|
||||
if (history.isEmpty()) {
|
||||
val updatedConfiguration = ScriptDependenciesProvider.getInstance(context.environment.project)
|
||||
?.getScriptConfiguration(snippetKtFile)?.configuration
|
||||
|
||||
+5
-1
@@ -114,13 +114,17 @@ private fun compileImpl(
|
||||
)
|
||||
.valueOr { return it }
|
||||
|
||||
if (messageCollector.hasErrors()) return failure(messageCollector)
|
||||
|
||||
val (sourceFiles, sourceDependencies) = collectRefinedSourcesAndUpdateEnvironment(
|
||||
context,
|
||||
mainKtFile,
|
||||
messageCollector
|
||||
)
|
||||
|
||||
if (sourceDependencies.any { it.sourceDependencies is ResultWithDiagnostics.Failure }) return failure(messageCollector)
|
||||
if (messageCollector.hasErrors() || sourceDependencies.any { it.sourceDependencies is ResultWithDiagnostics.Failure }) {
|
||||
return failure(messageCollector)
|
||||
}
|
||||
|
||||
val dependenciesProvider = ScriptDependenciesProvider.getInstance(context.environment.project)
|
||||
val getScriptConfiguration = { ktFile: KtFile ->
|
||||
|
||||
+9
@@ -9,8 +9,10 @@ import com.intellij.openapi.Disposable
|
||||
import org.jetbrains.kotlin.cli.common.CLIConfigurationKeys
|
||||
import org.jetbrains.kotlin.cli.common.arguments.K2JVMCompilerArguments
|
||||
import org.jetbrains.kotlin.cli.common.arguments.parseCommandLineArguments
|
||||
import org.jetbrains.kotlin.cli.common.arguments.validateArguments
|
||||
import org.jetbrains.kotlin.cli.common.messages.CompilerMessageSeverity
|
||||
import org.jetbrains.kotlin.cli.common.messages.MessageCollector
|
||||
import org.jetbrains.kotlin.cli.common.reportArgumentParseProblems
|
||||
import org.jetbrains.kotlin.cli.common.setupCommonArguments
|
||||
import org.jetbrains.kotlin.cli.jvm.*
|
||||
import org.jetbrains.kotlin.cli.jvm.compiler.EnvironmentConfigFiles
|
||||
@@ -165,6 +167,13 @@ private fun CompilerConfiguration.updateWithCompilerOptions(
|
||||
val compilerArguments = K2JVMCompilerArguments()
|
||||
parseCommandLineArguments(compilerOptions, compilerArguments)
|
||||
|
||||
validateArguments(compilerArguments.errors)?.let {
|
||||
messageCollector.report(CompilerMessageSeverity.ERROR, it)
|
||||
return
|
||||
}
|
||||
|
||||
messageCollector.reportArgumentParseProblems(compilerArguments)
|
||||
|
||||
reportArgumentsIgnoredGenerally(
|
||||
compilerArguments,
|
||||
messageCollector,
|
||||
|
||||
Reference in New Issue
Block a user