[FIR] Implement DATA_CLASS_OVERRIDE_DEFAULT_VALUES diagnostic
#KT-59415 Fixed
This commit is contained in:
committed by
Space Team
parent
53ff4584d4
commit
06d2befb72
@@ -1,4 +1,6 @@
|
||||
// !LANGUAGE: -ProhibitDataClassesOverridingCopy
|
||||
// IGNORE_BACKEND_K2: ANY
|
||||
// FIR status: Disabling ProhibitDataClassesOverridingCopy is not supported
|
||||
|
||||
fun box(): String {
|
||||
val a: A = B(1)
|
||||
|
||||
Vendored
+2
-2
@@ -4,6 +4,6 @@ interface WithCopy<T> {
|
||||
fun copy(str: T): WithCopy<T>
|
||||
}
|
||||
|
||||
data class Test(val str: String) : WithCopy<String> {
|
||||
<!DATA_CLASS_OVERRIDE_DEFAULT_VALUES!>data<!> class Test(val str: String) : WithCopy<String> {
|
||||
override fun copy(str: String) = Test(str)
|
||||
}
|
||||
}
|
||||
|
||||
compiler/testData/diagnostics/tests/dataClasses/dataClassExplicitlyOverridingCopyWithDefaults.fir.kt
Vendored
+1
-1
@@ -4,6 +4,6 @@ interface WithCopy<T> {
|
||||
fun copy(str: T): WithCopy<T>
|
||||
}
|
||||
|
||||
data class Test(val str: String) : WithCopy<String> {
|
||||
<!DATA_CLASS_OVERRIDE_DEFAULT_VALUES!>data<!> class Test(val str: String) : WithCopy<String> {
|
||||
override fun copy(str: String = <!DEFAULT_VALUE_NOT_ALLOWED_IN_OVERRIDE!>this.str<!>) = Test(str)
|
||||
}
|
||||
|
||||
+1
-1
@@ -4,4 +4,4 @@ interface WithCopy<T> {
|
||||
fun copy(str: T): WithCopy<T>
|
||||
}
|
||||
|
||||
data class Test(val str: String): WithCopy<String>
|
||||
<!DATA_CLASS_OVERRIDE_DEFAULT_VALUES!>data<!> class Test(val str: String): WithCopy<String>
|
||||
|
||||
+1
-1
@@ -4,4 +4,4 @@ interface WithCopy<T> {
|
||||
fun copy(str: T): WithCopy<T>
|
||||
}
|
||||
|
||||
data class Test(val str: String): WithCopy<String>
|
||||
<!DATA_CLASS_OVERRIDE_DEFAULT_VALUES!>data<!> class Test(val str: String): WithCopy<String>
|
||||
|
||||
Reference in New Issue
Block a user