From ec5aed82af37ab55bb8601ffe8e319e4fa2850b0 Mon Sep 17 00:00:00 2001 From: Svetlana Isakova Date: Thu, 7 Jun 2012 18:28:37 +0400 Subject: [PATCH] KT-2207 Syntax errors are not reported from the compiler #KT-2207 fixed --- .../cli/common/messages/AnalyzerWithCompilerReport.java | 5 +++++ .../data/syntaxErrors/test.compile.expected | 3 +++ compiler/integration-tests/data/syntaxErrors/test.kt | 5 +++++ .../src/org/jetbrains/kotlin/CompilerSmokeTest.java | 7 +++++++ 4 files changed, 20 insertions(+) create mode 100644 compiler/integration-tests/data/syntaxErrors/test.compile.expected create mode 100644 compiler/integration-tests/data/syntaxErrors/test.kt diff --git a/compiler/cli/src/org/jetbrains/jet/cli/common/messages/AnalyzerWithCompilerReport.java b/compiler/cli/src/org/jetbrains/jet/cli/common/messages/AnalyzerWithCompilerReport.java index 35eac40657b..4317e34f4d4 100644 --- a/compiler/cli/src/org/jetbrains/jet/cli/common/messages/AnalyzerWithCompilerReport.java +++ b/compiler/cli/src/org/jetbrains/jet/cli/common/messages/AnalyzerWithCompilerReport.java @@ -148,5 +148,10 @@ public final class AnalyzerWithCompilerReport { super(psiElement, SYNTAX_ERROR_FACTORY, severity); this.message = message; } + + @Override + public boolean isValid() { + return true; + } } } diff --git a/compiler/integration-tests/data/syntaxErrors/test.compile.expected b/compiler/integration-tests/data/syntaxErrors/test.compile.expected new file mode 100644 index 00000000000..9e7cf8182e1 --- /dev/null +++ b/compiler/integration-tests/data/syntaxErrors/test.compile.expected @@ -0,0 +1,3 @@ +OUT ERROR: [TestData]/test.kt: (4, 20) Expecting an element +ERR exec() finished with COMPILATION_ERROR return code +Return code: 1 diff --git a/compiler/integration-tests/data/syntaxErrors/test.kt b/compiler/integration-tests/data/syntaxErrors/test.kt new file mode 100644 index 00000000000..0eeb58e4bb9 --- /dev/null +++ b/compiler/integration-tests/data/syntaxErrors/test.kt @@ -0,0 +1,5 @@ +package test + +fun test() { + val s = System.in +} \ No newline at end of file diff --git a/compiler/integration-tests/src/org/jetbrains/kotlin/CompilerSmokeTest.java b/compiler/integration-tests/src/org/jetbrains/kotlin/CompilerSmokeTest.java index 34deca34016..0d3a34cd3ba 100644 --- a/compiler/integration-tests/src/org/jetbrains/kotlin/CompilerSmokeTest.java +++ b/compiler/integration-tests/src/org/jetbrains/kotlin/CompilerSmokeTest.java @@ -51,6 +51,13 @@ public class CompilerSmokeTest extends KotlinIntegrationTestBase { runCompiler("hello.compile", "-src", "hello.kt", "-jar", jar); } + @Test + public void syntaxErrors() throws Exception { + final String jar = tempDir.getAbsolutePath() + File.separator + "smoke.jar"; + + runCompiler("test.compile", "-src", "test.kt", "-jar", jar); + } + @Test public void script() throws Exception { runCompiler("script", "-script", "hello.ktscript", "hi", "there");