Little corrections
This commit is contained in:
@@ -37,6 +37,16 @@ public class ErrorHandler {
|
||||
throw new IllegalStateException("Redeclaration: " + existingDescriptor.getName());
|
||||
}
|
||||
};
|
||||
public static String atLocation(PsiElement element) {
|
||||
Document document = PsiDocumentManager.getInstance(element.getProject()).getDocument(element.getContainingFile());
|
||||
int offset = element.getTextRange().getStartOffset();
|
||||
int lineNumber = document.getLineNumber(offset);
|
||||
int lineStartOffset = document.getLineStartOffset(lineNumber);
|
||||
int column = offset - lineStartOffset;
|
||||
|
||||
return "' at line " + (lineNumber+1) + ":" + column;
|
||||
}
|
||||
|
||||
|
||||
public void unresolvedReference(@NotNull JetReferenceExpression referenceExpression) {
|
||||
}
|
||||
@@ -52,14 +62,5 @@ public class ErrorHandler {
|
||||
|
||||
public void genericWarning(@NotNull ASTNode node, @NotNull String message) {
|
||||
}
|
||||
|
||||
public static String atLocation(PsiElement element) {
|
||||
Document document = PsiDocumentManager.getInstance(element.getProject()).getDocument(element.getContainingFile());
|
||||
int offset = element.getTextRange().getStartOffset();
|
||||
int lineNumber = document.getLineNumber(offset);
|
||||
int lineStartOffset = document.getLineStartOffset(lineNumber);
|
||||
int column = offset - lineStartOffset;
|
||||
|
||||
return "' at line " + (lineNumber+1) + ":" + column;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
package org.jetbrains.jet.lang.resolve;
|
||||
|
||||
import com.intellij.openapi.editor.Document;
|
||||
import com.intellij.openapi.progress.ProcessCanceledException;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.util.Key;
|
||||
import com.intellij.psi.PsiDocumentManager;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.intellij.psi.PsiElementVisitor;
|
||||
import com.intellij.psi.PsiErrorElement;
|
||||
|
||||
@@ -24,7 +24,7 @@ public interface BindingContext {
|
||||
WritableSlice<JetReferenceExpression, Collection<? extends DeclarationDescriptor>> AMBIGUOUS_REFERENCE_TARGET = new BasicWritableSlice<JetReferenceExpression, Collection<? extends DeclarationDescriptor>>("AMBIGUOUS_REFERENCE_TARGET", RewritePolicy.DO_NOTHING);
|
||||
|
||||
WritableSlice<JetExpression, FunctionDescriptor> LOOP_RANGE_ITERATOR = Slices.createSimpleSlice("LOOP_RANGE_ITERATOR");
|
||||
WritableSlice<JetExpression, DeclarationDescriptor> LOOP_RANGE_HAS_NEXT = Slices.createSimpleSlice("LOOP_RANGE_HAS_NEXT");
|
||||
WritableSlice<JetExpression, CallableDescriptor> LOOP_RANGE_HAS_NEXT = Slices.createSimpleSlice("LOOP_RANGE_HAS_NEXT");
|
||||
WritableSlice<JetExpression, FunctionDescriptor> LOOP_RANGE_NEXT = Slices.createSimpleSlice("LOOP_RANGE_NEXT");
|
||||
|
||||
WritableSlice<JetExpression, JetType> AUTOCAST = Slices.createSimpleSlice("AUTOCAST");
|
||||
|
||||
@@ -1060,18 +1060,18 @@ public class JetTypeInferrer {
|
||||
TemporaryBindingTrace temporaryTraceWithExpectedType = TemporaryBindingTrace.create(context.trace);
|
||||
boolean success = checkBinaryWithTypeRHS(expression, context, targetType, targetType, temporaryTraceWithExpectedType);
|
||||
if (success) {
|
||||
temporaryTraceWithExpectedType.addAllMyDataTo(context.trace);
|
||||
temporaryTraceWithExpectedType.commit();
|
||||
}
|
||||
else {
|
||||
TemporaryBindingTrace temporaryTraceWithoutExpectedType = TemporaryBindingTrace.create(context.trace);
|
||||
checkBinaryWithTypeRHS(expression, context, targetType, NO_EXPECTED_TYPE, temporaryTraceWithoutExpectedType);
|
||||
temporaryTraceWithoutExpectedType.addAllMyDataTo(context.trace);
|
||||
temporaryTraceWithoutExpectedType.commit();
|
||||
}
|
||||
}
|
||||
else {
|
||||
TemporaryBindingTrace temporaryTraceWithoutExpectedType = TemporaryBindingTrace.create(context.trace);
|
||||
checkBinaryWithTypeRHS(expression, context, targetType, NO_EXPECTED_TYPE, temporaryTraceWithoutExpectedType);
|
||||
temporaryTraceWithoutExpectedType.addAllMyDataTo(context.trace);
|
||||
temporaryTraceWithoutExpectedType.commit();
|
||||
}
|
||||
|
||||
IElementType operationType = expression.getOperationSign().getReferencedNameElementType();
|
||||
|
||||
@@ -106,6 +106,15 @@ public class JetHighlighter extends SyntaxHighlighterBase {
|
||||
JET_DEBUG_INFO = TextAttributesKey.createTextAttributesKey("JET.DEBUG.INFO", textAttributes);
|
||||
}
|
||||
|
||||
public static final TextAttributesKey JET_RESOLVED_TO_ERROR;
|
||||
|
||||
static {
|
||||
TextAttributes textAttributes = new TextAttributes();
|
||||
textAttributes.setEffectType(EffectType.ROUNDED_BOX);
|
||||
textAttributes.setEffectColor(Color.RED);
|
||||
JET_RESOLVED_TO_ERROR = TextAttributesKey.createTextAttributesKey("JET.RESOLVED.TO.ERROR", textAttributes);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public Lexer getHighlightingLexer() {
|
||||
return new JetLexer();
|
||||
|
||||
@@ -4,5 +4,5 @@ fun test() {
|
||||
<error>1</error> : Double
|
||||
1 <warning>as</warning> Byte
|
||||
1 <warning>as</warning> Int
|
||||
1 <warning>as</warning> Double
|
||||
<error>1</error> <warning>as</warning> Double
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
class C(x : `std::Int`Int) : NotFound {
|
||||
val xx : `std::Int`Int
|
||||
}
|
||||
@@ -264,7 +264,10 @@ public class ExpectedResolveData {
|
||||
statement = (JetExpression) parent;
|
||||
}
|
||||
JetDeclaration declaration = PsiTreeUtil.getParentOfType(referenceExpression, JetDeclaration.class);
|
||||
return referenceExpression.getText() +
|
||||
|
||||
|
||||
|
||||
return referenceExpression.getText() + " at " + ErrorHandler.atLocation(referenceExpression) +
|
||||
" in " + statement.getText() + (declaration == null ? "" : " in " + declaration.getText());
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user