KT-371 Resolve default parameters for constructors

This commit is contained in:
svtk
2011-12-08 18:29:52 +04:00
parent a0cd4af3bd
commit d93818d0f5
10 changed files with 109 additions and 42 deletions
@@ -1,5 +1,15 @@
val x = ""
fun bar(<!UNUSED_PARAMETER!>x<!> : Int = <!TYPE_MISMATCH!>""<!>, <!UNUSED_PARAMETER!>y<!> : Int = <!TYPE_MISMATCH!>x<!>, <!UNUSED_PARAMETER!>z<!> : String = <!UNRESOLVED_REFERENCE!>y<!>) {
fun bar(x : Int = <!TYPE_MISMATCH!>""<!>, y : Int = x, <!UNUSED_PARAMETER!>z<!> : String = <!TYPE_MISMATCH!>y<!>) {
}
}
// KT-371 Resolve default parameters for constructors
class A(x : Int = <!UNINITIALIZED_PARAMETER!>y<!>, y : Int = x) { // None of the references is resolved, no types checked
this(bool: Boolean, a: Int = <!TYPE_MISMATCH, UNINITIALIZED_PARAMETER!>b<!>, b: String = <!TYPE_MISMATCH!>a<!>) : this(1) {}
}
val z = 3
fun foo(x: Int = <!UNINITIALIZED_PARAMETER!>y<!>, y: Int = x, <!UNUSED_PARAMETER!>i<!> : Int = z): Int = x + y