Very basic property resolve
This commit is contained in:
@@ -57,11 +57,11 @@ public class ClassDescriptorResolver {
|
|||||||
}
|
}
|
||||||
if (declaration instanceof JetProperty) {
|
if (declaration instanceof JetProperty) {
|
||||||
JetProperty property = (JetProperty) declaration;
|
JetProperty property = (JetProperty) declaration;
|
||||||
// TODO : Caution: a cyclic dependency possible
|
|
||||||
|
|
||||||
if (property.getPropertyTypeRef() != null) {
|
if (property.getPropertyTypeRef() != null) {
|
||||||
return resolvePropertyDescriptor(JetScope.EMPTY, property);
|
return resolvePropertyDescriptor(outerScope, property);
|
||||||
} else {
|
} else {
|
||||||
|
// TODO : Caution: a cyclic dependency possible
|
||||||
throw new UnsupportedOperationException();
|
throw new UnsupportedOperationException();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ public class TypeResolver {
|
|||||||
typeConstructor,
|
typeConstructor,
|
||||||
nullable,
|
nullable,
|
||||||
resolveTypeProjections(scope, typeConstructor, type.getTypeArguments()),
|
resolveTypeProjections(scope, typeConstructor, type.getTypeArguments()),
|
||||||
JetStandardClasses.STUB
|
classDescriptor.getMemberDomain()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
else if (type.getTypeArguments().isEmpty()) {
|
else if (type.getTypeArguments().isEmpty()) {
|
||||||
@@ -52,6 +52,7 @@ public class TypeResolver {
|
|||||||
typeParameterDescriptor.getTypeConstructor(),
|
typeParameterDescriptor.getTypeConstructor(),
|
||||||
nullable || hasNullableBound(typeParameterDescriptor),
|
nullable || hasNullableBound(typeParameterDescriptor),
|
||||||
Collections.<TypeProjection>emptyList(),
|
Collections.<TypeProjection>emptyList(),
|
||||||
|
// TODO : joint domain
|
||||||
JetStandardClasses.STUB
|
JetStandardClasses.STUB
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -255,6 +255,13 @@ public class JetTypeChecker {
|
|||||||
result[0] = JetStandardClasses.getUnitType();
|
result[0] = JetStandardClasses.getUnitType();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void visitNewExpression(JetNewExpression expression) {
|
||||||
|
// TODO : type argument inference
|
||||||
|
JetTypeReference typeReference = expression.getTypeReference();
|
||||||
|
result[0] = TypeResolver.INSTANCE.resolveType(scope, typeReference);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void visitDotQualifiedExpression(JetDotQualifiedExpression expression) {
|
public void visitDotQualifiedExpression(JetDotQualifiedExpression expression) {
|
||||||
JetExpression receiverExpression = expression.getReceiverExpression();
|
JetExpression receiverExpression = expression.getReceiverExpression();
|
||||||
|
|||||||
@@ -304,7 +304,15 @@ public class JetTypeCheckerTest extends LightDaemonAnalyzerTestCase {
|
|||||||
assertType("if (1) {() => val a = 1; a; var b = a; b} else null", "Function0<Int>?");
|
assertType("if (1) {() => val a = 1; a; var b = a; b} else null", "Function0<Int>?");
|
||||||
}
|
}
|
||||||
|
|
||||||
// public void testImplicitConversions() throws Exception {
|
public void testNew() throws Exception {
|
||||||
|
assertType("new Base_T<Int>()", "Base_T<Int>");
|
||||||
|
}
|
||||||
|
|
||||||
|
public void testPropertiesInClasses() throws Exception {
|
||||||
|
assertType("new Properties().p", "Int");
|
||||||
|
}
|
||||||
|
|
||||||
|
// public void testImplicitConversions() throws Exception {
|
||||||
// assertConvertibleTo("1", JetStandardClasses.getByteType());
|
// assertConvertibleTo("1", JetStandardClasses.getByteType());
|
||||||
// }
|
// }
|
||||||
//
|
//
|
||||||
@@ -399,6 +407,7 @@ public class JetTypeCheckerTest extends LightDaemonAnalyzerTestCase {
|
|||||||
"open class Derived_inT<in T> : Base_inT<T>",
|
"open class Derived_inT<in T> : Base_inT<T>",
|
||||||
"open class Base_outT<out T>",
|
"open class Base_outT<out T>",
|
||||||
"open class Derived_outT<out T> : Base_outT<T>",
|
"open class Derived_outT<out T> : Base_outT<T>",
|
||||||
|
"class Properties { val p : Int }"
|
||||||
};
|
};
|
||||||
|
|
||||||
public static JetScope BASIC_SCOPE = new JetScopeAdapter(JetStandardClasses.STANDARD_CLASSES) {
|
public static JetScope BASIC_SCOPE = new JetScopeAdapter(JetStandardClasses.STANDARD_CLASSES) {
|
||||||
|
|||||||
Reference in New Issue
Block a user