diff --git a/compiler/frontend/src/org/jetbrains/kotlin/checkers/CheckerTestUtil.java b/compiler/frontend/src/org/jetbrains/kotlin/checkers/CheckerTestUtil.java index 3d7b9e29866..4c05fdf6020 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/checkers/CheckerTestUtil.java +++ b/compiler/frontend/src/org/jetbrains/kotlin/checkers/CheckerTestUtil.java @@ -34,6 +34,7 @@ import kotlin.Pair; import kotlin.TuplesKt; import kotlin.collections.CollectionsKt; import kotlin.jvm.functions.Function1; +import kotlin.text.StringsKt; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import org.jetbrains.kotlin.descriptors.DeclarationDescriptor; @@ -48,6 +49,7 @@ import org.jetbrains.kotlin.psi.KtExpression; import org.jetbrains.kotlin.psi.KtReferenceExpression; import org.jetbrains.kotlin.resolve.AnalyzingUtils; import org.jetbrains.kotlin.resolve.BindingContext; +import org.jetbrains.kotlin.resolve.MultiTargetPlatform; import org.jetbrains.kotlin.util.slicedMap.WritableSlice; import java.util.*; @@ -84,7 +86,7 @@ public class CheckerTestUtil { private static final String IGNORE_DIAGNOSTIC_PARAMETER = "IGNORE"; private static final String SHOULD_BE_ESCAPED = "\\)\\(;"; private static final String DIAGNOSTIC_PARAMETER = "(?:(?:\\\\[" + SHOULD_BE_ESCAPED + "])|[^" + SHOULD_BE_ESCAPED + "])+"; - private static final String INDIVIDUAL_DIAGNOSTIC = "(\\w+)(\\(" + DIAGNOSTIC_PARAMETER + "(;\\s*" + DIAGNOSTIC_PARAMETER + ")*\\))?"; + private static final String INDIVIDUAL_DIAGNOSTIC = "(\\w+:)?(\\w+)(\\(" + DIAGNOSTIC_PARAMETER + "(;\\s*" + DIAGNOSTIC_PARAMETER + ")*\\))?"; private static final Pattern RANGE_START_OR_END_PATTERN = Pattern.compile("()|()"); @@ -94,23 +96,57 @@ public class CheckerTestUtil { @NotNull public static List getDiagnosticsIncludingSyntaxErrors( @NotNull BindingContext bindingContext, + @NotNull List> implementingModulesBindings, @NotNull PsiElement root, boolean markDynamicCalls, @Nullable List dynamicCallDescriptors + ) { + List result = + getDiagnosticsIncludingSyntaxErrors(bindingContext, root, markDynamicCalls, dynamicCallDescriptors, null); + + List> sortedBindings = CollectionsKt.sortedWith( + implementingModulesBindings, + new Comparator>() { + @Override + public int compare(Pair o1, Pair o2) { + return o1.getFirst().compareTo(o2.getFirst()); + } + } + ); + + for (Pair binding : sortedBindings) { + MultiTargetPlatform platform = binding.getFirst(); + assert platform instanceof MultiTargetPlatform.Specific : "Implementing module must have a specific platform: " + platform; + + result.addAll(getDiagnosticsIncludingSyntaxErrors( + binding.getSecond(), root, markDynamicCalls, dynamicCallDescriptors, + ((MultiTargetPlatform.Specific) platform).getPlatform() + )); + } + + return result; + } + + @NotNull + public static List getDiagnosticsIncludingSyntaxErrors( + @NotNull BindingContext bindingContext, + @NotNull PsiElement root, + boolean markDynamicCalls, + @Nullable List dynamicCallDescriptors, + @Nullable String platform ) { List diagnostics = new ArrayList(); for (Diagnostic diagnostic : bindingContext.getDiagnostics().all()) { if (PsiTreeUtil.isAncestor(root, diagnostic.getPsiElement(), false)) { - diagnostics.add(new ActualDiagnostic(diagnostic)); + diagnostics.add(new ActualDiagnostic(diagnostic, platform)); } } for (PsiErrorElement errorElement : AnalyzingUtils.getSyntaxErrorRanges(root)) { - diagnostics.add(new ActualDiagnostic(new SyntaxErrorDiagnostic(errorElement))); + diagnostics.add(new ActualDiagnostic(new SyntaxErrorDiagnostic(errorElement), platform)); } - List debugAnnotations = getDebugInfoDiagnostics(root, bindingContext, markDynamicCalls, dynamicCallDescriptors); - diagnostics.addAll(debugAnnotations); + diagnostics.addAll(getDebugInfoDiagnostics(root, bindingContext, markDynamicCalls, dynamicCallDescriptors, platform)); return diagnostics; } @@ -120,7 +156,8 @@ public class CheckerTestUtil { @NotNull PsiElement root, @NotNull BindingContext bindingContext, final boolean markDynamicCalls, - @Nullable final List dynamicCallDescriptors + @Nullable final List dynamicCallDescriptors, + @Nullable final String platform ) { final List debugAnnotations = new ArrayList(); @@ -152,7 +189,7 @@ public class CheckerTestUtil { } private void newDiagnostic(KtElement element, DebugInfoDiagnosticFactory factory) { - debugAnnotations.add(new ActualDiagnostic(new DebugInfoDiagnostic(element, factory))); + debugAnnotations.add(new ActualDiagnostic(new DebugInfoDiagnostic(element, factory), platform)); } }); @@ -167,7 +204,7 @@ public class CheckerTestUtil { )) { for (KtExpression expression : bindingContext.getSliceContents(factory.getFirst()).keySet()) { if (PsiTreeUtil.isAncestor(root, expression, false)) { - debugAnnotations.add(new ActualDiagnostic(new DebugInfoDiagnostic(expression, factory.getSecond()))); + debugAnnotations.add(new ActualDiagnostic(new DebugInfoDiagnostic(expression, factory.getSecond()), platform)); } } } @@ -267,7 +304,7 @@ public class CheckerTestUtil { actualDiagnostics.entrySet(), new Function1, Boolean>() { @Override public Boolean invoke(Map.Entry entry) { - return expectedDiagnostic.getName().equals(entry.getValue().getName()); + return expectedDiagnostic.getDescription().equals(entry.getValue().getDescription()); } } ); @@ -294,7 +331,7 @@ public class CheckerTestUtil { } private static boolean compareTextDiagnostic(@NotNull TextDiagnostic expected, @NotNull TextDiagnostic actual) { - if (!expected.getName().equals(actual.getName())) return false; + if (!expected.getDescription().equals(actual.getDescription())) return false; if (expected.getParameters() == null) return true; if (actual.getParameters() == null || expected.getParameters().size() != actual.getParameters().size()) return false; @@ -461,6 +498,10 @@ public class CheckerTestUtil { } } else { + if (diagnostic.platform != null) { + result.append(diagnostic.platform); + result.append(":"); + } result.append(diagnostic.getName()); } if (iterator.hasNext()) { @@ -633,9 +674,11 @@ public class CheckerTestUtil { public static class ActualDiagnostic { public final Diagnostic diagnostic; + public final String platform; - ActualDiagnostic(@NotNull Diagnostic diagnostic) { + ActualDiagnostic(@NotNull Diagnostic diagnostic, @Nullable String platform) { this.diagnostic = diagnostic; + this.platform = platform; } @NotNull @@ -650,18 +693,22 @@ public class CheckerTestUtil { @Override public boolean equals(Object obj) { + if (!(obj instanceof ActualDiagnostic)) return false; + + ActualDiagnostic other = (ActualDiagnostic) obj; // '==' on diagnostics is intentional here - return obj instanceof ActualDiagnostic && ((ActualDiagnostic) obj).diagnostic == diagnostic; + return other.diagnostic == diagnostic && + (other.platform == null ? platform == null : other.platform.equals(platform)); } @Override public int hashCode() { - return System.identityHashCode(diagnostic); + return System.identityHashCode(diagnostic) * 31 + (platform != null ? platform.hashCode() : 0); } @Override public String toString() { - return diagnostic.toString(); + return (platform != null ? platform + ":" : "") + diagnostic.toString(); } } @@ -671,18 +718,22 @@ public class CheckerTestUtil { Matcher matcher = INDIVIDUAL_DIAGNOSTIC_PATTERN.matcher(text); if (!matcher.find()) throw new IllegalArgumentException("Could not parse diagnostic: " + text); - String name = matcher.group(1); - String parameters = matcher.group(2); + String platformPrefix = matcher.group(1); + assert platformPrefix == null || platformPrefix.endsWith(":") : platformPrefix; + String platform = platformPrefix == null ? null : StringsKt.substringBeforeLast(platformPrefix, ":", platformPrefix); + + String name = matcher.group(2); + String parameters = matcher.group(3); if (parameters == null) { - return new TextDiagnostic(name, null); + return new TextDiagnostic(name, platform, null); } List parsedParameters = new SmartList(); Matcher parametersMatcher = INDIVIDUAL_PARAMETER_PATTERN.matcher(parameters); while (parametersMatcher.find()) parsedParameters.add(unescape(parametersMatcher.group().trim())); - return new TextDiagnostic(name, parsedParameters); + return new TextDiagnostic(name, platform, parsedParameters); } private static @NotNull String escape(@NotNull String s) { @@ -708,24 +759,32 @@ public class CheckerTestUtil { return o != null ? o.toString() : "null"; } }); - return new TextDiagnostic(diagnosticName, parameters); + return new TextDiagnostic(diagnosticName, actualDiagnostic.platform, parameters); } - return new TextDiagnostic(diagnosticName, null); + return new TextDiagnostic(diagnosticName, actualDiagnostic.platform, null); } @NotNull private final String name; @Nullable + private final String platform; + @Nullable private final List parameters; - public TextDiagnostic(@NotNull String name, @Nullable List parameters) { + public TextDiagnostic(@NotNull String name, @Nullable String platform, @Nullable List parameters) { this.name = name; + this.platform = platform; this.parameters = parameters; } + @Nullable + public String getPlatform() { + return platform; + } + @NotNull - public String getName() { - return name; + public String getDescription() { + return (platform != null ? platform + ":" : "") + name; } @Nullable @@ -741,6 +800,7 @@ public class CheckerTestUtil { TextDiagnostic that = (TextDiagnostic) o; if (!name.equals(that.name)) return false; + if (platform != null ? !platform.equals(that.platform) : that.platform != null) return false; if (parameters != null ? !parameters.equals(that.parameters) : that.parameters != null) return false; return true; @@ -749,20 +809,30 @@ public class CheckerTestUtil { @Override public int hashCode() { int result = name.hashCode(); + result = 31 * result + (platform != null ? platform.hashCode() : 0); result = 31 * result + (parameters != null ? parameters.hashCode() : 0); return result; } @NotNull public String asString() { - if (parameters == null) - return name; - return name + '(' + StringUtil.join(parameters, new Function() { - @Override - public String fun(String s) { - return escape(s); - } - }, "; ") + ')'; + StringBuilder result = new StringBuilder(); + if (platform != null) { + result.append(platform); + result.append(":"); + } + result.append(name); + if (parameters != null) { + result.append("("); + result.append(StringUtil.join(parameters, new Function() { + @Override + public String fun(String s) { + return escape(s); + } + }, "; ")); + result.append(")"); + } + return result.toString(); } @Override diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/MultiTargetPlatform.kt b/compiler/frontend/src/org/jetbrains/kotlin/resolve/MultiTargetPlatform.kt index 4309fe13367..b4e7655419b 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/MultiTargetPlatform.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/MultiTargetPlatform.kt @@ -20,10 +20,19 @@ import org.jetbrains.kotlin.descriptors.MemberDescriptor import org.jetbrains.kotlin.descriptors.ModuleDescriptor import org.jetbrains.kotlin.resolve.descriptorUtil.module -sealed class MultiTargetPlatform { - object Common : MultiTargetPlatform() +sealed class MultiTargetPlatform : Comparable { + object Common : MultiTargetPlatform() { + override fun compareTo(other: MultiTargetPlatform): Int = + if (other is Common) 0 else -1 + } - data class Specific(val platform: String) : MultiTargetPlatform() + data class Specific(val platform: String) : MultiTargetPlatform() { + override fun compareTo(other: MultiTargetPlatform): Int = + when (other) { + is Common -> 1 + is Specific -> platform.compareTo(other.platform) + } + } companion object { @JvmField diff --git a/compiler/testData/diagnostics/tests/multiplatform/headerClass/genericClassImplTypeAlias.kt b/compiler/testData/diagnostics/tests/multiplatform/headerClass/genericClassImplTypeAlias.kt index 94e79a8e49e..4197c706a0a 100644 --- a/compiler/testData/diagnostics/tests/multiplatform/headerClass/genericClassImplTypeAlias.kt +++ b/compiler/testData/diagnostics/tests/multiplatform/headerClass/genericClassImplTypeAlias.kt @@ -4,15 +4,15 @@ // FILE: common.kt header class C1 -header class C2 -header class C3 -header class C4 -header class C5 -header class C6 -header class C7 -header class C8 -header class C9 -header class C10 +header interface C2 +header interface C3 +header interface C4 +header interface C5 +header interface C6 +header interface C7 +header interface C8 +header interface C9 +header interface C10 // MODULE: m2-jvm(m1-common) // FILE: jvm.kt diff --git a/compiler/testData/diagnostics/tests/multiplatform/headerClass/headerClassMember.kt b/compiler/testData/diagnostics/tests/multiplatform/headerClass/headerClassMember.kt index 2031d19f897..603e112527a 100644 --- a/compiler/testData/diagnostics/tests/multiplatform/headerClass/headerClassMember.kt +++ b/compiler/testData/diagnostics/tests/multiplatform/headerClass/headerClassMember.kt @@ -9,16 +9,16 @@ header class Foo { // MODULE: m2-jvm(m1-common) // FILE: jvm.kt -class Foo { - val foo: String = "JVM" +impl class Foo { + impl val foo: String = "JVM" - fun bar(x: Int): Int = x + 1 + impl fun bar(x: Int): Int = x + 1 } // MODULE: m3-js(m1-common) // FILE: js.kt -class Foo { - val foo: String = "JS" +impl class Foo { + impl val foo: String = "JS" - fun bar(x: Int): Int = x - 1 + impl fun bar(x: Int): Int = x - 1 } diff --git a/compiler/testData/diagnostics/tests/multiplatform/headerClass/headerClassMember.txt b/compiler/testData/diagnostics/tests/multiplatform/headerClass/headerClassMember.txt index 5ad3b906cac..b1148750a54 100644 --- a/compiler/testData/diagnostics/tests/multiplatform/headerClass/headerClassMember.txt +++ b/compiler/testData/diagnostics/tests/multiplatform/headerClass/headerClassMember.txt @@ -14,10 +14,10 @@ public final header class Foo { // -- Module: -- package -public final class Foo { +public final impl class Foo { public constructor Foo() public final val foo: kotlin.String = "JVM" - public final fun bar(/*0*/ x: kotlin.Int): kotlin.Int + public final impl fun bar(/*0*/ x: kotlin.Int): kotlin.Int 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 @@ -27,10 +27,10 @@ public final class Foo { // -- Module: -- package -public final class Foo { +public final impl class Foo { public constructor Foo() public final val foo: kotlin.String = "JS" - public final fun bar(/*0*/ x: kotlin.Int): kotlin.Int + public final impl fun bar(/*0*/ x: kotlin.Int): kotlin.Int 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 diff --git a/compiler/testData/diagnostics/tests/multiplatform/headerClass/simpleHeaderClass.kt b/compiler/testData/diagnostics/tests/multiplatform/headerClass/simpleHeaderClass.kt index b31851d3a78..8c19bb12d46 100644 --- a/compiler/testData/diagnostics/tests/multiplatform/headerClass/simpleHeaderClass.kt +++ b/compiler/testData/diagnostics/tests/multiplatform/headerClass/simpleHeaderClass.kt @@ -5,8 +5,8 @@ header class Foo // MODULE: m2-jvm(m1-common) // FILE: jvm.kt -class Foo +impl class Foo // MODULE: m3-js(m1-common) // FILE: js.kt -class Foo +impl class Foo diff --git a/compiler/testData/diagnostics/tests/multiplatform/headerClass/simpleHeaderClass.txt b/compiler/testData/diagnostics/tests/multiplatform/headerClass/simpleHeaderClass.txt index ff3aeb3c3d0..cffcd317ac3 100644 --- a/compiler/testData/diagnostics/tests/multiplatform/headerClass/simpleHeaderClass.txt +++ b/compiler/testData/diagnostics/tests/multiplatform/headerClass/simpleHeaderClass.txt @@ -12,7 +12,7 @@ public final header class Foo { // -- Module: -- package -public final class Foo { +public final impl class Foo { public constructor Foo() public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int @@ -23,7 +23,7 @@ public final class Foo { // -- Module: -- package -public final class Foo { +public final impl class Foo { public constructor Foo() public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int diff --git a/compiler/testData/diagnostics/tests/multiplatform/headerClass/superClass.kt b/compiler/testData/diagnostics/tests/multiplatform/headerClass/superClass.kt index 9a249a2167d..5f7287771f7 100644 --- a/compiler/testData/diagnostics/tests/multiplatform/headerClass/superClass.kt +++ b/compiler/testData/diagnostics/tests/multiplatform/headerClass/superClass.kt @@ -10,8 +10,8 @@ header class Foo : I, C, J // MODULE: m2-jvm(m1-common) // FILE: jvm.kt -class Foo : I, C(), J +impl class Foo : I, C(), J // MODULE: m3-js(m1-common) // FILE: js.kt -class Foo : I, J, C() +impl class Foo : I, J, C() diff --git a/compiler/testData/diagnostics/tests/multiplatform/headerClass/superClass.txt b/compiler/testData/diagnostics/tests/multiplatform/headerClass/superClass.txt index e1b3ea03876..3e30daf255a 100644 --- a/compiler/testData/diagnostics/tests/multiplatform/headerClass/superClass.txt +++ b/compiler/testData/diagnostics/tests/multiplatform/headerClass/superClass.txt @@ -38,7 +38,7 @@ public open class C { public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String } -public final class Foo : I, C, J { +public final impl class Foo : I, C, J { public constructor Foo() public open override /*3*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean public open override /*3*/ /*fake_override*/ fun hashCode(): kotlin.Int @@ -68,7 +68,7 @@ public open class C { public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String } -public final class Foo : I, J, C { +public final impl class Foo : I, J, C { public constructor Foo() public open override /*3*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean public open override /*3*/ /*fake_override*/ fun hashCode(): kotlin.Int diff --git a/compiler/testData/diagnostics/tests/multiplatform/topLevelFun/headerAndImplInDIfferentPackages.kt b/compiler/testData/diagnostics/tests/multiplatform/topLevelFun/headerAndImplInDIfferentPackages.kt index 3c5f0b78500..c7a042c942a 100644 --- a/compiler/testData/diagnostics/tests/multiplatform/topLevelFun/headerAndImplInDIfferentPackages.kt +++ b/compiler/testData/diagnostics/tests/multiplatform/topLevelFun/headerAndImplInDIfferentPackages.kt @@ -3,7 +3,7 @@ // FILE: common.kt package common -header fun foo() +header fun foo() // MODULE: m2-jvm(m1-common) // FILE: jvm.kt diff --git a/compiler/testData/diagnostics/tests/multiplatform/topLevelFun/inlineFun.kt b/compiler/testData/diagnostics/tests/multiplatform/topLevelFun/inlineFun.kt index 653501edd08..0e1c4e188cc 100644 --- a/compiler/testData/diagnostics/tests/multiplatform/topLevelFun/inlineFun.kt +++ b/compiler/testData/diagnostics/tests/multiplatform/topLevelFun/inlineFun.kt @@ -2,7 +2,7 @@ // MODULE: m1-common // FILE: common.kt -inline header fun inlineFun() +inline header fun inlineFun() header fun nonInlineFun() // MODULE: m2-jvm(m1-common) diff --git a/compiler/tests-common/org/jetbrains/kotlin/checkers/AbstractDiagnosticsTest.kt b/compiler/tests-common/org/jetbrains/kotlin/checkers/AbstractDiagnosticsTest.kt index a024ee59260..800a187b215 100644 --- a/compiler/tests-common/org/jetbrains/kotlin/checkers/AbstractDiagnosticsTest.kt +++ b/compiler/tests-common/org/jetbrains/kotlin/checkers/AbstractDiagnosticsTest.kt @@ -154,8 +154,17 @@ abstract class AbstractDiagnosticsTest : BaseDiagnosticsTest() { for (testFile in files) { val module = testFile.module val isCommonModule = modules[module]!!.getMultiTargetPlatform() == MultiTargetPlatform.Common + val implementingModules = + if (!isCommonModule) emptyList() + else modules.entries.filter { (testModule) -> module in testModule?.getDependencies().orEmpty() } + val implementingModulesBindings = implementingModules.mapNotNull { + (testModule, moduleDescriptor) -> + val platform = moduleDescriptor.getCapability(MultiTargetPlatform.CAPABILITY) + if (platform is MultiTargetPlatform.Specific) platform to moduleBindings[testModule]!! + else null + } ok = ok and testFile.getActualText( - moduleBindings[module]!!, actualText, + moduleBindings[module]!!, implementingModulesBindings, actualText, shouldSkipJvmSignatureDiagnostics(groupedByModule) || isCommonModule ) } @@ -464,7 +473,7 @@ abstract class AbstractDiagnosticsTest : BaseDiagnosticsTest() { val nameSuffix = moduleName.substringAfterLast("-", "") val platform = if (nameSuffix.isEmpty()) null - else if (nameSuffix == "common") MultiTargetPlatform.Common else MultiTargetPlatform.Specific(nameSuffix) + else if (nameSuffix == "common") MultiTargetPlatform.Common else MultiTargetPlatform.Specific(nameSuffix.toUpperCase()) val capabilities: Map, Any?> = if (platform == null) emptyMap() else mapOf(MultiTargetPlatform.CAPABILITY to platform) diff --git a/compiler/tests-common/org/jetbrains/kotlin/checkers/BaseDiagnosticsTest.kt b/compiler/tests-common/org/jetbrains/kotlin/checkers/BaseDiagnosticsTest.kt index 7d16333c5f4..7e1abff38d7 100644 --- a/compiler/tests-common/org/jetbrains/kotlin/checkers/BaseDiagnosticsTest.kt +++ b/compiler/tests-common/org/jetbrains/kotlin/checkers/BaseDiagnosticsTest.kt @@ -35,6 +35,7 @@ import org.jetbrains.kotlin.load.java.InternalFlexibleTypeTransformer import org.jetbrains.kotlin.psi.KtDeclaration import org.jetbrains.kotlin.psi.KtFile import org.jetbrains.kotlin.resolve.BindingContext +import org.jetbrains.kotlin.resolve.MultiTargetPlatform import org.jetbrains.kotlin.test.KotlinTestUtils import org.jetbrains.kotlin.utils.addIfNotNull import org.junit.Assert @@ -194,13 +195,19 @@ abstract class BaseDiagnosticsTest : KotlinMultiFileTestWithJava>, + actualText: StringBuilder, + skipJvmSignatureDiagnostics: Boolean + ): Boolean { if (this.ktFile == null) { // TODO: check java files too actualText.append(this.clearText) return true } + // TODO: report JVM signature diagnostics also for implementing modules val jvmSignatureDiagnostics = if (skipJvmSignatureDiagnostics) emptySet() else @@ -209,14 +216,14 @@ abstract class BaseDiagnosticsTest : KotlinMultiFileTestWithJava diagnosedRanges = Lists.newArrayList(); CheckerTestUtil.parseDiagnosedRanges(expectedText, diagnosedRanges); List actualDiagnostics = - CheckerTestUtil.getDiagnosticsIncludingSyntaxErrors(bindingContext, psiFile, false, null); + CheckerTestUtil.getDiagnosticsIncludingSyntaxErrors(bindingContext, psiFile, false, null, null); Collections.sort(actualDiagnostics, CheckerTestUtil.DIAGNOSTIC_COMPARATOR); makeTestData(actualDiagnostics, diagnosedRanges); @@ -165,7 +165,7 @@ public class CheckerTestUtilTest extends KotlinTestWithEnvironment { CheckerTestUtil.diagnosticsDiff(diagnosedRanges, actualDiagnostics, new CheckerTestUtil.DiagnosticDiffCallbacks() { @Override public void missingDiagnostic(CheckerTestUtil.TextDiagnostic diagnostic, int expectedStart, int expectedEnd) { - actualMessages.add(missing(diagnostic.getName(), expectedStart, expectedEnd)); + actualMessages.add(missing(diagnostic.getDescription(), expectedStart, expectedEnd)); } @Override @@ -180,7 +180,7 @@ public class CheckerTestUtilTest extends KotlinTestWithEnvironment { @Override public void unexpectedDiagnostic(CheckerTestUtil.TextDiagnostic diagnostic, int actualStart, int actualEnd) { - actualMessages.add(unexpected(diagnostic.getName(), actualStart, actualEnd)); + actualMessages.add(unexpected(diagnostic.getDescription(), actualStart, actualEnd)); } }); diff --git a/idea/src/org/jetbrains/kotlin/idea/actions/internal/CopyAsDiagnosticTestAction.java b/idea/src/org/jetbrains/kotlin/idea/actions/internal/CopyAsDiagnosticTestAction.java index 2d8ddbd5f36..011d9b69af5 100644 --- a/idea/src/org/jetbrains/kotlin/idea/actions/internal/CopyAsDiagnosticTestAction.java +++ b/idea/src/org/jetbrains/kotlin/idea/actions/internal/CopyAsDiagnosticTestAction.java @@ -44,7 +44,7 @@ public class CopyAsDiagnosticTestAction extends AnAction { BindingContext bindingContext = ResolutionUtils.analyzeFully((KtFile) psiFile); List diagnostics = - CheckerTestUtil.getDiagnosticsIncludingSyntaxErrors(bindingContext, psiFile, false, null); + CheckerTestUtil.getDiagnosticsIncludingSyntaxErrors(bindingContext, psiFile, false, null, null); String result = CheckerTestUtil.addDiagnosticMarkersToText(psiFile, diagnostics).toString(); Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();