Add regression test for PROTECTED_CONSTRUCTOR_NOT_IN_SUPER_CALL diagnostic

#KT-20507
This commit is contained in:
Dmitriy Novozhilov
2019-03-21 16:09:46 +03:00
parent 42aa708f16
commit 58189c79ca
5 changed files with 66 additions and 0 deletions
@@ -8081,6 +8081,11 @@ public class FirDiagnosticsSmokeTestGenerated extends AbstractFirDiagnosticsSmok
runTest("compiler/testData/diagnostics/tests/generics/Projections.kt");
}
@TestMetadata("protectedSuperCall.kt")
public void testProtectedSuperCall() throws Exception {
runTest("compiler/testData/diagnostics/tests/generics/protectedSuperCall.kt");
}
@TestMetadata("PseudoRawTypes.kt")
public void testPseudoRawTypes() throws Exception {
runTest("compiler/testData/diagnostics/tests/generics/PseudoRawTypes.kt");
@@ -0,0 +1,21 @@
// !WITH_NEW_INFERENCE
// FILE: GA.kt
package test.x
open class GA<T> protected constructor()
// FILE: Main.kt
package test
import test.x.GA
class C : GA<Any>() {
companion object {
fun bar() = <!PROTECTED_CONSTRUCTOR_NOT_IN_SUPER_CALL!>GA<!><Any>() // Should be error
}
}
fun main(args: Array<String>) {
C.bar()
}
@@ -0,0 +1,30 @@
package
package test {
public fun main(/*0*/ args: kotlin.Array<kotlin.String>): kotlin.Unit
public final class C : test.x.GA<kotlin.Any> {
public constructor C()
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 companion object Companion {
private constructor Companion()
public final fun bar(): test.x.GA<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
}
}
package test.x {
public open class GA</*0*/ T> {
protected constructor GA</*0*/ 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
}
}
}
@@ -8088,6 +8088,11 @@ public class DiagnosticsTestGenerated extends AbstractDiagnosticsTest {
runTest("compiler/testData/diagnostics/tests/generics/Projections.kt");
}
@TestMetadata("protectedSuperCall.kt")
public void testProtectedSuperCall() throws Exception {
runTest("compiler/testData/diagnostics/tests/generics/protectedSuperCall.kt");
}
@TestMetadata("PseudoRawTypes.kt")
public void testPseudoRawTypes() throws Exception {
runTest("compiler/testData/diagnostics/tests/generics/PseudoRawTypes.kt");
@@ -8083,6 +8083,11 @@ public class DiagnosticsUsingJavacTestGenerated extends AbstractDiagnosticsUsing
runTest("compiler/testData/diagnostics/tests/generics/Projections.kt");
}
@TestMetadata("protectedSuperCall.kt")
public void testProtectedSuperCall() throws Exception {
runTest("compiler/testData/diagnostics/tests/generics/protectedSuperCall.kt");
}
@TestMetadata("PseudoRawTypes.kt")
public void testPseudoRawTypes() throws Exception {
runTest("compiler/testData/diagnostics/tests/generics/PseudoRawTypes.kt");