private / protected / internal modifiers are deprecated in interfaces, relevant tests changed
This commit is contained in:
@@ -115,6 +115,7 @@ public interface Errors {
|
||||
DiagnosticFactory2<PsiElement, JetModifierKeywordToken, String> WRONG_MODIFIER_TARGET = DiagnosticFactory2.create(ERROR);
|
||||
DiagnosticFactory2<PsiElement, JetModifierKeywordToken, String> REDUNDANT_MODIFIER_FOR_TARGET = DiagnosticFactory2.create(WARNING);
|
||||
DiagnosticFactory2<PsiElement, JetModifierKeywordToken, String> WRONG_MODIFIER_CONTAINING_DECLARATION = DiagnosticFactory2.create(ERROR);
|
||||
DiagnosticFactory2<PsiElement, JetModifierKeywordToken, String> DEPRECATED_MODIFIER_CONTAINING_DECLARATION = DiagnosticFactory2.create(WARNING);
|
||||
DiagnosticFactory1<JetAnnotationEntry, String> WRONG_ANNOTATION_TARGET = DiagnosticFactory1.create(ERROR);
|
||||
DiagnosticFactory2<JetAnnotationEntry, String, String> WRONG_ANNOTATION_TARGET_WITH_USE_SITE_TARGET = DiagnosticFactory2.create(ERROR);
|
||||
DiagnosticFactory0<JetAnnotationEntry> REPEATED_ANNOTATION = DiagnosticFactory0.create(ERROR);
|
||||
|
||||
+1
@@ -122,6 +122,7 @@ public class DefaultErrorMessages {
|
||||
MAP.put(WRONG_MODIFIER_TARGET, "Modifier ''{0}'' is not applicable to ''{1}''", TO_STRING, TO_STRING);
|
||||
MAP.put(REDUNDANT_MODIFIER_FOR_TARGET, "Modifier ''{0}'' is redundant for ''{1}''", TO_STRING, TO_STRING);
|
||||
MAP.put(WRONG_MODIFIER_CONTAINING_DECLARATION, "Modifier ''{0}'' is not applicable inside ''{1}''", TO_STRING, TO_STRING);
|
||||
MAP.put(DEPRECATED_MODIFIER_CONTAINING_DECLARATION, "Modifier ''{0}'' is deprecated inside ''{1}''", TO_STRING, TO_STRING);
|
||||
MAP.put(WRONG_ANNOTATION_TARGET, "This annotation is not applicable to target ''{0}''", TO_STRING);
|
||||
MAP.put(WRONG_ANNOTATION_TARGET_WITH_USE_SITE_TARGET, "This annotation is not applicable to target ''{0}'' and use site target ''@{1}''", TO_STRING, TO_STRING);
|
||||
MAP.put(REPEATED_ANNOTATION, "This annotation is not repeatable");
|
||||
|
||||
@@ -82,6 +82,12 @@ public object ModifierCheckerCore {
|
||||
COMPANION_KEYWORD to EnumSet.of(CLASS_ONLY, ENUM_CLASS, INTERFACE)
|
||||
)
|
||||
|
||||
private val deprecatedParentTargetMap = mapOf<JetModifierKeywordToken, Set<KotlinTarget>>(
|
||||
PRIVATE_KEYWORD to EnumSet.of(INTERFACE),
|
||||
INTERNAL_KEYWORD to EnumSet.of(INTERFACE),
|
||||
PROTECTED_KEYWORD to EnumSet.of(INTERFACE)
|
||||
)
|
||||
|
||||
// First modifier in pair should be also first in declaration
|
||||
private val mutualCompatibility = buildCompatibilityMap()
|
||||
|
||||
@@ -184,6 +190,11 @@ public object ModifierCheckerCore {
|
||||
is FunctionDescriptor -> listOf(FUNCTION)
|
||||
else -> listOf(FILE)
|
||||
}
|
||||
val deprecatedParents = deprecatedParentTargetMap[modifier]
|
||||
if (deprecatedParents != null && actualParents.any { it in deprecatedParents }) {
|
||||
trace.report(Errors.DEPRECATED_MODIFIER_CONTAINING_DECLARATION.on(node.psi, modifier, actualParents.firstOrNull()?.description ?: "this scope"))
|
||||
return false
|
||||
}
|
||||
val possibleParents = possibleParentTargetMap[modifier] ?: return true
|
||||
if (possibleParents == KotlinTarget.ALL_TARGET_SET) return true
|
||||
if (actualParents.any { it in possibleParents }) return true
|
||||
|
||||
@@ -1,9 +1,6 @@
|
||||
compiler/testData/cli/jvm/multipleTextRangesInDiagnosticsOrder.kt:6:14: error: cannot weaken access privilege 'public' for 'c' in 'A'
|
||||
override protected private val c: Int
|
||||
^
|
||||
compiler/testData/cli/jvm/multipleTextRangesInDiagnosticsOrder.kt:6:14: error: modifier 'protected' is incompatible with 'private'
|
||||
override protected private val c: Int
|
||||
^
|
||||
compiler/testData/cli/jvm/multipleTextRangesInDiagnosticsOrder.kt:6:24: error: modifier 'private' is incompatible with 'protected'
|
||||
override protected private val c: Int
|
||||
^
|
||||
|
||||
+4
-4
@@ -7,10 +7,10 @@ interface MyTrait {
|
||||
<!ABSTRACT_MODIFIER_IN_TRAIT!>abstract<!> val a2: Int
|
||||
<!ABSTRACT_MODIFIER_IN_TRAIT!>abstract<!> val a3: Int = <!ABSTRACT_PROPERTY_WITH_INITIALIZER!>1<!>
|
||||
|
||||
var b: Int private set
|
||||
var b1: Int = <!PROPERTY_INITIALIZER_IN_TRAIT!>0<!>; private set
|
||||
<!ABSTRACT_MODIFIER_IN_TRAIT!>abstract<!> var b2: Int private set
|
||||
<!ABSTRACT_MODIFIER_IN_TRAIT!>abstract<!> var b3: Int = <!ABSTRACT_PROPERTY_WITH_INITIALIZER!>0<!>; private set
|
||||
var b: Int
|
||||
var b1: Int = <!PROPERTY_INITIALIZER_IN_TRAIT!>0<!>
|
||||
<!ABSTRACT_MODIFIER_IN_TRAIT!>abstract<!> var b2: Int
|
||||
<!ABSTRACT_MODIFIER_IN_TRAIT!>abstract<!> var b3: Int = <!ABSTRACT_PROPERTY_WITH_INITIALIZER!>0<!>
|
||||
|
||||
<!BACKING_FIELD_IN_TRAIT!>var c: Int<!> set(v: Int) { field = v }
|
||||
<!BACKING_FIELD_IN_TRAIT!>var c1: Int<!> = <!PROPERTY_INITIALIZER_IN_TRAIT!>0<!>; set(v: Int) { field = v }
|
||||
|
||||
@@ -6,7 +6,7 @@ interface T1<!CONSTRUCTOR_IN_TRAIT!>(val x: String)<!> {}
|
||||
|
||||
interface T2 <!CONSTRUCTOR_IN_TRAIT!>constructor()<!> {}
|
||||
|
||||
interface T3 private <!CONSTRUCTOR_IN_TRAIT!>constructor(<!UNUSED_PARAMETER!>a<!>: Int)<!> {}
|
||||
interface T3 <!CONSTRUCTOR_IN_TRAIT!>constructor(<!UNUSED_PARAMETER!>a<!>: Int)<!> {}
|
||||
|
||||
interface T4 {
|
||||
<!CONSTRUCTOR_IN_TRAIT!>constructor(<!UNUSED_PARAMETER!>a<!>: Int)<!> {
|
||||
@@ -14,5 +14,5 @@ interface T4 {
|
||||
}
|
||||
}
|
||||
|
||||
interface T5 private <!CONSTRUCTOR_IN_TRAIT!>()<!> : T4 {}
|
||||
interface T6 <!CONSTRUCTOR_IN_TRAIT!>private<!><!SYNTAX!><!> : T5 {}
|
||||
interface T5 <!DEPRECATED_MODIFIER_CONTAINING_DECLARATION!>private<!> <!CONSTRUCTOR_IN_TRAIT!>()<!> : T4 {}
|
||||
interface T6 <!CONSTRUCTOR_IN_TRAIT!>public<!><!SYNTAX!><!> : T5 {}
|
||||
@@ -24,7 +24,7 @@ public interface T2 {
|
||||
}
|
||||
|
||||
public interface T3 {
|
||||
private constructor T3(/*0*/ a: kotlin.Int)
|
||||
public constructor T3(/*0*/ a: kotlin.Int)
|
||||
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
|
||||
@@ -45,7 +45,7 @@ public interface T5 : T4 {
|
||||
}
|
||||
|
||||
public interface T6 : T5 {
|
||||
private constructor T6()
|
||||
public constructor T6()
|
||||
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
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
// !DIAGNOSTICS: -CONFLICTING_JVM_DECLARATIONS
|
||||
interface One {
|
||||
public open fun foo() : Int
|
||||
private fun boo() = 10
|
||||
<!DEPRECATED_MODIFIER_CONTAINING_DECLARATION!>private<!> fun boo() = 10
|
||||
}
|
||||
interface Two {
|
||||
public open fun foo() : Int
|
||||
|
||||
@@ -29,20 +29,19 @@ abstract class A {
|
||||
|
||||
interface B {
|
||||
|
||||
inline private fun good1() {}
|
||||
inline public final fun good2() {}
|
||||
inline protected final fun good3() {}
|
||||
inline final fun good3() {}
|
||||
inline final fun good4() {}
|
||||
|
||||
<!DECLARATION_CANT_BE_INLINED!>inline fun wrong1() {}<!>
|
||||
|
||||
<!DECLARATION_CANT_BE_INLINED!>inline open protected fun wrong2() {}<!>
|
||||
<!DECLARATION_CANT_BE_INLINED!>inline open fun wrong2() {}<!>
|
||||
|
||||
<!DECLARATION_CANT_BE_INLINED!>inline open public fun wrong3() {}<!>
|
||||
|
||||
<!DECLARATION_CANT_BE_INLINED!>inline open fun wrong4() {}<!>
|
||||
|
||||
<!DECLARATION_CANT_BE_INLINED!>inline protected fun wrong5()<!>
|
||||
<!DECLARATION_CANT_BE_INLINED!>inline fun wrong5()<!>
|
||||
|
||||
<!DECLARATION_CANT_BE_INLINED!>inline public fun wrong6()<!>
|
||||
|
||||
|
||||
@@ -23,17 +23,16 @@ public abstract class A {
|
||||
|
||||
public interface B {
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
@kotlin.inline() private final fun good1(): kotlin.Unit
|
||||
@kotlin.inline() public final fun good2(): kotlin.Unit
|
||||
@kotlin.inline() protected final fun good3(): kotlin.Unit
|
||||
@kotlin.inline() public final fun good3(): kotlin.Unit
|
||||
@kotlin.inline() public final fun good4(): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
@kotlin.inline() public open fun wrong1(): kotlin.Unit
|
||||
@kotlin.inline() protected open fun wrong2(): kotlin.Unit
|
||||
@kotlin.inline() public open fun wrong2(): kotlin.Unit
|
||||
@kotlin.inline() public open fun wrong3(): kotlin.Unit
|
||||
@kotlin.inline() public open fun wrong4(): kotlin.Unit
|
||||
@kotlin.inline() protected abstract fun wrong5(): kotlin.Unit
|
||||
@kotlin.inline() public abstract fun wrong5(): kotlin.Unit
|
||||
@kotlin.inline() public abstract fun wrong6(): kotlin.Unit
|
||||
@kotlin.inline() public abstract fun wrong7(): kotlin.Unit
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package test
|
||||
|
||||
interface A {
|
||||
private val a: String
|
||||
<!DEPRECATED_MODIFIER_CONTAINING_DECLARATION!>private<!> val a: String
|
||||
get() = "AAAA!"
|
||||
}
|
||||
|
||||
|
||||
@@ -1,13 +0,0 @@
|
||||
package test
|
||||
|
||||
interface A {
|
||||
protected val a: String
|
||||
}
|
||||
|
||||
open class C {
|
||||
protected val a: String = ""
|
||||
}
|
||||
|
||||
class Subject : C(), A {
|
||||
val c = a
|
||||
}
|
||||
@@ -1,28 +0,0 @@
|
||||
package
|
||||
|
||||
package test {
|
||||
|
||||
public interface A {
|
||||
protected abstract val a: 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 C {
|
||||
public constructor C()
|
||||
protected final val a: 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 Subject : test.C, test.A {
|
||||
public constructor Subject()
|
||||
protected final override /*2*/ /*fake_override*/ val a: kotlin.String
|
||||
public final val c: kotlin.String
|
||||
public open override /*2*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*2*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*2*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
}
|
||||
+2
-2
@@ -1,9 +1,9 @@
|
||||
interface T {
|
||||
internal var foo: Long
|
||||
<!DEPRECATED_MODIFIER_CONTAINING_DECLARATION!>internal<!> var foo: Long
|
||||
}
|
||||
|
||||
interface U {
|
||||
protected var foo: Long
|
||||
<!DEPRECATED_MODIFIER_CONTAINING_DECLARATION!>protected<!> var foo: Long
|
||||
}
|
||||
|
||||
interface V : T, U {
|
||||
|
||||
+2
-2
@@ -1,11 +1,11 @@
|
||||
interface T {
|
||||
public var foo: Short
|
||||
internal set
|
||||
<!DEPRECATED_MODIFIER_CONTAINING_DECLARATION!>internal<!> set
|
||||
}
|
||||
|
||||
interface U {
|
||||
public var foo: Short
|
||||
protected set
|
||||
<!DEPRECATED_MODIFIER_CONTAINING_DECLARATION!>protected<!> set
|
||||
}
|
||||
|
||||
interface V : T, U {
|
||||
|
||||
+2
-2
@@ -1,11 +1,11 @@
|
||||
package test
|
||||
|
||||
interface A {
|
||||
protected val a: String
|
||||
val a: String
|
||||
}
|
||||
|
||||
interface B {
|
||||
protected val a: String
|
||||
val a: String
|
||||
}
|
||||
|
||||
open class C {
|
||||
|
||||
+3
-3
@@ -3,14 +3,14 @@ package
|
||||
package test {
|
||||
|
||||
public interface A {
|
||||
protected abstract val a: kotlin.String
|
||||
public abstract val a: 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 interface B {
|
||||
protected abstract val a: kotlin.String
|
||||
public abstract val a: 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
|
||||
@@ -26,7 +26,7 @@ package test {
|
||||
|
||||
public final class Subject : test.C, test.A, test.B {
|
||||
public constructor Subject()
|
||||
protected abstract override /*2*/ /*fake_override*/ val a: kotlin.String
|
||||
public abstract override /*2*/ /*fake_override*/ val a: kotlin.String
|
||||
public final val c: kotlin.String
|
||||
public open override /*3*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*3*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
interface T {
|
||||
internal fun foo()
|
||||
fun foo()
|
||||
}
|
||||
|
||||
open class C {
|
||||
|
||||
+1
-1
@@ -20,7 +20,7 @@ public final class E : C, T {
|
||||
|
||||
public interface T {
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
internal abstract fun foo(): kotlin.Unit
|
||||
public abstract fun foo(): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
@@ -1,13 +0,0 @@
|
||||
interface A {
|
||||
internal fun foo()
|
||||
}
|
||||
|
||||
interface B {
|
||||
protected fun foo() {}
|
||||
}
|
||||
|
||||
class C {
|
||||
companion <!CANNOT_INFER_VISIBILITY!>object<!> : A, B {
|
||||
fun bar() = null
|
||||
}
|
||||
}
|
||||
@@ -1,31 +0,0 @@
|
||||
package
|
||||
|
||||
public interface A {
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
internal abstract fun foo(): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public interface B {
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
protected open fun foo(): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public final class C {
|
||||
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 : A, B {
|
||||
private constructor Companion()
|
||||
public final fun bar(): kotlin.Nothing?
|
||||
public open override /*2*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*2*/ /*fake_override*/ fun foo(): kotlin.Unit
|
||||
public open override /*2*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*2*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
interface A {
|
||||
internal fun foo()
|
||||
}
|
||||
|
||||
interface B {
|
||||
protected fun foo()
|
||||
}
|
||||
|
||||
class <!CANNOT_INFER_VISIBILITY!>E(a: A)<!> : A by a, B
|
||||
@@ -1,23 +0,0 @@
|
||||
package
|
||||
|
||||
public interface A {
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
internal abstract fun foo(): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public interface B {
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
protected abstract fun foo(): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public final class E : A, B {
|
||||
public constructor E(/*0*/ a: A)
|
||||
public open override /*2*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*2*/ /*delegation*/ fun foo(): kotlin.Unit
|
||||
public open override /*2*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*2*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
@@ -69,17 +69,17 @@ class M : L() {
|
||||
}
|
||||
//---------------
|
||||
interface R {
|
||||
<!INCOMPATIBLE_MODIFIERS!>internal<!> <!INCOMPATIBLE_MODIFIERS!>protected<!> fun foo() {}
|
||||
fun foo() {}
|
||||
}
|
||||
|
||||
interface P : R {
|
||||
<!CANNOT_CHANGE_ACCESS_PRIVILEGE!>internal<!> override fun foo() {}
|
||||
override fun foo() {}
|
||||
}
|
||||
|
||||
interface Q : R {
|
||||
protected override fun foo() {}
|
||||
override fun foo() {}
|
||||
}
|
||||
|
||||
class S : P, Q {
|
||||
<!CANNOT_CHANGE_ACCESS_PRIVILEGE!>internal<!> override fun foo() {}
|
||||
<!CANNOT_WEAKEN_ACCESS_PRIVILEGE!>internal<!> override fun foo() {}
|
||||
}
|
||||
@@ -110,21 +110,21 @@ package b {
|
||||
|
||||
public interface P : b.R {
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
internal open override /*1*/ fun foo(): kotlin.Unit
|
||||
public open override /*1*/ fun foo(): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public interface Q : b.R {
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
protected open override /*1*/ fun foo(): kotlin.Unit
|
||||
public open override /*1*/ fun foo(): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public interface R {
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
protected open fun foo(): kotlin.Unit
|
||||
public open fun foo(): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
+2
-2
@@ -20,7 +20,7 @@ open class C {
|
||||
}
|
||||
|
||||
interface T {
|
||||
protected fun foo() {}
|
||||
fun foo() {}
|
||||
}
|
||||
|
||||
class D : C(), T {
|
||||
@@ -28,7 +28,7 @@ class D : C(), T {
|
||||
}
|
||||
|
||||
class E : C(), T {
|
||||
<!CANNOT_CHANGE_ACCESS_PRIVILEGE!>internal<!> override fun foo() {}
|
||||
<!CANNOT_WEAKEN_ACCESS_PRIVILEGE!>internal<!> override fun foo() {}
|
||||
}
|
||||
|
||||
class F : C(), T {
|
||||
|
||||
+1
-1
@@ -61,7 +61,7 @@ package kt151 {
|
||||
|
||||
public interface T {
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
protected open fun foo(): kotlin.Unit
|
||||
public open fun foo(): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
+2
-2
@@ -6,7 +6,7 @@ open class C {
|
||||
}
|
||||
|
||||
interface T {
|
||||
protected fun foo() {}
|
||||
<!DEPRECATED_MODIFIER_CONTAINING_DECLARATION!>protected<!> fun foo() {}
|
||||
}
|
||||
|
||||
class G : C(), T {
|
||||
@@ -18,7 +18,7 @@ open class A {
|
||||
}
|
||||
|
||||
interface B {
|
||||
protected fun foo() {}
|
||||
<!DEPRECATED_MODIFIER_CONTAINING_DECLARATION!>protected<!> fun foo() {}
|
||||
}
|
||||
|
||||
interface D {
|
||||
|
||||
+10
-10
@@ -1,20 +1,20 @@
|
||||
interface Test<in I, out O> {
|
||||
val internal_val: <!TYPE_VARIANCE_CONFLICT!>I<!>
|
||||
public val public_val: <!TYPE_VARIANCE_CONFLICT!>I<!>
|
||||
protected val protected_val: <!TYPE_VARIANCE_CONFLICT!>I<!>
|
||||
private val private_val: I
|
||||
<!DEPRECATED_MODIFIER_CONTAINING_DECLARATION!>protected<!> val protected_val: <!TYPE_VARIANCE_CONFLICT!>I<!>
|
||||
<!DEPRECATED_MODIFIER_CONTAINING_DECLARATION!>private<!> val private_val: I
|
||||
|
||||
var interlan_private_set: <!TYPE_VARIANCE_CONFLICT!>O<!>
|
||||
private set
|
||||
<!DEPRECATED_MODIFIER_CONTAINING_DECLARATION!>private<!> set
|
||||
public var public_private_set: <!TYPE_VARIANCE_CONFLICT!>O<!>
|
||||
private set
|
||||
protected var protected_private_set: <!TYPE_VARIANCE_CONFLICT!>O<!>
|
||||
private set
|
||||
private var private_private_set: O
|
||||
private set
|
||||
<!DEPRECATED_MODIFIER_CONTAINING_DECLARATION!>private<!> set
|
||||
<!DEPRECATED_MODIFIER_CONTAINING_DECLARATION!>protected<!> var protected_private_set: <!TYPE_VARIANCE_CONFLICT!>O<!>
|
||||
<!DEPRECATED_MODIFIER_CONTAINING_DECLARATION!>private<!> set
|
||||
<!DEPRECATED_MODIFIER_CONTAINING_DECLARATION!>private<!> var private_private_set: O
|
||||
<!DEPRECATED_MODIFIER_CONTAINING_DECLARATION!>private<!> set
|
||||
|
||||
fun internal_fun(i: <!TYPE_VARIANCE_CONFLICT!>O<!>) : <!TYPE_VARIANCE_CONFLICT!>I<!>
|
||||
public fun public_fun(i: <!TYPE_VARIANCE_CONFLICT!>O<!>) : <!TYPE_VARIANCE_CONFLICT!>I<!>
|
||||
protected fun protected_fun(i: <!TYPE_VARIANCE_CONFLICT!>O<!>) : <!TYPE_VARIANCE_CONFLICT!>I<!>
|
||||
private fun private_fun(i: O) : I
|
||||
<!DEPRECATED_MODIFIER_CONTAINING_DECLARATION!>protected<!> fun protected_fun(i: <!TYPE_VARIANCE_CONFLICT!>O<!>) : <!TYPE_VARIANCE_CONFLICT!>I<!>
|
||||
<!DEPRECATED_MODIFIER_CONTAINING_DECLARATION!>private<!> fun private_fun(i: O) : I
|
||||
}
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
internal interface Test</*0*/ in I> {
|
||||
internal abstract class Test</*0*/ in I> {
|
||||
private/*private to this*/ final fun foo(): I {
|
||||
throw Exception()
|
||||
}
|
||||
+2
-1
@@ -1,6 +1,7 @@
|
||||
package
|
||||
|
||||
internal interface Test</*0*/ in I> {
|
||||
internal abstract class Test</*0*/ in I> {
|
||||
public constructor Test</*0*/ in I>()
|
||||
private/*private to this*/ final val i: I
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
private/*private to this*/ final fun foo(): I
|
||||
@@ -10107,12 +10107,6 @@ public class JetDiagnosticsTestGenerated extends AbstractJetDiagnosticsTest {
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("AllProtectedFromSupertypes.kt")
|
||||
public void testAllProtectedFromSupertypes() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/override/AllProtectedFromSupertypes.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("CannotInferVisibilityForProperty.kt")
|
||||
public void testCannotInferVisibilityForProperty() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/override/CannotInferVisibilityForProperty.kt");
|
||||
@@ -10257,18 +10251,6 @@ public class JetDiagnosticsTestGenerated extends AbstractJetDiagnosticsTest {
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("kt4785classObject.kt")
|
||||
public void testKt4785classObject() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/override/kt4785classObject.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("kt4785delegation.kt")
|
||||
public void testKt4785delegation() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/override/kt4785delegation.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("kt880.kt")
|
||||
public void testKt880() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/override/kt880.kt");
|
||||
@@ -15538,6 +15520,12 @@ public class JetDiagnosticsTestGenerated extends AbstractJetDiagnosticsTest {
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class PrivateToThis extends AbstractJetDiagnosticsTest {
|
||||
@TestMetadata("Abstract.kt")
|
||||
public void testAbstract() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/variance/privateToThis/Abstract.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
public void testAllFilesPresentInPrivateToThis() throws Exception {
|
||||
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/diagnostics/tests/variance/privateToThis"), Pattern.compile("^(.+)\\.kt$"), true);
|
||||
}
|
||||
@@ -15560,12 +15548,6 @@ public class JetDiagnosticsTestGenerated extends AbstractJetDiagnosticsTest {
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("Trait.kt")
|
||||
public void testTrait() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/variance/privateToThis/Trait.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("ValReassigned.kt")
|
||||
public void testValReassigned() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/variance/privateToThis/ValReassigned.kt");
|
||||
|
||||
Vendored
+4
-4
@@ -70,10 +70,10 @@ interface MyTrait {
|
||||
<warning>abstract</warning> val a2: Int
|
||||
<warning>abstract</warning> val a3: Int = <error>1</error>
|
||||
|
||||
var b: Int private set
|
||||
var b1: Int = <error>0</error>; private set
|
||||
<warning>abstract</warning> var b2: Int private set
|
||||
<warning>abstract</warning> var b3: Int = <error>0</error>; private set
|
||||
var b: Int
|
||||
var b1: Int = <error>0</error>;
|
||||
<warning>abstract</warning> var b2: Int
|
||||
<warning>abstract</warning> var b3: Int = <error>0</error>;
|
||||
|
||||
<error>var c: Int</error> set(v: Int) { field = v }
|
||||
<error>var c1: Int</error> = <error>0</error>; set(v: Int) { field = v }
|
||||
|
||||
Reference in New Issue
Block a user