Merge branch 'diagnostics'
Conflicts: compiler/cli/src/org/jetbrains/jet/compiler/CompileSession.java compiler/frontend/src/org/jetbrains/jet/lang/diagnostics/Errors.java
This commit is contained in:
@@ -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,15 +65,15 @@ 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 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 Any? -> a.<error descr="[UNRESOLVED_REFERENCE] Unresolved reference: bar">bar</error>()
|
||||
is val c : <error descr="[TYPE_MISMATCH_IN_BINDING_PATTERN] B is not 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()
|
||||
else -> a<info>?.</info>foo()
|
||||
}
|
||||
|
||||
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,37 +217,37 @@ 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
|
||||
fun f(): String {
|
||||
var <info>a</info>: Any = 11
|
||||
if (<info>a</info> is String) {
|
||||
val <warning>i</warning>: String = <error descr="[AUTOCAST_IMPOSSIBLE] Automatic cast to jet.String is impossible, because a could have changed since the is-check">a</error>
|
||||
<error descr="[AUTOCAST_IMPOSSIBLE] Automatic cast to jet.String is impossible, because a could have changed since the is-check">a</error>.compareTo("f")
|
||||
val <warning>f</warning>: Function0<String> = { <error descr="[AUTOCAST_IMPOSSIBLE] Automatic cast to jet.String is impossible, because a could have changed since the is-check">a</error> }
|
||||
return <error descr="[AUTOCAST_IMPOSSIBLE] Automatic cast to jet.String is impossible, because a could have changed since the is-check">a</error>
|
||||
val <warning>i</warning>: String = <error descr="[AUTOCAST_IMPOSSIBLE] Automatic cast to 'jet.String' is impossible, because 'a' could have changed since the is-check">a</error>
|
||||
<error descr="[AUTOCAST_IMPOSSIBLE] Automatic cast to 'jet.String' is impossible, because 'a' could have changed since the is-check">a</error>.compareTo("f")
|
||||
val <warning>f</warning>: Function0<String> = { <error descr="[AUTOCAST_IMPOSSIBLE] Automatic cast to 'jet.String' is impossible, because 'a' could have changed since the is-check">a</error> }
|
||||
return <error descr="[AUTOCAST_IMPOSSIBLE] Automatic cast to 'jet.String' is impossible, because 'a' could have changed since the is-check">a</error>
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
fun foo(var a: Any): Int {
|
||||
if (a is Int) {
|
||||
return <error descr="[AUTOCAST_IMPOSSIBLE] Automatic cast to jet.Int is impossible, because a could have changed since the is-check">a</error>
|
||||
return <error descr="[AUTOCAST_IMPOSSIBLE] Automatic cast to 'jet.Int' is impossible, because 'a' could have changed since the is-check">a</error>
|
||||
}
|
||||
return 1
|
||||
}
|
||||
|
||||
@@ -15,12 +15,12 @@ package testData.libraries
|
||||
|
||||
[public final fun func() : Unit { /* compiled code */ }]
|
||||
|
||||
[public final fun func(val a : jet.Int, val b : jet.Int) : Unit { /* compiled code */ }]
|
||||
[public final fun func(a : jet.Int, b : jet.Int) : Unit { /* compiled code */ }]
|
||||
|
||||
[public final fun func(val a : jet.Int, val b : jet.String = /* compiled code */) : Unit { /* compiled code */ }]
|
||||
[public final fun func(a : jet.Int, b : jet.String = /* compiled code */) : Unit { /* compiled code */ }]
|
||||
|
||||
[public final fun func(val str : jet.String) : Unit { /* compiled code */ }]
|
||||
[public final fun func(str : jet.String) : Unit { /* compiled code */ }]
|
||||
|
||||
[public final fun main(val args : jet.Array<jet.String>) : Unit { /* compiled code */ }]
|
||||
[public final fun main(args : jet.Array<jet.String>) : Unit { /* compiled code */ }]
|
||||
|
||||
[public final fun <T : jet.Any?>T.filter(val predicate : (T) -> jet.Boolean) : T? { /* compiled code */ }]
|
||||
[public final fun <T : jet.Any?> T.filter(predicate : (T) -> jet.Boolean) : T? { /* compiled code */ }]
|
||||
|
||||
Reference in New Issue
Block a user