Add tests for obsolete issues

#KT-37734 Obsolete
 #KT-39824 Obsolete
This commit is contained in:
Mikhail Zarechenskiy
2020-06-26 06:24:59 +03:00
parent 9844607d0f
commit 684ca5029f
14 changed files with 121 additions and 0 deletions
@@ -2072,6 +2072,11 @@ public class FirOldFrontendDiagnosticsTestWithStdlibGenerated extends AbstractFi
runTest("compiler/testData/diagnostics/testsWithStdLib/inference/annotationsForResolve/exactAnnotation.kt");
}
@TestMetadata("exactAnnotationWithUpperBoundConstraint.kt")
public void testExactAnnotationWithUpperBoundConstraint() throws Exception {
runTest("compiler/testData/diagnostics/testsWithStdLib/inference/annotationsForResolve/exactAnnotationWithUpperBoundConstraint.kt");
}
@TestMetadata("explicitTypeArgumentAsValidInputType.kt")
public void testExplicitTypeArgumentAsValidInputType() throws Exception {
runTest("compiler/testData/diagnostics/testsWithStdLib/inference/annotationsForResolve/explicitTypeArgumentAsValidInputType.kt");
@@ -12414,6 +12414,11 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT
runTest("compiler/testData/codegen/box/inference/kt36446.kt");
}
@TestMetadata("kt39824.kt")
public void testKt39824() throws Exception {
runTest("compiler/testData/codegen/box/inference/kt39824.kt");
}
@TestMetadata("lastExpressionOfLambdaWithNothingConstraint.kt")
public void testLastExpressionOfLambdaWithNothingConstraint() throws Exception {
runTest("compiler/testData/codegen/box/inference/lastExpressionOfLambdaWithNothingConstraint.kt");
+33
View File
@@ -0,0 +1,33 @@
// WITH_RUNTIME
fun <C : Any> diContext(context: C): DIContext<C> = DIContext(TypeToken(), context)
fun <C : Any> diContext(getContext: () -> C): DIContext<C> = DIContext<C>(TypeToken()) { getContext() }
interface DIContext<C : Any> {
val type: TypeToken<C>
val value: C
fun print() {
result += value.toString()
}
data class Value<C : Any>(override val type: TypeToken<C>, override val value: C) : DIContext<C>
class Lazy<C : Any>(override val type: TypeToken<C>, public val getValue: () -> C) : DIContext<C> {
override val value: C by lazy(getValue)
}
companion object {
operator fun <C : Any> invoke(type: TypeToken<C>, value: C): DIContext<C> = Value(type, value)
operator fun <C : Any> invoke(type: TypeToken<C>, getValue: () -> C): DIContext<C> = Lazy(type, getValue)
}
}
class TypeToken<T>
var result = ""
fun box(): String {
diContext("O").print()
diContext { "K" }.print()
return result
}
@@ -0,0 +1,17 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER -DEBUG_INFO_CONSTANT -UNUSED_EXPRESSION
@Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE")
fun <@kotlin.internal.OnlyInputTypes K, V, V1 : V?>
Map<out K, @kotlin.internal.Exact V>.getOrDefault_Exact(key: K, defaultValue: V1): V1 = TODO()
fun test() {
val map: Map<String, Int> = mapOf("x" to 1)
val r1 = map.getOrDefault_Exact("y", null)
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Nothing?")!>r1<!>
val r2 = map.getOrDefault_Exact("y", null as Int?)
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Int?")!>r2<!>
map.getOrDefault_Exact("y", "string")
}
@@ -0,0 +1,17 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER -DEBUG_INFO_CONSTANT -UNUSED_EXPRESSION
@Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE")
fun <@kotlin.internal.OnlyInputTypes K, V, V1 : V?>
Map<out K, @kotlin.internal.Exact V>.getOrDefault_Exact(key: K, defaultValue: V1): V1 = TODO()
fun test() {
val map: Map<String, Int> = mapOf("x" to 1)
val r1 = map.getOrDefault_Exact("y", null)
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Nothing?")!>r1<!>
val r2 = map.getOrDefault_Exact("y", null as Int?)
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Int?")!>r2<!>
map.getOrDefault_Exact("y", <!TYPE_MISMATCH, TYPE_MISMATCH!>"string"<!>)
}
@@ -0,0 +1,4 @@
package
public fun test(): kotlin.Unit
@kotlin.Suppress(names = {"INVISIBLE_MEMBER", "INVISIBLE_REFERENCE"}) public fun </*0*/ @kotlin.internal.OnlyInputTypes K, /*1*/ V, /*2*/ V1 : V?> kotlin.collections.Map<out K, V>.getOrDefault_Exact(/*0*/ key: K, /*1*/ defaultValue: V1): V1
@@ -3102,6 +3102,11 @@ public class DiagnosticsTestWithStdLibGenerated extends AbstractDiagnosticsTestW
runTest("compiler/testData/diagnostics/testsWithStdLib/inference/annotationsForResolve/exactAnnotation.kt");
}
@TestMetadata("exactAnnotationWithUpperBoundConstraint.kt")
public void testExactAnnotationWithUpperBoundConstraint() throws Exception {
runTest("compiler/testData/diagnostics/testsWithStdLib/inference/annotationsForResolve/exactAnnotationWithUpperBoundConstraint.kt");
}
@TestMetadata("explicitTypeArgumentAsValidInputType.kt")
public void testExplicitTypeArgumentAsValidInputType() throws Exception {
runTest("compiler/testData/diagnostics/testsWithStdLib/inference/annotationsForResolve/explicitTypeArgumentAsValidInputType.kt");
@@ -3102,6 +3102,11 @@ public class DiagnosticsTestWithStdLibUsingJavacGenerated extends AbstractDiagno
runTest("compiler/testData/diagnostics/testsWithStdLib/inference/annotationsForResolve/exactAnnotation.kt");
}
@TestMetadata("exactAnnotationWithUpperBoundConstraint.kt")
public void testExactAnnotationWithUpperBoundConstraint() throws Exception {
runTest("compiler/testData/diagnostics/testsWithStdLib/inference/annotationsForResolve/exactAnnotationWithUpperBoundConstraint.kt");
}
@TestMetadata("explicitTypeArgumentAsValidInputType.kt")
public void testExplicitTypeArgumentAsValidInputType() throws Exception {
runTest("compiler/testData/diagnostics/testsWithStdLib/inference/annotationsForResolve/explicitTypeArgumentAsValidInputType.kt");
@@ -13639,6 +13639,11 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
runTest("compiler/testData/codegen/box/inference/kt36446.kt");
}
@TestMetadata("kt39824.kt")
public void testKt39824() throws Exception {
runTest("compiler/testData/codegen/box/inference/kt39824.kt");
}
@TestMetadata("lastExpressionOfLambdaWithNothingConstraint.kt")
public void testLastExpressionOfLambdaWithNothingConstraint() throws Exception {
runTest("compiler/testData/codegen/box/inference/lastExpressionOfLambdaWithNothingConstraint.kt");
@@ -13639,6 +13639,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
runTest("compiler/testData/codegen/box/inference/kt36446.kt");
}
@TestMetadata("kt39824.kt")
public void testKt39824() throws Exception {
runTest("compiler/testData/codegen/box/inference/kt39824.kt");
}
@TestMetadata("lastExpressionOfLambdaWithNothingConstraint.kt")
public void testLastExpressionOfLambdaWithNothingConstraint() throws Exception {
runTest("compiler/testData/codegen/box/inference/lastExpressionOfLambdaWithNothingConstraint.kt");
@@ -12414,6 +12414,11 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
runTest("compiler/testData/codegen/box/inference/kt36446.kt");
}
@TestMetadata("kt39824.kt")
public void testKt39824() throws Exception {
runTest("compiler/testData/codegen/box/inference/kt39824.kt");
}
@TestMetadata("lastExpressionOfLambdaWithNothingConstraint.kt")
public void testLastExpressionOfLambdaWithNothingConstraint() throws Exception {
runTest("compiler/testData/codegen/box/inference/lastExpressionOfLambdaWithNothingConstraint.kt");
@@ -10679,6 +10679,11 @@ public class IrJsCodegenBoxES6TestGenerated extends AbstractIrJsCodegenBoxES6Tes
runTest("compiler/testData/codegen/box/inference/kt36446.kt");
}
@TestMetadata("kt39824.kt")
public void testKt39824() throws Exception {
runTest("compiler/testData/codegen/box/inference/kt39824.kt");
}
@TestMetadata("lastExpressionOfLambdaWithNothingConstraint.kt")
public void testLastExpressionOfLambdaWithNothingConstraint() throws Exception {
runTest("compiler/testData/codegen/box/inference/lastExpressionOfLambdaWithNothingConstraint.kt");
@@ -10689,6 +10689,11 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest {
runTest("compiler/testData/codegen/box/inference/kt36446.kt");
}
@TestMetadata("kt39824.kt")
public void testKt39824() throws Exception {
runTest("compiler/testData/codegen/box/inference/kt39824.kt");
}
@TestMetadata("lastExpressionOfLambdaWithNothingConstraint.kt")
public void testLastExpressionOfLambdaWithNothingConstraint() throws Exception {
runTest("compiler/testData/codegen/box/inference/lastExpressionOfLambdaWithNothingConstraint.kt");
@@ -10754,6 +10754,11 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest {
runTest("compiler/testData/codegen/box/inference/kt36446.kt");
}
@TestMetadata("kt39824.kt")
public void testKt39824() throws Exception {
runTest("compiler/testData/codegen/box/inference/kt39824.kt");
}
@TestMetadata("lastExpressionOfLambdaWithNothingConstraint.kt")
public void testLastExpressionOfLambdaWithNothingConstraint() throws Exception {
runTest("compiler/testData/codegen/box/inference/lastExpressionOfLambdaWithNothingConstraint.kt");