[FE] Prohibit default arguments in expect declarations actualized via typealias
Cases when default argument inhertied from super class are allowed. Some tests for default arguments already exist and can be found in `testData/diagnostics/tests/multiplatform/defaultArguments`, for example `annotationsViaActualTypeAlias.kt`. ^KT-57614 Fixed Merge-request: KT-MR-10356 Merged-by: Roman Efremov <Roman.Efremov@jetbrains.com>
This commit is contained in:
committed by
Space Team
parent
9829a2bf98
commit
d2eb4a0abf
+6
@@ -0,0 +1,6 @@
|
||||
package test
|
||||
|
||||
expect class A(p: String = "constructor") {
|
||||
fun foo(p: String = "common")
|
||||
fun bar(p: String)
|
||||
}
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
package test
|
||||
|
||||
class AImpl(p: String) {
|
||||
fun foo(p: String) {}
|
||||
fun bar(p: String) {}
|
||||
}
|
||||
|
||||
actual typealias A = AImpl
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
-- Common --
|
||||
Exit code: OK
|
||||
Output:
|
||||
|
||||
-- JVM --
|
||||
Exit code: COMPILATION_ERROR
|
||||
Output:
|
||||
compiler/testData/multiplatform/defaultArguments/methodDefaultArgsViaTypealias/jvm.kt:8:1: error: default argument values inside expect declaration 'A' are not allowed if it is actualized via typealias. Possible fix is to remove default argument values in members:
|
||||
public constructor A(p: String = ...)
|
||||
|
||||
public final expect fun foo(p: String = ...): Unit
|
||||
|
||||
actual typealias A = AImpl
|
||||
^
|
||||
Reference in New Issue
Block a user