Add test for obsolete KT-6481 Mark deprecated constructor calls with strikethrough

This commit is contained in:
Pavel V. Talanov
2016-03-09 18:41:00 +03:00
parent df3f163ee2
commit c3a1643c6c
3 changed files with 66 additions and 0 deletions
@@ -0,0 +1,34 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER
// FILE: A.kt
class A(s: String) {
@Deprecated("")
constructor(i: Int) : this(i.toString()) {
}
}
// FILE: B.java
public class B extends A {
@Deprecated
public B(int i) {
}
public B(String s) {
}
}
// FILE: C.kt
class C @Deprecated("") constructor(s: String) {
}
// FILE: use.kt
fun use(a: A, b: B, c: C) {
<!DEPRECATION!>A<!>(3)
A("")
<!DEPRECATION!>B<!>(3)
B("")
<!DEPRECATION!>C<!>("s")
}
@@ -0,0 +1,26 @@
package
public fun use(/*0*/ a: A, /*1*/ b: B, /*2*/ c: C): kotlin.Unit
public final class A {
@kotlin.Deprecated(message = "") public constructor A(/*0*/ i: kotlin.Int)
public constructor A(/*0*/ s: kotlin.String)
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 open class B : A {
@kotlin.Deprecated(message = "Deprecated in Java") public constructor B(/*0*/ i: kotlin.Int)
public constructor B(/*0*/ s: kotlin.String!)
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 {
@kotlin.Deprecated(message = "") public constructor C(/*0*/ s: kotlin.String)
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
}
@@ -5088,6 +5088,12 @@ public class DiagnosticsTestGenerated extends AbstractDiagnosticsTest {
doTest(fileName);
}
@TestMetadata("deprecatedConstructor.kt")
public void testDeprecatedConstructor() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/deprecated/deprecatedConstructor.kt");
doTest(fileName);
}
@TestMetadata("deprecatedError.kt")
public void testDeprecatedError() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/deprecated/deprecatedError.kt");