From cac326bf4a8242e03e22621b0f808535f7ab2759 Mon Sep 17 00:00:00 2001 From: Dmitry Savvinov Date: Tue, 23 Apr 2019 20:58:49 +0300 Subject: [PATCH] [Expect/Actual] Adjust old testdata after changes in expect/actual matching This commit makes several changes in testdata: - compiler multiplatform tests now contain newly introduced diagnostics about AMBIGIOUTS_ACTUALS - MultiModuleHighlighitng tests now contain proper reports about ACTUAL_MISSING: - ACTUAL_MISSING should be indeed reported in them, because those tests don't contain dependsOn edges, only usual intermodule dependencies - This error wasn't reported here because expect/actual diagnostics in common module used to be reported by PlatformExpectedAnnotator, which had a bit flawed logic for deremining common-modules: it checked for presence of implementing modules. In those tests, common module has no implementing modules, so Annotator was returning silently Note that such configurations (common module without implementing modules) are almost impossible in real-life projects - After removal of PlatformExpectedAnnotator, we use ExpectedActualDeclarationChecker in common modules, which launches all checks properly - some QuickFixMultuModuleTests now contain proper reports about ACTUAL_MISSING. This change is also connected with PlatformExpectedAnnotator, but now for different reason: - QuickFixMultiModuleTest used to check for errors in file by running 'analyzeWithAllCompilerChecks' and inspecting returned BindingTrace. For common modules, there were no diagnostics about expect/actuals in that trace, because there were no ExpectedActualDeclarationChecker (and PlatformExpectedAnnotator was reporting diagnostics in ad hoc trace). - Again, now we inject EADC in common modules properly, so we see those errors in trace and report them in test --- .../headerClass/expectDeclarationWithWeakIncompatibilities.kt | 2 +- .../multiplatform/topLevelFun/conflictingImplDeclarations.kt | 2 +- .../multiplatform/depends/a_common/common.kt | 4 ++-- .../multiplatform/triangle/base_common/My.kt | 4 ++-- .../multiplatform/triangleWithDependency/base_common/My.kt | 4 +++- .../multiModuleQuickFix/makeOpenFromExpect/common/common.kt | 1 + .../makeOpenFromExpect/common/common.kt.after | 1 + 7 files changed, 11 insertions(+), 7 deletions(-) diff --git a/compiler/testData/diagnostics/tests/multiplatform/headerClass/expectDeclarationWithWeakIncompatibilities.kt b/compiler/testData/diagnostics/tests/multiplatform/headerClass/expectDeclarationWithWeakIncompatibilities.kt index c9ae7381976..4c99af54746 100644 --- a/compiler/testData/diagnostics/tests/multiplatform/headerClass/expectDeclarationWithWeakIncompatibilities.kt +++ b/compiler/testData/diagnostics/tests/multiplatform/headerClass/expectDeclarationWithWeakIncompatibilities.kt @@ -10,7 +10,7 @@ expect fun foo2(): Int expect val s: String -expect open class Foo3 +expect open class Foo3 // MODULE: m2-jvm(m1-common) diff --git a/compiler/testData/diagnostics/tests/multiplatform/topLevelFun/conflictingImplDeclarations.kt b/compiler/testData/diagnostics/tests/multiplatform/topLevelFun/conflictingImplDeclarations.kt index f7be9406549..fa2813932f8 100644 --- a/compiler/testData/diagnostics/tests/multiplatform/topLevelFun/conflictingImplDeclarations.kt +++ b/compiler/testData/diagnostics/tests/multiplatform/topLevelFun/conflictingImplDeclarations.kt @@ -2,7 +2,7 @@ // MODULE: m1-common // FILE: common.kt -expect fun foo() +expect fun foo() // MODULE: m2-jvm(m1-common) // FILE: jvm.kt diff --git a/idea/testData/multiModuleHighlighting/multiplatform/depends/a_common/common.kt b/idea/testData/multiModuleHighlighting/multiplatform/depends/a_common/common.kt index 87831ad72f6..9ee2a42103c 100644 --- a/idea/testData/multiModuleHighlighting/multiplatform/depends/a_common/common.kt +++ b/idea/testData/multiModuleHighlighting/multiplatform/depends/a_common/common.kt @@ -1,2 +1,2 @@ -expect class My -expect fun bar() \ No newline at end of file +expect class My +expect fun bar() \ No newline at end of file diff --git a/idea/testData/multiModuleHighlighting/multiplatform/triangle/base_common/My.kt b/idea/testData/multiModuleHighlighting/multiplatform/triangle/base_common/My.kt index 87831ad72f6..54e53055a6c 100644 --- a/idea/testData/multiModuleHighlighting/multiplatform/triangle/base_common/My.kt +++ b/idea/testData/multiModuleHighlighting/multiplatform/triangle/base_common/My.kt @@ -1,2 +1,2 @@ -expect class My -expect fun bar() \ No newline at end of file +expect class My +expect fun bar() \ No newline at end of file diff --git a/idea/testData/multiModuleHighlighting/multiplatform/triangleWithDependency/base_common/My.kt b/idea/testData/multiModuleHighlighting/multiplatform/triangleWithDependency/base_common/My.kt index 817309d72f3..404d76d9c71 100644 --- a/idea/testData/multiModuleHighlighting/multiplatform/triangleWithDependency/base_common/My.kt +++ b/idea/testData/multiModuleHighlighting/multiplatform/triangleWithDependency/base_common/My.kt @@ -1,3 +1,5 @@ +// !CHECK_HIGHLIGHTING + expect class My -expect fun bar() \ No newline at end of file +expect fun bar \ No newline at end of file diff --git a/idea/testData/multiModuleQuickFix/makeOpenFromExpect/common/common.kt b/idea/testData/multiModuleQuickFix/makeOpenFromExpect/common/common.kt index de76f83fd05..10e9ad78379 100644 --- a/idea/testData/multiModuleQuickFix/makeOpenFromExpect/common/common.kt +++ b/idea/testData/multiModuleQuickFix/makeOpenFromExpect/common/common.kt @@ -1,4 +1,5 @@ // "Make 'One' open" "true" +// ERROR: Expected class 'Two' has no actual declaration in module testModule_JVM for JVM expect class One expect class Two : One \ No newline at end of file diff --git a/idea/testData/multiModuleQuickFix/makeOpenFromExpect/common/common.kt.after b/idea/testData/multiModuleQuickFix/makeOpenFromExpect/common/common.kt.after index c131c5a1868..0d3a8e8b963 100644 --- a/idea/testData/multiModuleQuickFix/makeOpenFromExpect/common/common.kt.after +++ b/idea/testData/multiModuleQuickFix/makeOpenFromExpect/common/common.kt.after @@ -1,4 +1,5 @@ // "Make 'One' open" "true" +// ERROR: Expected class 'Two' has no actual declaration in module testModule_JVM for JVM expect open class One expect class Two : One \ No newline at end of file