EA-38625 Fixed - Part 2 - UOE: NamespaceType.throwException

This commit is contained in:
Natalia.Ukhorskaya
2012-09-14 11:14:00 +04:00
parent 7ad0fd56f3
commit 645b784b40
3 changed files with 9 additions and 2 deletions
@@ -64,6 +64,7 @@ public class NamespaceType implements JetType {
@Override
public boolean isNullable() {
throwException();
return false;
}
@@ -556,7 +556,7 @@ public class BasicExpressionTypingVisitor extends ExpressionTypingVisitor {
JetType selectorReturnType = selectorReturnTypeInfo.getType();
//TODO move further
if (expression.getOperationSign() == JetTokens.SAFE_ACCESS) {
if (!(receiverType instanceof NamespaceType) && expression.getOperationSign() == JetTokens.SAFE_ACCESS) {
if (selectorReturnType != null && !selectorReturnType.isNullable() && !JetStandardClasses.isUnit(selectorReturnType)) {
if (receiverType.isNullable()) {
selectorReturnType = TypeUtils.makeNullable(selectorReturnType);
@@ -3,8 +3,14 @@ public class Test {
public static final String FOO = "test";
}
// FILE: anotherTest.kt
package foo
val s: String = "test"
// FILE: test.kt
fun ff() {
val a = Test?.FOO
System?.out.println(a)
val b = foo?.s
System?.out.println(a + b)
}