backend/tests: add defaults{4,5,6}
This commit is contained in:
committed by
Konstantin Anisimov
parent
486d95c101
commit
709113fde7
@@ -189,6 +189,24 @@ task defaults3(type: RunKonanTest) {
|
||||
source = "codegen/function/defaults3.kt"
|
||||
}
|
||||
|
||||
task defaults4(type: RunKonanTest) {
|
||||
disabled = true
|
||||
goldValue = "43\n"
|
||||
source = "codegen/function/defaults4.kt"
|
||||
}
|
||||
|
||||
task defaults5(type: RunKonanTest) {
|
||||
disabled = true
|
||||
goldValue = "5\n6\n"
|
||||
source = "codegen/function/defaults5.kt"
|
||||
}
|
||||
|
||||
task defaults6(type: RunKonanTest) {
|
||||
disabled = true
|
||||
goldValue = "42\n"
|
||||
source = "codegen/function/defaults6.kt"
|
||||
}
|
||||
|
||||
|
||||
task sum_3const(type: RunKonanTest) {
|
||||
source = "codegen/function/sum_3const.kt"
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
open class A {
|
||||
open fun foo(x: Int = 42) = println(x)
|
||||
}
|
||||
|
||||
class B : A() {
|
||||
override fun foo(x: Int) = println(x + 1)
|
||||
}
|
||||
|
||||
fun main(args: Array<String>) {
|
||||
B().foo()
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
class Test(val x: Int) {
|
||||
fun foo(y: Int = x) {
|
||||
println(y)
|
||||
}
|
||||
}
|
||||
|
||||
fun Test.bar(y: Int = x) {
|
||||
println(y)
|
||||
}
|
||||
|
||||
fun main(args: Array<String>) {
|
||||
Test(5).foo()
|
||||
Test(6).bar()
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
open class Foo(val x: Int = 42)
|
||||
class Bar : Foo()
|
||||
|
||||
fun main(args: Array<String>) {
|
||||
println(Bar().x)
|
||||
}
|
||||
Reference in New Issue
Block a user