More accurate error reporting

with type inference error for delegated properties
Add the constraints from completer if they don't lead to errors
except errors from upper bounds to improve diagnostics
This commit is contained in:
Svetlana Isakova
2015-06-27 14:26:03 +03:00
parent 9a5abf368f
commit cf64687b02
5 changed files with 41 additions and 8 deletions
@@ -1,10 +1,10 @@
package foo
open class A {
val B.w: Int by <!TYPE_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>MyProperty<!>()
val B.w: Int by <!TYPE_INFERENCE_UPPER_BOUND_VIOLATED!>MyProperty<!>()
}
val B.r: Int by <!TYPE_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>MyProperty<!>()
val B.r: Int by <!TYPE_INFERENCE_UPPER_BOUND_VIOLATED!>MyProperty<!>()
val A.e: Int by MyProperty()
@@ -0,0 +1,12 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER
class A(val map: MutableMap<String, CharSequence>) {
var a: String by map.withDefault1 { "foo" }
}
fun <G> MutableMap<in String, in G>.get(thisRef: Any?, property: PropertyMetadata): G = throw Exception()
fun <S> MutableMap<in String, in S>.set(thisRef: Any?, property: PropertyMetadata, value: S) {}
fun <K, V> MutableMap<K, V>.withDefault1(default: (key: K) -> V): MutableMap<K, V> = this
@@ -0,0 +1,14 @@
package
internal fun </*0*/ G> kotlin.MutableMap<in kotlin.String, in G>.get(/*0*/ thisRef: kotlin.Any?, /*1*/ property: kotlin.PropertyMetadata): G
internal fun </*0*/ S> kotlin.MutableMap<in kotlin.String, in S>.set(/*0*/ thisRef: kotlin.Any?, /*1*/ property: kotlin.PropertyMetadata, /*2*/ value: S): kotlin.Unit
internal fun </*0*/ K, /*1*/ V> kotlin.MutableMap<K, V>.withDefault1(/*0*/ default: (K) -> V): kotlin.MutableMap<K, V>
internal final class A {
public constructor A(/*0*/ map: kotlin.MutableMap<kotlin.String, kotlin.CharSequence>)
internal final var a: kotlin.String
internal final val map: kotlin.MutableMap<kotlin.String, kotlin.CharSequence>
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}