Replaced Diagnostic.getMessage() with DiagnosticRenderer.render() calls.

Made Diagnostic.getMessage() deprecated, introduced DiagnosticRender interface and default implementation for it.
This commit is contained in:
Evgeny Gerashchenko
2012-04-12 13:56:53 +04:00
parent 409d6b2da1
commit 6a13510741
8 changed files with 107 additions and 35 deletions
+23 -23
View File
@@ -8,19 +8,19 @@ class B() : A() {
fun f9(a : A?) {
a<info>?.</info>foo()
a<info>?.</info><error descr="Unresolved reference: bar">bar</error>()
a<info>?.</info><error descr="[UNRESOLVED_REFERENCE] Unresolved reference: bar">bar</error>()
if (a is B) {
<info descr="Automatically cast to B">a</info>.bar()
<info descr="Automatically cast to B">a</info>.foo()
}
a<info>?.</info>foo()
a<info>?.</info><error descr="Unresolved reference: bar">bar</error>()
a<info>?.</info><error descr="[UNRESOLVED_REFERENCE] Unresolved reference: bar">bar</error>()
if (!(a is B)) {
a<info>?.</info><error descr="Unresolved reference: bar">bar</error>()
a<info>?.</info><error descr="[UNRESOLVED_REFERENCE] Unresolved reference: bar">bar</error>()
a<info>?.</info>foo()
}
if (!(a is B) || <info descr="Automatically cast to B">a</info>.bar() == #()) {
a<info>?.</info><error descr="Unresolved reference: bar">bar</error>()
a<info>?.</info><error descr="[UNRESOLVED_REFERENCE] Unresolved reference: bar">bar</error>()
}
if (!(a is B)) {
return;
@@ -55,7 +55,7 @@ fun f11(a : A?) {
is B -> <info descr="Automatically cast to B">a</info>.bar()
is A -> <info descr="Automatically cast to A">a</info>.foo()
is Any -> <info descr="Automatically cast to A">a</info>.foo()
is Any? -> a.<error descr="Unresolved reference: bar">bar</error>()
is Any? -> a.<error descr="[UNRESOLVED_REFERENCE] Unresolved reference: bar">bar</error>()
else -> a<info>?.</info>foo()
}
}
@@ -65,7 +65,7 @@ fun f12(a : A?) {
is B -> <info descr="Automatically cast to B">a</info>.bar()
is A -> <info descr="Automatically cast to A">a</info>.foo()
is Any -> <info descr="Automatically cast to A">a</info>.foo();
is Any? -> a.<error descr="Unresolved reference: bar">bar</error>()
is Any? -> a.<error descr="[UNRESOLVED_REFERENCE] Unresolved reference: bar">bar</error>()
is val c : <error descr="[TYPE_MISMATCH_IN_BINDING_PATTERN] B must be a supertype of A?. Use is to match against B">B</error> -> c.foo()
is val c is C -> <info descr="Automatically cast to C">c</info>.bar()
is val c is C -> <info descr="Automatically cast to C">a</info>.bar()
@@ -73,7 +73,7 @@ fun f12(a : A?) {
}
if (a is val b) {
a<info>?.</info><error descr="Unresolved reference: bar">bar</error>()
a<info>?.</info><error descr="[UNRESOLVED_REFERENCE] Unresolved reference: bar">bar</error>()
b<info>?.</info>foo()
}
if (a is val b is B) {
@@ -90,17 +90,17 @@ fun f13(a : A?) {
}
else {
a<info>?.</info>foo()
<error descr="Unresolved reference: c">c</error>.bar()
<error descr="[UNRESOLVED_REFERENCE] Unresolved reference: c">c</error>.bar()
}
a<info>?.</info>foo()
if (!(a is val c is B)) {
a<info>?.</info>foo()
<error descr="Unresolved reference: c">c</error>.bar()
<error descr="[UNRESOLVED_REFERENCE] Unresolved reference: c">c</error>.bar()
}
else {
<info descr="Automatically cast to B">a</info>.foo()
<error descr="Unresolved reference: c">c</error>.bar()
<error descr="[UNRESOLVED_REFERENCE] Unresolved reference: c">c</error>.bar()
}
a<info>?.</info>foo()
@@ -110,16 +110,16 @@ fun f13(a : A?) {
}
else {
a<info>?.</info>foo()
<error descr="Unresolved reference: c">c</error>.bar()
<error descr="[UNRESOLVED_REFERENCE] Unresolved reference: c">c</error>.bar()
}
if (!(a is val c is B) || !(a is val x is C)) {
<error descr="Unresolved reference: x">x</error>
<error descr="Unresolved reference: c">c</error>
<error descr="[UNRESOLVED_REFERENCE] Unresolved reference: x">x</error>
<error descr="[UNRESOLVED_REFERENCE] Unresolved reference: c">c</error>
}
else {
<error descr="Unresolved reference: x">x</error>
<error descr="Unresolved reference: c">c</error>
<error descr="[UNRESOLVED_REFERENCE] Unresolved reference: x">x</error>
<error descr="[UNRESOLVED_REFERENCE] Unresolved reference: c">c</error>
}
if (!(a is val c is B) || !(a is val c is C)) {
@@ -127,21 +127,21 @@ fun f13(a : A?) {
if (!(a is val c is B)) return
<info descr="Automatically cast to B">a</info>.bar()
<error descr="Unresolved reference: c">c</error>.foo()
<error descr="Unresolved reference: c">c</error>.bar()
<error descr="[UNRESOLVED_REFERENCE] Unresolved reference: c">c</error>.foo()
<error descr="[UNRESOLVED_REFERENCE] Unresolved reference: c">c</error>.bar()
}
fun f14(a : A?) {
while (!(a is val c is B)) {
}
<info descr="Automatically cast to B">a</info>.bar()
<error descr="Unresolved reference: c">c</error>.bar()
<error descr="[UNRESOLVED_REFERENCE] Unresolved reference: c">c</error>.bar()
}
fun f15(a : A?) {
do {
} while (!(a is val c is B))
<info descr="Automatically cast to B">a</info>.bar()
<error descr="Unresolved reference: c">c</error>.bar()
<error descr="[UNRESOLVED_REFERENCE] Unresolved reference: c">c</error>.bar()
}
fun getStringLength(obj : Any) : Char? {
@@ -217,20 +217,20 @@ fun declarationInsidePattern(x: #(Any, Any)): String = when(x) { is #(val a is S
fun mergeAutocasts(a: Any?) {
if (a is String || a is Int) {
a.<error descr="Unresolved reference: compareTo">compareTo</error>("")
a.<error descr="[UNRESOLVED_REFERENCE] Unresolved reference: compareTo">compareTo</error>("")
<info descr="Automatically cast to jet.Any">a</info>.toString()
}
if (a is Int || a is String) {
a.<error descr="Unresolved reference: compareTo">compareTo</error>("")
a.<error descr="[UNRESOLVED_REFERENCE] Unresolved reference: compareTo">compareTo</error>("")
}
<error>when</error> (a) {
is String, is Any -> a.<error descr="Unresolved reference: compareTo">compareTo</error>("")
is String, is Any -> a.<error descr="[UNRESOLVED_REFERENCE] Unresolved reference: compareTo">compareTo</error>("")
}
if (a is String && a is Any) {
val <warning>i</warning>: Int = <info descr="Automatically cast to jet.String">a</info>.compareTo("")
}
if (a is String && <info descr="Automatically cast to jet.String">a</info>.compareTo("") == 0) {}
if (a is String || a.<error descr="Unresolved reference: compareTo">compareTo</error>("") == 0) {}
if (a is String || a.<error descr="[UNRESOLVED_REFERENCE] Unresolved reference: compareTo">compareTo</error>("") == 0) {}
}
//mutability