Merge branch 'master' of github.com:JetBrains/kotlin

This commit is contained in:
James Strachan
2012-09-14 11:27:52 +01:00
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)
}