KT-418 Make 1.?plus(2) have type Int
This commit is contained in:
+3
-1
@@ -441,7 +441,9 @@ public class BasicExpressionTypingVisitor extends ExpressionTypingVisitor {
|
|||||||
//TODO move further
|
//TODO move further
|
||||||
if (expression.getOperationSign() == JetTokens.SAFE_ACCESS) {
|
if (expression.getOperationSign() == JetTokens.SAFE_ACCESS) {
|
||||||
if (selectorReturnType != null && !selectorReturnType.isNullable() && !JetStandardClasses.isUnit(selectorReturnType)) {
|
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)
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user