Drop "Reflection types not loaded" diagnostic

Reflection types are now considered to be built-in, so their absence means the
runtime is broken and the compiler can't work at all; this condition probably
should be handled on another level for all built-in types
This commit is contained in:
Alexander Udalov
2015-05-25 12:07:01 +03:00
parent 45c28abfee
commit 51684b3fe1
6 changed files with 4 additions and 22 deletions
@@ -446,8 +446,6 @@ public interface Errors {
// Reflection
DiagnosticFactory0<PsiElement> REFLECTION_TYPES_NOT_LOADED = DiagnosticFactory0.create(ERROR);
DiagnosticFactory1<JetExpression, CallableMemberDescriptor> EXTENSION_IN_CLASS_REFERENCE_NOT_ALLOWED = DiagnosticFactory1.create(ERROR);
DiagnosticFactory0<JetExpression> CALLABLE_REFERENCE_LHS_NOT_A_CLASS = DiagnosticFactory0.create(ERROR);
@@ -596,8 +596,6 @@ public class DefaultErrorMessages {
MAP.put(AMBIGUOUS_ANONYMOUS_TYPE_INFERRED, "Right-hand side has anonymous type. Please specify type explicitly", TO_STRING);
MAP.put(REFLECTION_TYPES_NOT_LOADED, "Reflection types can't be loaded. Please ensure that you have Kotlin Runtime in your classpath");
MAP.put(EXTENSION_IN_CLASS_REFERENCE_NOT_ALLOWED,
"''{0}'' is a member and an extension at the same time. References to such elements are not allowed", NAME);
MAP.put(CALLABLE_REFERENCE_LHS_NOT_A_CLASS, "Left hand side of a callable reference cannot be a type parameter");
@@ -502,11 +502,7 @@ public class BasicExpressionTypingVisitor extends ExpressionTypingVisitor {
public JetTypeInfo visitClassLiteralExpression(@NotNull JetClassLiteralExpression expression, ExpressionTypingContext c) {
JetType type = resolveClassLiteral(expression, c);
if (type != null && !type.isError()) {
JetType kClassType = components.reflectionTypes.getKClassType(Annotations.EMPTY, type);
if (!kClassType.isError()) {
return TypeInfoFactoryPackage.createTypeInfo(kClassType, c);
}
c.trace.report(REFLECTION_TYPES_NOT_LOADED.on(expression.getDoubleColonTokenReference()));
return TypeInfoFactoryPackage.createTypeInfo(components.reflectionTypes.getKClassType(Annotations.EMPTY, type), c);
}
return TypeInfoFactoryPackage.createTypeInfo(ErrorUtils.createErrorType("Unresolved class"), c);
@@ -723,11 +719,6 @@ public class BasicExpressionTypingVisitor extends ExpressionTypingVisitor {
isExtension
);
if (type.isError()) {
context.trace.report(REFLECTION_TYPES_NOT_LOADED.on(expression.getDoubleColonTokenReference()));
return null;
}
AnonymousFunctionDescriptor functionDescriptor = new AnonymousFunctionDescriptor(
context.scope.getContainingDeclaration(),
Annotations.EMPTY,
@@ -753,11 +744,6 @@ public class BasicExpressionTypingVisitor extends ExpressionTypingVisitor {
JetType type = components.reflectionTypes.getKPropertyType(Annotations.EMPTY, receiverType, descriptor.getType(), isExtension,
descriptor.isVar());
if (type.isError()) {
context.trace.report(REFLECTION_TYPES_NOT_LOADED.on(expression.getDoubleColonTokenReference()));
return null;
}
LocalVariableDescriptor localVariable =
new LocalVariableDescriptor(context.scope.getContainingDeclaration(), Annotations.EMPTY, Name.special("<anonymous>"),
type, /* mutable = */ false, toSourceElement(expression));
@@ -1,4 +1,4 @@
// !DIAGNOSTICS: -UNUSED_EXPRESSION, -REFLECTION_TYPES_NOT_LOADED
// !DIAGNOSTICS: -UNUSED_EXPRESSION
class UsefulClass(val param: Int = 2) {
fun get(instance: Any, property: PropertyMetadata) : Int = 1
@@ -1,4 +1,4 @@
// !DIAGNOSTICS: -UNUSED_EXPRESSION, -REFLECTION_TYPES_NOT_LOADED, -UNUSED_PARAMETER
// !DIAGNOSTICS: -UNUSED_EXPRESSION, -UNUSED_PARAMETER
open class C<T>() {
deprecated("")
@@ -1,4 +1,4 @@
// !DIAGNOSTICS: -UNUSED_EXPRESSION, -REFLECTION_TYPES_NOT_LOADED
// !DIAGNOSTICS: -UNUSED_EXPRESSION
class Delegate() {
deprecated("text")