Add tests for obsolete issues

#KT-11979 Obsolete
 #KT-12898 Obsolete
 #KT-30657 Obsolete
 #KT-28446 Obsolete
This commit is contained in:
Mikhail Zarechenskiy
2019-12-12 15:25:56 +03:00
parent c3ffef1840
commit 3840294f44
15 changed files with 244 additions and 0 deletions
@@ -1779,6 +1779,11 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirOldFronte
runTest("compiler/testData/diagnostics/tests/callableReference/callableReferenceAsLastExpressionInBlock.kt");
}
@TestMetadata("callableReferenceToLocalVariable.kt")
public void testCallableReferenceToLocalVariable() throws Exception {
runTest("compiler/testData/diagnostics/tests/callableReference/callableReferenceToLocalVariable.kt");
}
@TestMetadata("classVsPackage.kt")
public void testClassVsPackage() throws Exception {
runTest("compiler/testData/diagnostics/tests/callableReference/classVsPackage.kt");
@@ -17295,6 +17300,11 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirOldFronte
runTest("compiler/testData/diagnostics/tests/regressions/kt10843.kt");
}
@TestMetadata("kt11979.kt")
public void testKt11979() throws Exception {
runTest("compiler/testData/diagnostics/tests/regressions/kt11979.kt");
}
@TestMetadata("kt127.kt")
public void testKt127() throws Exception {
runTest("compiler/testData/diagnostics/tests/regressions/kt127.kt");
@@ -17305,6 +17315,11 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirOldFronte
runTest("compiler/testData/diagnostics/tests/regressions/kt128.kt");
}
@TestMetadata("kt12898.kt")
public void testKt12898() throws Exception {
runTest("compiler/testData/diagnostics/tests/regressions/kt12898.kt");
}
@TestMetadata("kt13685.kt")
public void testKt13685() throws Exception {
runTest("compiler/testData/diagnostics/tests/regressions/kt13685.kt");
@@ -0,0 +1,8 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER -UNUSED_VARIABLE
fun a() {
val x = 10
foo(::<!UNSUPPORTED!>x<!>)
}
fun foo(a: Any) {}
@@ -0,0 +1,4 @@
package
public fun a(): kotlin.Unit
public fun foo(/*0*/ a: kotlin.Any): kotlin.Unit
@@ -0,0 +1,26 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER
// !WITH_NEW_INFERENCE
interface Bar<T> {
val t: T
}
class MyBar<T>(override val t: T) : Bar<T>
class BarR : Bar<BarR> {
override val t: BarR get() = this
}
class Foo<F : Bar<F>>(val f: F)
fun <T> id(t1: T, t2: T) = t2
fun test(foo: Foo<*>, g: Bar<*>) {
id(foo.f, g).t.<!UNRESOLVED_REFERENCE!>t<!>
}
fun main() {
val foo = Foo(BarR())
test(foo, MyBar(2))
}
@@ -0,0 +1,26 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER
// !WITH_NEW_INFERENCE
interface Bar<T> {
val t: T
}
class MyBar<T>(override val t: T) : Bar<T>
class BarR : Bar<BarR> {
override val t: BarR get() = this
}
class Foo<F : Bar<F>>(val f: F)
fun <T> id(t1: T, t2: T) = t2
fun test(foo: Foo<*>, g: Bar<*>) {
<!OI;TYPE_MISMATCH!><!OI;TYPE_MISMATCH!>id(foo.f, g)<!>.t<!>.<!NI;UNRESOLVED_REFERENCE!>t<!>
}
fun main() {
val foo = Foo(BarR())
test(foo, MyBar(2))
}
@@ -0,0 +1,36 @@
package
public fun </*0*/ T> id(/*0*/ t1: T, /*1*/ t2: T): T
public fun main(): kotlin.Unit
public fun test(/*0*/ foo: Foo<*>, /*1*/ g: Bar<*>): kotlin.Unit
public interface Bar</*0*/ T> {
public abstract val t: T
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 BarR : Bar<BarR> {
public constructor BarR()
public open override /*1*/ val t: BarR
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 Foo</*0*/ F : Bar<F>> {
public constructor Foo</*0*/ F : Bar<F>>(/*0*/ f: F)
public final val f: F
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 MyBar</*0*/ T> : Bar<T> {
public constructor MyBar</*0*/ T>(/*0*/ t: T)
public open override /*1*/ val t: T
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,20 @@
// !LANGUAGE: +NewInference
// !WITH_NEW_INFERENCE
interface B<T : S?, S : Any> {
val t: T
}
class C(override val t: Any?) : B<Any?, Any>
fun f(b: B<*, Any>) {
val y = b.t
if (y is String?) {
y.length
}
}
fun main() {
f(C("hello"))
f(C(null))
}
@@ -0,0 +1,20 @@
// !LANGUAGE: +NewInference
// !WITH_NEW_INFERENCE
interface B<T : S?, S : Any> {
val t: T
}
class C(override val t: Any?) : B<Any?, Any>
fun f(b: B<*, Any>) {
val y = <!OI;TYPE_MISMATCH!>b<!>.<!NI;DEBUG_INFO_UNRESOLVED_WITH_TARGET, NI;UNRESOLVED_REFERENCE_WRONG_RECEIVER!>t<!>
if (<!NI;DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE!>y<!> is String<!OI;USELESS_NULLABLE_CHECK!>?<!>) {
<!NI;DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE, OI;DEBUG_INFO_SMARTCAST!>y<!>.<!NI;DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE!>length<!>
}
}
fun main() {
f(C("hello"))
f(C(null))
}
@@ -0,0 +1,19 @@
package
public fun f(/*0*/ b: B<*, kotlin.Any>): kotlin.Unit
public fun main(): kotlin.Unit
public interface B</*0*/ T : S?, /*1*/ S : kotlin.Any> {
public abstract val t: T
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 C : B<kotlin.Any?, kotlin.Any> {
public constructor C(/*0*/ t: kotlin.Any?)
public open override /*1*/ val t: kotlin.Any?
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,19 @@
// !USE_EXPERIMENTAL: kotlin.Experimental
// !DIAGNOSTICS: -UNUSED_EXPRESSION -UNUSED_PARAMETER -UNUSED_VARIABLE
@file:UseExperimental(ExperimentalTypeInference::class)
import kotlin.experimental.ExperimentalTypeInference
interface ProducerScope<E> {
fun yield(e: E)
}
@UseExperimental(ExperimentalTypeInference::class)
fun <E> produce(@BuilderInference block: ProducerScope<E>.() -> Unit): ProducerScope<E> = TODO()
fun <K> filter(e: K, predicate: (K) -> Boolean) =
produce {
predicate(e)
yield(42)
}
@@ -0,0 +1,11 @@
package
public fun </*0*/ K> filter(/*0*/ e: K, /*1*/ predicate: (K) -> kotlin.Boolean): ProducerScope<kotlin.Int>
@kotlin.UseExperimental(markerClass = {kotlin.experimental.ExperimentalTypeInference::class}) public fun </*0*/ E> produce(/*0*/ @kotlin.BuilderInference block: ProducerScope<E>.() -> kotlin.Unit): ProducerScope<E>
public interface ProducerScope</*0*/ E> {
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 abstract fun yield(/*0*/ e: E): kotlin.Unit
}
@@ -1786,6 +1786,11 @@ public class DiagnosticsTestGenerated extends AbstractDiagnosticsTest {
runTest("compiler/testData/diagnostics/tests/callableReference/callableReferenceAsLastExpressionInBlock.kt");
}
@TestMetadata("callableReferenceToLocalVariable.kt")
public void testCallableReferenceToLocalVariable() throws Exception {
runTest("compiler/testData/diagnostics/tests/callableReference/callableReferenceToLocalVariable.kt");
}
@TestMetadata("classVsPackage.kt")
public void testClassVsPackage() throws Exception {
runTest("compiler/testData/diagnostics/tests/callableReference/classVsPackage.kt");
@@ -17307,6 +17312,11 @@ public class DiagnosticsTestGenerated extends AbstractDiagnosticsTest {
runTest("compiler/testData/diagnostics/tests/regressions/kt10843.kt");
}
@TestMetadata("kt11979.kt")
public void testKt11979() throws Exception {
runTest("compiler/testData/diagnostics/tests/regressions/kt11979.kt");
}
@TestMetadata("kt127.kt")
public void testKt127() throws Exception {
runTest("compiler/testData/diagnostics/tests/regressions/kt127.kt");
@@ -17317,6 +17327,11 @@ public class DiagnosticsTestGenerated extends AbstractDiagnosticsTest {
runTest("compiler/testData/diagnostics/tests/regressions/kt128.kt");
}
@TestMetadata("kt12898.kt")
public void testKt12898() throws Exception {
runTest("compiler/testData/diagnostics/tests/regressions/kt12898.kt");
}
@TestMetadata("kt13685.kt")
public void testKt13685() throws Exception {
runTest("compiler/testData/diagnostics/tests/regressions/kt13685.kt");
@@ -1997,6 +1997,11 @@ public class DiagnosticsTestWithStdLibGenerated extends AbstractDiagnosticsTestW
runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/variableCallInsideBuilderFunction.kt");
}
@TestMetadata("variableOfAFunctionTypeCall.kt")
public void testVariableOfAFunctionTypeCall() throws Exception {
runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/variableOfAFunctionTypeCall.kt");
}
@TestMetadata("withParameter.kt")
public void testWithParameter() throws Exception {
runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/withParameter.kt");
@@ -1997,6 +1997,11 @@ public class DiagnosticsTestWithStdLibUsingJavacGenerated extends AbstractDiagno
runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/variableCallInsideBuilderFunction.kt");
}
@TestMetadata("variableOfAFunctionTypeCall.kt")
public void testVariableOfAFunctionTypeCall() throws Exception {
runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/variableOfAFunctionTypeCall.kt");
}
@TestMetadata("withParameter.kt")
public void testWithParameter() throws Exception {
runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/withParameter.kt");
@@ -1781,6 +1781,11 @@ public class DiagnosticsUsingJavacTestGenerated extends AbstractDiagnosticsUsing
runTest("compiler/testData/diagnostics/tests/callableReference/callableReferenceAsLastExpressionInBlock.kt");
}
@TestMetadata("callableReferenceToLocalVariable.kt")
public void testCallableReferenceToLocalVariable() throws Exception {
runTest("compiler/testData/diagnostics/tests/callableReference/callableReferenceToLocalVariable.kt");
}
@TestMetadata("classVsPackage.kt")
public void testClassVsPackage() throws Exception {
runTest("compiler/testData/diagnostics/tests/callableReference/classVsPackage.kt");
@@ -17297,6 +17302,11 @@ public class DiagnosticsUsingJavacTestGenerated extends AbstractDiagnosticsUsing
runTest("compiler/testData/diagnostics/tests/regressions/kt10843.kt");
}
@TestMetadata("kt11979.kt")
public void testKt11979() throws Exception {
runTest("compiler/testData/diagnostics/tests/regressions/kt11979.kt");
}
@TestMetadata("kt127.kt")
public void testKt127() throws Exception {
runTest("compiler/testData/diagnostics/tests/regressions/kt127.kt");
@@ -17307,6 +17317,11 @@ public class DiagnosticsUsingJavacTestGenerated extends AbstractDiagnosticsUsing
runTest("compiler/testData/diagnostics/tests/regressions/kt128.kt");
}
@TestMetadata("kt12898.kt")
public void testKt12898() throws Exception {
runTest("compiler/testData/diagnostics/tests/regressions/kt12898.kt");
}
@TestMetadata("kt13685.kt")
public void testKt13685() throws Exception {
runTest("compiler/testData/diagnostics/tests/regressions/kt13685.kt");