added errors TYPE_PARAMETER_ON_LHS_OF_DOT,
TYPE_PARAMETER_IS_NOT_AN_EXPRESSION fixed exception from ea
This commit is contained in:
@@ -523,6 +523,8 @@ public interface Errors {
|
||||
DiagnosticFactory0<JetThisExpression> NO_THIS = DiagnosticFactory0.create(ERROR);
|
||||
DiagnosticFactory0<JetRootNamespaceExpression> NAMESPACE_IS_NOT_AN_EXPRESSION = DiagnosticFactory0.create(ERROR);
|
||||
DiagnosticFactory1<JetSimpleNameExpression, ClassifierDescriptor> NO_CLASS_OBJECT = DiagnosticFactory1.create(ERROR);
|
||||
DiagnosticFactory1<JetSimpleNameExpression, TypeParameterDescriptor> TYPE_PARAMETER_IS_NOT_AN_EXPRESSION = DiagnosticFactory1.create(ERROR);
|
||||
DiagnosticFactory1<JetSimpleNameExpression, TypeParameterDescriptor> TYPE_PARAMETER_ON_LHS_OF_DOT = DiagnosticFactory1.create(ERROR);
|
||||
|
||||
DiagnosticFactory1<PsiElement, ClassDescriptor> INACCESSIBLE_OUTER_CLASS_EXPRESSION = DiagnosticFactory1.create(ERROR);
|
||||
DiagnosticFactory0<PsiElement> NESTED_CLASS_NOT_ALLOWED = DiagnosticFactory0.create(ERROR);
|
||||
|
||||
+2
@@ -224,6 +224,8 @@ public class DefaultErrorMessages {
|
||||
MAP.put(WRONG_SETTER_PARAMETER_TYPE, "Setter parameter type must be equal to the type of the property, i.e. ''{0}''", RENDER_TYPE, RENDER_TYPE);
|
||||
MAP.put(WRONG_GETTER_RETURN_TYPE, "Getter return type must be equal to the type of the property, i.e. ''{0}''", RENDER_TYPE, RENDER_TYPE);
|
||||
MAP.put(NO_CLASS_OBJECT, "Please specify constructor invocation; classifier ''{0}'' does not have a class object", NAME);
|
||||
MAP.put(TYPE_PARAMETER_IS_NOT_AN_EXPRESSION, "Type parameter ''{0}'' is not an expression", NAME);
|
||||
MAP.put(TYPE_PARAMETER_ON_LHS_OF_DOT, "Type parameter ''{0}'' cannot have or inherit a class object, so it cannot be on the left hand side of dot", NAME);
|
||||
MAP.put(NO_GENERICS_IN_SUPERTYPE_SPECIFIER, "Generic arguments of the base type must be specified");
|
||||
|
||||
MAP.put(INACCESSIBLE_OUTER_CLASS_EXPRESSION, "Expression is inaccessible from a nested class ''{0}'', use ''inner'' keyword to make the class inner", NAME);
|
||||
|
||||
+14
-4
@@ -35,6 +35,7 @@ import org.jetbrains.jet.lang.resolve.constants.ConstantUtils;
|
||||
import org.jetbrains.jet.lang.resolve.name.Name;
|
||||
import org.jetbrains.jet.lang.resolve.scopes.ChainedScope;
|
||||
import org.jetbrains.jet.lang.resolve.scopes.JetScope;
|
||||
import org.jetbrains.jet.lang.resolve.scopes.JetScopeImpl;
|
||||
import org.jetbrains.jet.lang.resolve.scopes.receivers.ExpressionReceiver;
|
||||
import org.jetbrains.jet.lang.resolve.scopes.receivers.ReceiverValue;
|
||||
import org.jetbrains.jet.lang.types.*;
|
||||
@@ -87,13 +88,22 @@ public class CallExpressionResolver {
|
||||
}
|
||||
// To report NO_CLASS_OBJECT when no namespace found
|
||||
if (classifier != null) {
|
||||
if (context.expressionPosition == ExpressionPosition.FREE) {
|
||||
if (classifier instanceof TypeParameterDescriptor) {
|
||||
if (context.expressionPosition == ExpressionPosition.FREE) {
|
||||
context.trace.report(TYPE_PARAMETER_IS_NOT_AN_EXPRESSION.on(expression, (TypeParameterDescriptor) classifier));
|
||||
}
|
||||
else {
|
||||
context.trace.report(TYPE_PARAMETER_ON_LHS_OF_DOT.on(expression, (TypeParameterDescriptor) classifier));
|
||||
}
|
||||
}
|
||||
else if (context.expressionPosition == ExpressionPosition.FREE) {
|
||||
context.trace.report(NO_CLASS_OBJECT.on(expression, classifier));
|
||||
}
|
||||
context.trace.record(REFERENCE_TARGET, expression, classifier);
|
||||
JetScope scopeForStaticMembersResolution = classifier instanceof ClassDescriptor
|
||||
? getStaticNestedClassesScope((ClassDescriptor) classifier)
|
||||
: JetScope.EMPTY;
|
||||
JetScope scopeForStaticMembersResolution =
|
||||
classifier instanceof ClassDescriptor
|
||||
? getStaticNestedClassesScope((ClassDescriptor) classifier)
|
||||
: ErrorUtils.createErrorScope("Error scope for type parameter on the left hand side of dot");
|
||||
return new NamespaceType(referencedName, scopeForStaticMembersResolution);
|
||||
}
|
||||
temporaryTrace.commit();
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
package bar
|
||||
|
||||
class S<T> {
|
||||
fun foo() {
|
||||
<!TYPE_PARAMETER_IS_NOT_AN_EXPRESSION, UNUSED_EXPRESSION!>T<!>
|
||||
<!TYPE_PARAMETER_ON_LHS_OF_DOT!>T<!>.<!DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE!>create<!>()
|
||||
}
|
||||
}
|
||||
@@ -1976,6 +1976,11 @@ public class JetDiagnosticsTestGenerated extends AbstractDiagnosticsTestWithEage
|
||||
doTest("compiler/testData/diagnostics/tests/incompleteCode/SupertypeOfErrorType.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("typeParameterOnLhsOfDot.kt")
|
||||
public void testTypeParameterOnLhsOfDot() throws Exception {
|
||||
doTest("compiler/testData/diagnostics/tests/incompleteCode/typeParameterOnLhsOfDot.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/diagnostics/tests/incompleteCode/diagnosticWithSyntaxError")
|
||||
public static class DiagnosticWithSyntaxError extends AbstractDiagnosticsTestWithEagerResolve {
|
||||
public void testAllFilesPresentInDiagnosticWithSyntaxError() throws Exception {
|
||||
|
||||
Reference in New Issue
Block a user