KT-5527 Double TYPE_MISMATCH diagnostic when returns object
#KT-5527 Fixed
This commit is contained in:
+1
-1
@@ -83,7 +83,7 @@ public class CallExpressionResolver {
|
|||||||
context.trace.record(REFERENCE_TARGET, expression, classifier);
|
context.trace.record(REFERENCE_TARGET, expression, classifier);
|
||||||
JetType result = getExtendedClassObjectType(expression, classObjectType, classifier, context);
|
JetType result = getExtendedClassObjectType(expression, classObjectType, classifier, context);
|
||||||
checkClassObjectVisibility(classifier, expression, context);
|
checkClassObjectVisibility(classifier, expression, context);
|
||||||
return DataFlowUtils.checkType(result, expression, context);
|
return result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
JetType[] result = new JetType[1];
|
JetType[] result = new JetType[1];
|
||||||
|
|||||||
@@ -0,0 +1,19 @@
|
|||||||
|
// !DIAGNOSTICS: -UNUSED_VARIABLE
|
||||||
|
|
||||||
|
object Boo {}
|
||||||
|
class A {
|
||||||
|
object Boo {}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun foo() {
|
||||||
|
val i1: Int = <!TYPE_MISMATCH!>Boo<!>
|
||||||
|
val i2: Int = <!TYPE_MISMATCH!>A.Boo<!>
|
||||||
|
useInt(<!TYPE_MISMATCH!>Boo<!>)
|
||||||
|
useInt(<!TYPE_MISMATCH!>A.Boo<!>)
|
||||||
|
}
|
||||||
|
fun bar() {
|
||||||
|
val i1: Int = <!TYPE_MISMATCH!>Unit<!>
|
||||||
|
useInt(<!TYPE_MISMATCH!>Unit<!>)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun useInt(i: Int) = i
|
||||||
@@ -5856,6 +5856,11 @@ public class JetDiagnosticsTestGenerated extends AbstractJetDiagnosticsTest {
|
|||||||
doTest("compiler/testData/diagnostics/tests/objects/kt2240.kt");
|
doTest("compiler/testData/diagnostics/tests/objects/kt2240.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("kt5527.kt")
|
||||||
|
public void testKt5527() throws Exception {
|
||||||
|
doTest("compiler/testData/diagnostics/tests/objects/kt5527.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("objectLiteralExpressionTypeMismatch.kt")
|
@TestMetadata("objectLiteralExpressionTypeMismatch.kt")
|
||||||
public void testObjectLiteralExpressionTypeMismatch() throws Exception {
|
public void testObjectLiteralExpressionTypeMismatch() throws Exception {
|
||||||
doTest("compiler/testData/diagnostics/tests/objects/objectLiteralExpressionTypeMismatch.kt");
|
doTest("compiler/testData/diagnostics/tests/objects/objectLiteralExpressionTypeMismatch.kt");
|
||||||
|
|||||||
Reference in New Issue
Block a user