Skip to content

Commit d9a6d15

Browse files
committed
Add tests for obsolete issues
#KT-4628 Obsolete #KT-3897 Obsolete #KT-3898 Obsolete #KT-7523 Obsolete
1 parent bfa0b69 commit d9a6d15

File tree

9 files changed

+156
-0
lines changed

9 files changed

+156
-0
lines changed
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// FILE: Hello.kt
2+
private class Hello()
3+
{
4+
val a = 4
5+
}
6+
7+
fun test() {
8+
// no exception is thrown (see KT-3897)
9+
Hello().a
10+
}
11+
12+
// FILE: Hello.java
13+
public class Hello {}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
package
2+
3+
public fun test(): kotlin.Unit
4+
5+
private final class Hello {
6+
public constructor Hello()
7+
public final val a: kotlin.Int = 4
8+
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
9+
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
10+
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
11+
}
12+
13+
public open class Hello {
14+
public constructor Hello()
15+
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
16+
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
17+
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
18+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// FILE: A.java
2+
3+
public class A {
4+
public String foo;
5+
public String foo = "";
6+
}
7+
8+
// FILE: main.kt
9+
10+
fun foo() {
11+
// no exception is thrown (see KT-3898)
12+
A().foo
13+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
package
2+
3+
public fun foo(): kotlin.Unit
4+
5+
public open class A {
6+
public constructor A()
7+
public final var foo: kotlin.String!
8+
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
9+
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
10+
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
11+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
// FILE: A.java
2+
public class A {
3+
public B b() {}
4+
public F f() {}
5+
}
6+
7+
class B { public void bar() {} }
8+
9+
// FILE: C.java
10+
class D {
11+
public void baz() {}
12+
}
13+
14+
// FILE: E.java
15+
class F {
16+
public void foobaz() {}
17+
}
18+
19+
// FILE: main.kt
20+
fun main(x: A) {
21+
x.b().bar()
22+
x.f().<!DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE!>foobaz<!>()
23+
24+
<!UNRESOLVED_REFERENCE!>D<!>().<!DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE!>baz<!>()
25+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
package
2+
3+
public fun main(/*0*/ x: A): kotlin.Unit
4+
5+
public open class A {
6+
public constructor A()
7+
public open fun b(): B!
8+
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
9+
public open fun f(): [ERROR : Unresolved java classifier: F]!
10+
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
11+
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
12+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
// FILE: A.java
2+
public interface A<T extends A<? super T, ?>, S extends A<? super T, ?>> {}
3+
4+
// FILE: C.java
5+
public class C
6+
{
7+
public <T extends A<? super T, ?>, S extends A<? super T, ?>> void f(A<T, S> x){}
8+
}
9+
10+
// FILE: main.kt
11+
fun foo() {
12+
// TODO: uncomment when KT-9597 is fixed
13+
// C().f(object : A<*, *> {})
14+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
package
2+
3+
public fun foo(): kotlin.Unit
4+
5+
public interface A</*0*/ T : A<in T!, *>!, /*1*/ S : A<in T!, *>!> {
6+
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
7+
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
8+
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
9+
}
10+
11+
public open class C {
12+
public constructor C()
13+
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
14+
public open fun </*0*/ T : A<in T!, *>!, /*1*/ S : A<in T!, *>!> f(/*0*/ x: A<T!, S!>!): kotlin.Unit
15+
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
16+
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
17+
}

compiler/tests/org/jetbrains/kotlin/checkers/DiagnosticsTestGenerated.java

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9987,6 +9987,12 @@ public void testComputeIfAbsentConcurrent() throws Exception {
99879987
doTest(fileName);
99889988
}
99899989

9990+
@TestMetadata("differentFilename.kt")
9991+
public void testDifferentFilename() throws Exception {
9992+
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/j+k/differentFilename.kt");
9993+
doTest(fileName);
9994+
}
9995+
99909996
@TestMetadata("enumGetOrdinal.kt")
99919997
public void testEnumGetOrdinal() throws Exception {
99929998
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/j+k/enumGetOrdinal.kt");
@@ -10149,6 +10155,12 @@ public void testKt6720_abstractProperty() throws Exception {
1014910155
doTest(fileName);
1015010156
}
1015110157

10158+
@TestMetadata("kt7523.kt")
10159+
public void testKt7523() throws Exception {
10160+
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/j+k/kt7523.kt");
10161+
doTest(fileName);
10162+
}
10163+
1015210164
@TestMetadata("mutableIterator.kt")
1015310165
public void testMutableIterator() throws Exception {
1015410166
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/j+k/mutableIterator.kt");
@@ -10293,6 +10305,27 @@ public void testUnboxingNulls() throws Exception {
1029310305
doTest(fileName);
1029410306
}
1029510307

10308+
@TestMetadata("compiler/testData/diagnostics/tests/j+k/brokenCode")
10309+
@TestDataPath("$PROJECT_ROOT")
10310+
@RunWith(JUnit3RunnerWithInners.class)
10311+
public static class BrokenCode extends AbstractDiagnosticsTest {
10312+
public void testAllFilesPresentInBrokenCode() throws Exception {
10313+
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/diagnostics/tests/j+k/brokenCode"), Pattern.compile("^(.+)\\.kt$"), true);
10314+
}
10315+
10316+
@TestMetadata("classDuplicates.kt")
10317+
public void testClassDuplicates() throws Exception {
10318+
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/j+k/brokenCode/classDuplicates.kt");
10319+
doTest(fileName);
10320+
}
10321+
10322+
@TestMetadata("fieldDuplicates.kt")
10323+
public void testFieldDuplicates() throws Exception {
10324+
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/j+k/brokenCode/fieldDuplicates.kt");
10325+
doTest(fileName);
10326+
}
10327+
}
10328+
1029610329
@TestMetadata("compiler/testData/diagnostics/tests/j+k/collectionOverrides")
1029710330
@TestDataPath("$PROJECT_ROOT")
1029810331
@RunWith(JUnit3RunnerWithInners.class)

0 commit comments

Comments
 (0)