private and override are no more compatible
This commit is contained in:
@@ -115,6 +115,9 @@ public object ModifierCheckerCore {
|
|||||||
result += incompatibilityRegister(CONST_KEYWORD, ABSTRACT_KEYWORD)
|
result += incompatibilityRegister(CONST_KEYWORD, ABSTRACT_KEYWORD)
|
||||||
result += incompatibilityRegister(CONST_KEYWORD, OPEN_KEYWORD)
|
result += incompatibilityRegister(CONST_KEYWORD, OPEN_KEYWORD)
|
||||||
result += incompatibilityRegister(CONST_KEYWORD, OVERRIDE_KEYWORD)
|
result += incompatibilityRegister(CONST_KEYWORD, OVERRIDE_KEYWORD)
|
||||||
|
|
||||||
|
// private is incompatible with override
|
||||||
|
result += incompatibilityRegister(PRIVATE_KEYWORD, OVERRIDE_KEYWORD)
|
||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,10 +1,13 @@
|
|||||||
|
compiler/testData/cli/jvm/multipleTextRangesInDiagnosticsOrder.kt:6:5: error: modifier 'override' is incompatible with 'private'
|
||||||
|
override protected private val c: Int
|
||||||
|
^
|
||||||
compiler/testData/cli/jvm/multipleTextRangesInDiagnosticsOrder.kt:6:14: error: cannot weaken access privilege 'public' for 'c' in 'A'
|
compiler/testData/cli/jvm/multipleTextRangesInDiagnosticsOrder.kt:6:14: error: cannot weaken access privilege 'public' for 'c' in 'A'
|
||||||
override protected private val c: Int
|
override protected private val c: Int
|
||||||
^
|
^
|
||||||
compiler/testData/cli/jvm/multipleTextRangesInDiagnosticsOrder.kt:6:14: error: modifier 'protected' is incompatible with 'private'
|
compiler/testData/cli/jvm/multipleTextRangesInDiagnosticsOrder.kt:6:14: error: modifier 'protected' is incompatible with 'private'
|
||||||
override protected private val c: Int
|
override protected private val c: Int
|
||||||
^
|
^
|
||||||
compiler/testData/cli/jvm/multipleTextRangesInDiagnosticsOrder.kt:6:24: error: modifier 'private' is incompatible with 'protected'
|
compiler/testData/cli/jvm/multipleTextRangesInDiagnosticsOrder.kt:6:24: error: modifier 'private' is incompatible with 'override'
|
||||||
override protected private val c: Int
|
override protected private val c: Int
|
||||||
^
|
^
|
||||||
COMPILATION_ERROR
|
COMPILATION_ERROR
|
||||||
|
|||||||
+1
-1
@@ -32,7 +32,7 @@ class E : C(), T {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class F : C(), T {
|
class F : C(), T {
|
||||||
<!CANNOT_WEAKEN_ACCESS_PRIVILEGE!>private<!> override fun foo() {}
|
<!CANNOT_WEAKEN_ACCESS_PRIVILEGE, INCOMPATIBLE_MODIFIERS!>private<!> <!INCOMPATIBLE_MODIFIERS!>override<!> fun foo() {}
|
||||||
}
|
}
|
||||||
|
|
||||||
class G : C(), T {
|
class G : C(), T {
|
||||||
|
|||||||
Reference in New Issue
Block a user