KT-418 Make 1.?plus(2) have type Int

This commit is contained in:
Stepan Koltsov
2011-11-08 15:44:02 +04:00
parent 35275466bc
commit 1f511db31c
2 changed files with 9 additions and 1 deletions
@@ -441,7 +441,9 @@ public class BasicExpressionTypingVisitor extends ExpressionTypingVisitor {
//TODO move further
if (expression.getOperationSign() == JetTokens.SAFE_ACCESS) {
if (selectorReturnType != null && !selectorReturnType.isNullable() && !JetStandardClasses.isUnit(selectorReturnType)) {
selectorReturnType = TypeUtils.makeNullable(selectorReturnType);
if (receiverType.isNullable()) {
selectorReturnType = TypeUtils.makeNullable(selectorReturnType);
}
}
}
@@ -0,0 +1,6 @@
// http://youtrack.jetbrains.net/issue/KT-418
fun ff() {
val i: Int = 1
val a: Int = i<!UNNECESSARY_SAFE_CALL!>?.<!>plus(2)
}