[FIR] KT-54587: Report the missing diagnostics
^KT-54587 Fixed Merge-request: KT-MR-7791 Merged-by: Nikolay Lunyak <Nikolay.Lunyak@jetbrains.com>
This commit is contained in:
committed by
Space Team
parent
3f95b7e031
commit
a454d42e65
+12
@@ -453,6 +453,18 @@ public class DiagnosisCompilerTestFE10TestdataTestGenerated extends AbstractDiag
|
|||||||
runTest("compiler/testData/diagnostics/tests/kt53988.kt");
|
runTest("compiler/testData/diagnostics/tests/kt53988.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("kt54587_1.kt")
|
||||||
|
public void testKt54587_1() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/kt54587_1.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("kt54587_2.kt")
|
||||||
|
public void testKt54587_2() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/kt54587_2.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestMetadata("LValueAssignment.kt")
|
@TestMetadata("LValueAssignment.kt")
|
||||||
public void testLValueAssignment() throws Exception {
|
public void testLValueAssignment() throws Exception {
|
||||||
|
|||||||
+12
@@ -453,6 +453,18 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirDiagnosti
|
|||||||
runTest("compiler/testData/diagnostics/tests/kt53988.kt");
|
runTest("compiler/testData/diagnostics/tests/kt53988.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("kt54587_1.kt")
|
||||||
|
public void testKt54587_1() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/kt54587_1.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("kt54587_2.kt")
|
||||||
|
public void testKt54587_2() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/kt54587_2.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestMetadata("LValueAssignment.kt")
|
@TestMetadata("LValueAssignment.kt")
|
||||||
public void testLValueAssignment() throws Exception {
|
public void testLValueAssignment() throws Exception {
|
||||||
|
|||||||
+12
@@ -453,6 +453,18 @@ public class FirOldFrontendDiagnosticsWithLightTreeTestGenerated extends Abstrac
|
|||||||
runTest("compiler/testData/diagnostics/tests/kt53988.kt");
|
runTest("compiler/testData/diagnostics/tests/kt53988.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("kt54587_1.kt")
|
||||||
|
public void testKt54587_1() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/kt54587_1.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("kt54587_2.kt")
|
||||||
|
public void testKt54587_2() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/kt54587_2.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestMetadata("LValueAssignment.kt")
|
@TestMetadata("LValueAssignment.kt")
|
||||||
public void testLValueAssignment() throws Exception {
|
public void testLValueAssignment() throws Exception {
|
||||||
|
|||||||
+9
@@ -122,6 +122,15 @@ object FirDestructuringDeclarationChecker : FirPropertyChecker() {
|
|||||||
context
|
context
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
is ConeInapplicableWrongReceiver -> {
|
||||||
|
reporter.reportOn(
|
||||||
|
source,
|
||||||
|
FirErrors.COMPONENT_FUNCTION_MISSING,
|
||||||
|
diagnostic.candidates.first().callInfo.name,
|
||||||
|
destructuringDeclarationType,
|
||||||
|
context
|
||||||
|
)
|
||||||
|
}
|
||||||
is ConeAmbiguityError -> {
|
is ConeAmbiguityError -> {
|
||||||
reporter.reportOn(
|
reporter.reportOn(
|
||||||
source,
|
source,
|
||||||
|
|||||||
+4
@@ -34,6 +34,7 @@ import org.jetbrains.kotlin.fir.references.FirResolvedNamedReference
|
|||||||
import org.jetbrains.kotlin.fir.resolve.calls.UnsafeCall
|
import org.jetbrains.kotlin.fir.resolve.calls.UnsafeCall
|
||||||
import org.jetbrains.kotlin.fir.resolve.diagnostics.ConeAmbiguityError
|
import org.jetbrains.kotlin.fir.resolve.diagnostics.ConeAmbiguityError
|
||||||
import org.jetbrains.kotlin.fir.resolve.diagnostics.ConeInapplicableCandidateError
|
import org.jetbrains.kotlin.fir.resolve.diagnostics.ConeInapplicableCandidateError
|
||||||
|
import org.jetbrains.kotlin.fir.resolve.diagnostics.ConeInapplicableWrongReceiver
|
||||||
import org.jetbrains.kotlin.fir.resolve.diagnostics.ConeUnresolvedNameError
|
import org.jetbrains.kotlin.fir.resolve.diagnostics.ConeUnresolvedNameError
|
||||||
import org.jetbrains.kotlin.fir.symbols.FirBasedSymbol
|
import org.jetbrains.kotlin.fir.symbols.FirBasedSymbol
|
||||||
import org.jetbrains.kotlin.fir.symbols.impl.FirNamedFunctionSymbol
|
import org.jetbrains.kotlin.fir.symbols.impl.FirNamedFunctionSymbol
|
||||||
@@ -113,6 +114,9 @@ object FirForLoopChecker : FirBlockChecker() {
|
|||||||
is ConeUnresolvedNameError -> {
|
is ConeUnresolvedNameError -> {
|
||||||
reporter.reportOn(reportSource, missingFactory, context)
|
reporter.reportOn(reportSource, missingFactory, context)
|
||||||
}
|
}
|
||||||
|
is ConeInapplicableWrongReceiver -> noneApplicableFactory?.let {
|
||||||
|
reporter.reportOn(reportSource, it, diagnostic.candidateSymbols, context)
|
||||||
|
}
|
||||||
is ConeInapplicableCandidateError -> {
|
is ConeInapplicableCandidateError -> {
|
||||||
if (unsafeCallFactory != null || noneApplicableFactory != null) {
|
if (unsafeCallFactory != null || noneApplicableFactory != null) {
|
||||||
diagnostic.candidate.diagnostics.filter { it.applicability == diagnostic.applicability }.forEach {
|
diagnostic.candidate.diagnostics.filter { it.applicability == diagnostic.applicability }.forEach {
|
||||||
|
|||||||
@@ -0,0 +1,12 @@
|
|||||||
|
// FIR_IDENTICAL
|
||||||
|
class MyClass
|
||||||
|
class SomeClass
|
||||||
|
|
||||||
|
operator fun SomeClass.component1() {}
|
||||||
|
operator fun SomeClass.component2() {}
|
||||||
|
|
||||||
|
fun test() {
|
||||||
|
val (o, o2) = SomeClass()
|
||||||
|
val (o3, o4) = <!COMPONENT_FUNCTION_MISSING, COMPONENT_FUNCTION_MISSING!>MyClass()<!> // [COMPONENT_FUNCTION_MISSING] expected as in K1
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
package
|
||||||
|
|
||||||
|
public fun test(): kotlin.Unit
|
||||||
|
public operator fun SomeClass.component1(): kotlin.Unit
|
||||||
|
public operator fun SomeClass.component2(): kotlin.Unit
|
||||||
|
|
||||||
|
public final class MyClass {
|
||||||
|
public constructor MyClass()
|
||||||
|
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
|
||||||
|
}
|
||||||
|
|
||||||
|
public final class SomeClass {
|
||||||
|
public constructor SomeClass()
|
||||||
|
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
|
||||||
|
}
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
// FIR_IDENTICAL
|
||||||
|
package one
|
||||||
|
|
||||||
|
fun test(f: NextMissing) {
|
||||||
|
for(i in <!NEXT_NONE_APPLICABLE!>f<!>) {} //[NEXT_NONE_APPLICABLE] is expected as in K1
|
||||||
|
}
|
||||||
|
|
||||||
|
interface Doo
|
||||||
|
operator fun Doo.next() {}
|
||||||
|
|
||||||
|
interface NextMissing {
|
||||||
|
operator fun iterator(): NextMissing2
|
||||||
|
}
|
||||||
|
|
||||||
|
interface NextMissing2 {
|
||||||
|
operator fun hasNext(): Boolean
|
||||||
|
}
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
package
|
||||||
|
|
||||||
|
package one {
|
||||||
|
public fun test(/*0*/ f: one.NextMissing): kotlin.Unit
|
||||||
|
public operator fun one.Doo.next(): kotlin.Unit
|
||||||
|
|
||||||
|
public interface Doo {
|
||||||
|
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
|
||||||
|
}
|
||||||
|
|
||||||
|
public interface NextMissing {
|
||||||
|
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 abstract operator fun iterator(): one.NextMissing2
|
||||||
|
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||||
|
}
|
||||||
|
|
||||||
|
public interface NextMissing2 {
|
||||||
|
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||||
|
public abstract operator fun hasNext(): kotlin.Boolean
|
||||||
|
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||||
|
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||||
|
}
|
||||||
|
}
|
||||||
Generated
+12
@@ -453,6 +453,18 @@ public class DiagnosticTestGenerated extends AbstractDiagnosticTest {
|
|||||||
runTest("compiler/testData/diagnostics/tests/kt53988.kt");
|
runTest("compiler/testData/diagnostics/tests/kt53988.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("kt54587_1.kt")
|
||||||
|
public void testKt54587_1() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/kt54587_1.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("kt54587_2.kt")
|
||||||
|
public void testKt54587_2() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/kt54587_2.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestMetadata("LValueAssignment.kt")
|
@TestMetadata("LValueAssignment.kt")
|
||||||
public void testLValueAssignment() throws Exception {
|
public void testLValueAssignment() throws Exception {
|
||||||
|
|||||||
Reference in New Issue
Block a user