Synthesized 'copy' in data classes cannot override anything since 1.3
Synthesized 'copy' introduces default values for parameters, which is prohibited for regular overrides. Report warning in language version 1.2-, error in 1.3+.
This commit is contained in:
@@ -0,0 +1,9 @@
|
||||
// !LANGUAGE: +ProhibitDataClassesOverridingCopy
|
||||
|
||||
interface WithCopy<T> {
|
||||
fun copy(str: T): WithCopy<T>
|
||||
}
|
||||
|
||||
data class Test(val str: String, val int: Int) : WithCopy<String> {
|
||||
override fun copy(str: String) = copy(str, int)
|
||||
}
|
||||
Reference in New Issue
Block a user