Fix false warning about useless cast in property and property accessor
Note that there are some other problems, for example: `val a = if (true) 1 as Number else 2`, here we'll get useless cast #KT-9551 Fixed #KT-9645 Fixed
This commit is contained in:
+4
@@ -445,6 +445,10 @@ public class BasicExpressionTypingVisitor extends ExpressionTypingVisitor {
|
||||
if (parent instanceof KtBinaryExpression || parent instanceof KtUnaryExpression) {
|
||||
return true;
|
||||
}
|
||||
// Previously we've checked that there is no expected type, therefore cast in property has an effect on inference
|
||||
if (parent instanceof KtProperty || parent instanceof KtPropertyAccessor) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user