Renamed diagnostics (namespace → package).

This commit is contained in:
Evgeny Gerashchenko
2014-01-10 18:46:04 +04:00
parent 73ad5552c8
commit 093afeb05c
10 changed files with 31 additions and 31 deletions
@@ -69,7 +69,7 @@ public class DebugInfoUtil {
JetSuperExpression superExpression = (JetSuperExpression) diagnostic.getPsiElement();
markedWithErrorElements.put(superExpression.getInstanceReference(), factory);
}
else if (factory == Errors.EXPRESSION_EXPECTED_NAMESPACE_FOUND) {
else if (factory == Errors.EXPRESSION_EXPECTED_PACKAGE_FOUND) {
markedWithErrorElements.put((JetSimpleNameExpression) diagnostic.getPsiElement(), factory);
}
else if (factory == Errors.UNSUPPORTED) {
@@ -134,7 +134,7 @@ public class DebugInfoUtil {
DiagnosticFactory factory = markedWithErrorElements.get(expression);
if (declarationDescriptor != null &&
(ErrorUtils.isError(declarationDescriptor) || ErrorUtils.containsErrorType(expressionType))) {
if (factory != Errors.EXPRESSION_EXPECTED_NAMESPACE_FOUND) {
if (factory != Errors.EXPRESSION_EXPECTED_PACKAGE_FOUND) {
debugInfoReporter.reportElementWithErrorType(expression);
}
}
@@ -555,7 +555,7 @@ public interface Errors {
DiagnosticFactory0<JetBinaryExpression> ASSIGNMENT_IN_EXPRESSION_CONTEXT = DiagnosticFactory0.create(ERROR);
DiagnosticFactory0<JetDeclaration> DECLARATION_IN_ILLEGAL_CONTEXT = DiagnosticFactory0.create(ERROR);
DiagnosticFactory0<JetSimpleNameExpression> EXPRESSION_EXPECTED_NAMESPACE_FOUND = DiagnosticFactory0.create(ERROR);
DiagnosticFactory0<JetSimpleNameExpression> EXPRESSION_EXPECTED_PACKAGE_FOUND = DiagnosticFactory0.create(ERROR);
DiagnosticFactory0<JetReturnExpression> RETURN_NOT_ALLOWED = DiagnosticFactory0.create(ERROR);
DiagnosticFactory0<JetReturnExpression> RETURN_NOT_ALLOWED_EXPLICIT_RETURN_TYPE_REQUIRED = DiagnosticFactory0.create(ERROR);
@@ -566,7 +566,7 @@ public interface Errors {
DiagnosticFactory0<JetClassInitializer> ANONYMOUS_INITIALIZER_IN_TRAIT = DiagnosticFactory0.create(ERROR);
DiagnosticFactory0<JetThisExpression> NO_THIS = DiagnosticFactory0.create(ERROR);
DiagnosticFactory0<JetRootPackageExpression> NAMESPACE_IS_NOT_AN_EXPRESSION = DiagnosticFactory0.create(ERROR);
DiagnosticFactory0<JetRootPackageExpression> PACKAGE_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);
@@ -88,7 +88,7 @@ public class DefaultErrorMessages {
MAP.put(RETURN_NOT_ALLOWED_EXPLICIT_RETURN_TYPE_REQUIRED, "'return' is only allowed in function literals that have return types specified explicitly");
MAP.put(PROJECTION_IN_IMMEDIATE_ARGUMENT_TO_SUPERTYPE, "Projections are not allowed for immediate arguments of a supertype");
MAP.put(LABEL_NAME_CLASH, "There is more than one label with such a name in this scope");
MAP.put(EXPRESSION_EXPECTED_NAMESPACE_FOUND, "Expression expected, but a namespace name found");
MAP.put(EXPRESSION_EXPECTED_PACKAGE_FOUND, "Expression expected, but a package name found");
MAP.put(CANNOT_IMPORT_FROM_ELEMENT, "Cannot import from ''{0}''", NAME);
MAP.put(CANNOT_BE_IMPORTED, "Cannot import ''{0}'', functions and properties can be imported only from packages", NAME);
@@ -216,7 +216,7 @@ public class DefaultErrorMessages {
MAP.put(EQUALS_MISSING, "No method 'equals(jet.Any?) : jet.Boolean' available");
MAP.put(ASSIGNMENT_IN_EXPRESSION_CONTEXT, "Assignments are not expressions, and only expressions are allowed in this context");
MAP.put(NAMESPACE_IS_NOT_AN_EXPRESSION, "'namespace' is not an expression, it can only be used on the left-hand side of a dot ('.')");
MAP.put(PACKAGE_IS_NOT_AN_EXPRESSION, "'package' is not an expression, it can only be used on the left-hand side of a dot ('.')");
MAP.put(SUPER_IS_NOT_AN_EXPRESSION, "''{0}'' is not an expression, it can only be used on the left-hand side of a dot ('.')", TO_STRING);
MAP.put(DECLARATION_IN_ILLEGAL_CONTEXT, "Declarations are not allowed in this position");
MAP.put(SETTER_PARAMETER_WITH_DEFAULT_VALUE, "Setter parameters cannot have default values");
@@ -197,7 +197,7 @@ public class CallExpressionResolver {
result[0] = packageType;
return true;
}
context.trace.report(EXPRESSION_EXPECTED_NAMESPACE_FOUND.on(expression));
context.trace.report(EXPRESSION_EXPECTED_PACKAGE_FOUND.on(expression));
result[0] = ErrorUtils.createErrorType("Type for " + expression.getReferencedNameAsName());
return false;
}
@@ -1174,7 +1174,7 @@ public class BasicExpressionTypingVisitor extends ExpressionTypingVisitor {
if (JetPsiUtil.isLHSOfDot(expression)) {
return DataFlowUtils.checkType(JetModuleUtil.getRootPackageType(expression), expression, context, context.dataFlowInfo);
}
context.trace.report(NAMESPACE_IS_NOT_AN_EXPRESSION.on(expression));
context.trace.report(PACKAGE_IS_NOT_AN_EXPRESSION.on(expression));
return JetTypeInfo.create(null, context.dataFlowInfo);
}
@@ -1,8 +0,0 @@
// FILE: b.kt
package root.a
// FILE: b.kt
package root
val x = <!EXPRESSION_EXPECTED_NAMESPACE_FOUND!>a<!>
val y2 = <!NAMESPACE_IS_NOT_AN_EXPRESSION!>package<!>
@@ -0,0 +1,8 @@
// FILE: b.kt
package root.a
// FILE: b.kt
package root
val x = <!EXPRESSION_EXPECTED_PACKAGE_FOUND!>a<!>
val y2 = <!PACKAGE_IS_NOT_AN_EXPRESSION!>package<!>
@@ -2,18 +2,18 @@ package foo
class X {}
val s = <!EXPRESSION_EXPECTED_NAMESPACE_FOUND!>java<!>
val s = <!EXPRESSION_EXPECTED_PACKAGE_FOUND!>java<!>
val ss = <!NO_CLASS_OBJECT!>System<!>
val sss = <!NO_CLASS_OBJECT!>X<!>
val x = "${<!NO_CLASS_OBJECT!>System<!>}"
val xs = java.<!EXPRESSION_EXPECTED_NAMESPACE_FOUND!>lang<!>
val xs = java.<!EXPRESSION_EXPECTED_PACKAGE_FOUND!>lang<!>
val xss = java.lang.<!NO_CLASS_OBJECT!>System<!>
val xsss = foo.<!NO_CLASS_OBJECT!>X<!>
val xssss = <!EXPRESSION_EXPECTED_NAMESPACE_FOUND!>foo<!>
val xssss = <!EXPRESSION_EXPECTED_PACKAGE_FOUND!>foo<!>
val f = { <!NO_CLASS_OBJECT!>System<!> }
fun main(args : Array<String>) {
<!EXPRESSION_EXPECTED_NAMESPACE_FOUND, VARIABLE_EXPECTED!>java<!> = null
<!EXPRESSION_EXPECTED_PACKAGE_FOUND, VARIABLE_EXPECTED!>java<!> = null
<!NO_CLASS_OBJECT!>System<!> = null
<!NO_CLASS_OBJECT!>System<!>!!
java.lang.<!NO_CLASS_OBJECT!>System<!> = null
@@ -13,7 +13,7 @@ fun x(f : Foo) {
f.<!NO_VALUE_FOR_PARAMETER, FUNCTION_CALL_EXPECTED!>bar<!>
f.<!FUNCTION_EXPECTED!>a<!>()
<!EXPRESSION_EXPECTED_NAMESPACE_FOUND, FUNCTION_EXPECTED!>c<!>()
<!EXPRESSION_EXPECTED_PACKAGE_FOUND, FUNCTION_EXPECTED!>c<!>()
<!FUNCTION_EXPECTED!>R<!>()
}
@@ -309,16 +309,6 @@ public class JetDiagnosticsTestGenerated extends AbstractJetDiagnosticsTest {
doTest("compiler/testData/diagnostics/tests/NamedArgumentsAndDefaultValues.kt");
}
@TestMetadata("NamespaceAsExpression.kt")
public void testNamespaceAsExpression() throws Exception {
doTest("compiler/testData/diagnostics/tests/NamespaceAsExpression.kt");
}
@TestMetadata("NamespaceInExpressionPosition.kt")
public void testNamespaceInExpressionPosition() throws Exception {
doTest("compiler/testData/diagnostics/tests/NamespaceInExpressionPosition.kt");
}
@TestMetadata("NamespaceQualified.kt")
public void testNamespaceQualified() throws Exception {
doTest("compiler/testData/diagnostics/tests/NamespaceQualified.kt");
@@ -344,6 +334,16 @@ public class JetDiagnosticsTestGenerated extends AbstractJetDiagnosticsTest {
doTest("compiler/testData/diagnostics/tests/OverridingVarByVal.kt");
}
@TestMetadata("PackageAsExpression.kt")
public void testPackageAsExpression() throws Exception {
doTest("compiler/testData/diagnostics/tests/PackageAsExpression.kt");
}
@TestMetadata("PackageInExpressionPosition.kt")
public void testPackageInExpressionPosition() throws Exception {
doTest("compiler/testData/diagnostics/tests/PackageInExpressionPosition.kt");
}
@TestMetadata("PrimaryConstructors.kt")
public void testPrimaryConstructors() throws Exception {
doTest("compiler/testData/diagnostics/tests/PrimaryConstructors.kt");