bug with incorrect merge of data flow info (KT-104) fixed
This commit is contained in:
@@ -163,7 +163,7 @@ public class DataFlowInfo {
|
|||||||
builder.put(variableDescriptor, thisFlags.or(otherFlags));
|
builder.put(variableDescriptor, thisFlags.or(otherFlags));
|
||||||
}
|
}
|
||||||
|
|
||||||
ListMultimap<VariableDescriptor, JetType> newTypeInfo = copyTypeInfo();
|
ListMultimap<VariableDescriptor, JetType> newTypeInfo = Multimaps.newListMultimap(Maps.<VariableDescriptor, Collection<JetType>>newHashMap(), ARRAY_LIST_SUPPLIER);
|
||||||
|
|
||||||
Set<VariableDescriptor> keys = newTypeInfo.keySet();
|
Set<VariableDescriptor> keys = newTypeInfo.keySet();
|
||||||
keys.retainAll(other.typeInfo.keySet());
|
keys.retainAll(other.typeInfo.keySet());
|
||||||
|
|||||||
@@ -216,3 +216,19 @@ fun returnFunctionLiteral(a: Any?): Function0<Int> =
|
|||||||
fun illegalTupleReturnType(a: Any): (Any, String) = (a, <error>a</error>)
|
fun illegalTupleReturnType(a: Any): (Any, String) = (a, <error>a</error>)
|
||||||
|
|
||||||
fun declarationInsidePattern(x: (Any, Any)): String = when(x) { is (val a is String, *) => <info descr="Automatically cast to String">a</info>; else => "something" }
|
fun declarationInsidePattern(x: (Any, Any)): String = when(x) { is (val a is String, *) => <info descr="Automatically cast to String">a</info>; else => "something" }
|
||||||
|
|
||||||
|
fun mergeAutocasts(a: Any?) {
|
||||||
|
if (a is String || a is Int) {
|
||||||
|
a.<error>compareTo</error>("")
|
||||||
|
a.toString()
|
||||||
|
}
|
||||||
|
if (a is Int || a is String) {
|
||||||
|
a.<error>compareTo</error>("")
|
||||||
|
}
|
||||||
|
when (a) {
|
||||||
|
is String, is Any => a.<error>compareTo</error>("")
|
||||||
|
}
|
||||||
|
if (a is String && a is Any) {
|
||||||
|
val i: Int = <info descr="Automatically cast to String">a</info>.length
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user