Clarified error message for TYPE_MISMATCH_IN_BINDING_PATTERN.
This commit is contained in:
+1
-1
@@ -305,7 +305,7 @@ public class DefaultErrorMessages {
|
|||||||
MAP.put(TYPE_MISMATCH_IN_CONDITION, "Condition must be of type jet.Boolean, but is of type {0}", RENDER_TYPE);
|
MAP.put(TYPE_MISMATCH_IN_CONDITION, "Condition must be of type jet.Boolean, but is of type {0}", RENDER_TYPE);
|
||||||
MAP.put(TYPE_MISMATCH_IN_TUPLE_PATTERN, "Type mismatch: subject is of type {0} but the pattern is of type Tuple{1}", RENDER_TYPE,
|
MAP.put(TYPE_MISMATCH_IN_TUPLE_PATTERN, "Type mismatch: subject is of type {0} but the pattern is of type Tuple{1}", RENDER_TYPE,
|
||||||
TO_STRING); // TODO: message
|
TO_STRING); // TODO: message
|
||||||
MAP.put(TYPE_MISMATCH_IN_BINDING_PATTERN, "{0} must be a supertype of {1}. Use 'is' to match against {0}", RENDER_TYPE, RENDER_TYPE);
|
MAP.put(TYPE_MISMATCH_IN_BINDING_PATTERN, "{0} is not a supertype of {1}. Use ''is'' to match against {0}", RENDER_TYPE, RENDER_TYPE);
|
||||||
MAP.put(INCOMPATIBLE_TYPES, "Incompatible types: {0} and {1}", RENDER_TYPE, RENDER_TYPE);
|
MAP.put(INCOMPATIBLE_TYPES, "Incompatible types: {0} and {1}", RENDER_TYPE, RENDER_TYPE);
|
||||||
MAP.put(EXPECTED_CONDITION, "Expected condition of Boolean type");
|
MAP.put(EXPECTED_CONDITION, "Expected condition of Boolean type");
|
||||||
|
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ fun f12(a : A?) {
|
|||||||
is A -> <info descr="Automatically cast to A">a</info>.foo()
|
is A -> <info descr="Automatically cast to A">a</info>.foo()
|
||||||
is Any -> <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] 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 : <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">c</info>.bar()
|
||||||
is val c is C -> <info descr="Automatically cast to C">a</info>.bar()
|
is val c is C -> <info descr="Automatically cast to C">a</info>.bar()
|
||||||
else -> a<info>?.</info>foo()
|
else -> a<info>?.</info>foo()
|
||||||
@@ -237,17 +237,17 @@ fun mergeAutocasts(a: Any?) {
|
|||||||
fun f(): String {
|
fun f(): String {
|
||||||
var <info>a</info>: Any = 11
|
var <info>a</info>: Any = 11
|
||||||
if (<info>a</info> is String) {
|
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>
|
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")
|
<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> }
|
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 <error descr="[AUTOCAST_IMPOSSIBLE] Automatic cast to 'jet.String' is impossible, because 'a' could have changed since the is-check">a</error>
|
||||||
}
|
}
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
|
||||||
fun foo(var a: Any): Int {
|
fun foo(var a: Any): Int {
|
||||||
if (a is 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
|
return 1
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user