!is supported in data flow info for ifs

This commit is contained in:
Andrey Breslav
2011-07-05 10:55:33 +04:00
parent b19ad2ccb8
commit 4121aed773
2 changed files with 7 additions and 1 deletions
@@ -1570,7 +1570,7 @@ public class JetTypeInferrer {
condition.accept(new JetVisitor() {
@Override
public void visitIsExpression(JetIsExpression expression) {
if (conditionValue) {
if (conditionValue && !expression.isNegated() || !conditionValue && expression.isNegated()) {
JetPattern pattern = expression.getPattern();
result[0] = patternsToDataFlowInfo.get(pattern);
if (scopeToExtend != null) {
@@ -147,3 +147,9 @@ fun f15(a : A?) {
<info descr="Automatically cast to B">a</info>.bar()
<error>c</error>.bar()
}
fun getStringLength(obj : Any) : Char? {
if (obj !is String)
return null
return <info>obj</info>.get(0) // no cast to String is needed
}