From 7fa93c4e9036f108f7542e25563b64110f506a45 Mon Sep 17 00:00:00 2001 From: Stanislav Erokhin Date: Tue, 18 Nov 2014 16:48:12 +0300 Subject: [PATCH] Added support space symbols for diagnostic parameters in DiagnosticTest --- .../src/org/jetbrains/jet/checkers/CheckerTestUtil.java | 4 ++-- .../diagnostics/checkerTestUtil/test_with_diagnostic.kt | 4 ++++ .../diagnostics/checkerTestUtil/test_with_diagnostic.txt | 9 ++++++++- 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/compiler/frontend/src/org/jetbrains/jet/checkers/CheckerTestUtil.java b/compiler/frontend/src/org/jetbrains/jet/checkers/CheckerTestUtil.java index fd2adc9a681..125a0414b99 100644 --- a/compiler/frontend/src/org/jetbrains/jet/checkers/CheckerTestUtil.java +++ b/compiler/frontend/src/org/jetbrains/jet/checkers/CheckerTestUtil.java @@ -74,7 +74,7 @@ public class CheckerTestUtil { }; private static final String IGNORE_DIAGNOSTIC_PARAMETER = "IGNORE"; - private static final String DIAGNOSTIC_PARAMETER = "[^\\)\\(\\s;]+"; + private static final String DIAGNOSTIC_PARAMETER = "[^\\)\\(;]+"; private static final String INDIVIDUAL_DIAGNOSTIC = "(\\w+)(\\(" + DIAGNOSTIC_PARAMETER + "(;\\s*" + DIAGNOSTIC_PARAMETER + ")*\\))?"; private static final Pattern RANGE_START_OR_END_PATTERN = Pattern.compile("( parsedParameters = new SmartList(); Matcher parametersMatcher = INDIVIDUAL_PARAMETER_PATTERN.matcher(parameters); while (parametersMatcher.find()) - parsedParameters.add(parametersMatcher.group()); + parsedParameters.add(parametersMatcher.group().trim()); return new TextDiagnostic(name, parsedParameters); } diff --git a/compiler/testData/diagnostics/checkerTestUtil/test_with_diagnostic.kt b/compiler/testData/diagnostics/checkerTestUtil/test_with_diagnostic.kt index b58374ab28e..781f16efae5 100644 --- a/compiler/testData/diagnostics/checkerTestUtil/test_with_diagnostic.kt +++ b/compiler/testData/diagnostics/checkerTestUtil/test_with_diagnostic.kt @@ -1,9 +1,13 @@ +trait Pa + fun foo(u : Unit) : Int = 1 +fun bas(u : Pa) = 3 fun test() : Int { foo(1) val a : () -> Unit = { foo(1) + bas()!>1) } return 1 - "1" } diff --git a/compiler/testData/diagnostics/checkerTestUtil/test_with_diagnostic.txt b/compiler/testData/diagnostics/checkerTestUtil/test_with_diagnostic.txt index 356134fb893..b93ec997487 100644 --- a/compiler/testData/diagnostics/checkerTestUtil/test_with_diagnostic.txt +++ b/compiler/testData/diagnostics/checkerTestUtil/test_with_diagnostic.txt @@ -1,5 +1,6 @@ package +internal fun bas(/*0*/ u: Pa): kotlin.Int internal fun foo(/*0*/ u: kotlin.Unit): kotlin.Int internal fun foo1(): kotlin.Unit internal fun test(): kotlin.Int @@ -10,4 +11,10 @@ internal final class A { public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String -} \ No newline at end of file +} + +internal trait Pa { + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +}