KT-6530 Do not report "useless cast" when RHS is unresolved

#KT-6530 fixed
This commit is contained in:
Evgeny Gerashchenko
2015-01-12 19:21:48 +03:00
parent 6e9f94d1ea
commit c64cb06180
2 changed files with 3 additions and 1 deletions
@@ -205,7 +205,7 @@ public class BasicExpressionTypingVisitor extends ExpressionTypingVisitor {
JetType targetType,
ExpressionTypingContext context
) {
if (actualType == null || noExpectedType(targetType)) return;
if (actualType == null || noExpectedType(targetType) || targetType.isError()) return;
if (TypesPackage.isDynamic(targetType)) {
JetTypeReference right = expression.getRight();
@@ -13,4 +13,6 @@ fun test() : Unit {
x <!USELESS_CAST!>as? Int?<!> : Int?
y <!USELESS_CAST_STATIC_ASSERT_IS_FINE!>as? Int?<!> : Int?
Unit
x as <!UNRESOLVED_REFERENCE!>UnresolvedType<!>
}