KT-1256 Error highlighting in IDE should be less annoying
#KT-1256 fixed
This commit is contained in:
@@ -75,6 +75,7 @@ public final class AnalyzerWithCompilerReport {
|
||||
}
|
||||
|
||||
private void reportDiagnostic(@NotNull Diagnostic diagnostic) {
|
||||
if (!diagnostic.isValid()) return;
|
||||
DiagnosticUtils.LineAndColumn lineAndColumn = DiagnosticUtils.getLineAndColumn(diagnostic);
|
||||
VirtualFile virtualFile = diagnostic.getPsiFile().getVirtualFile();
|
||||
String path = virtualFile == null ? null : virtualFile.getPath();
|
||||
|
||||
@@ -343,6 +343,11 @@ public class CheckerTestUtil {
|
||||
public PsiFile getPsiFile() {
|
||||
return errorElement.getContainingFile();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isValid() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
private static List<DiagnosticDescriptor> getSortedDiagnosticDescriptors(Collection<Diagnostic> diagnostics) {
|
||||
@@ -353,7 +358,7 @@ public class CheckerTestUtil {
|
||||
DiagnosticDescriptor currentDiagnosticDescriptor = null;
|
||||
for (Diagnostic diagnostic : list) {
|
||||
List<TextRange> textRanges = diagnostic.getTextRanges();
|
||||
if (textRanges.isEmpty()) continue;
|
||||
if (!diagnostic.isValid()) continue;
|
||||
|
||||
TextRange textRange = textRanges.get(0);
|
||||
if (currentDiagnosticDescriptor != null && currentDiagnosticDescriptor.equalRange(textRange)) {
|
||||
|
||||
@@ -16,20 +16,24 @@
|
||||
|
||||
package org.jetbrains.jet.lang.diagnostics;
|
||||
|
||||
import com.intellij.openapi.util.TextRange;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.intellij.psi.PsiErrorElement;
|
||||
import com.intellij.psi.PsiFile;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author svtk
|
||||
*/
|
||||
public abstract class AbstractDiagnostic<E extends PsiElement> implements ParametrizedDiagnostic<E> {
|
||||
private final E psiElement;
|
||||
private final AbstractDiagnosticFactory factory;
|
||||
private final DiagnosticFactoryWithPsiElement<E> factory;
|
||||
private final Severity severity;
|
||||
|
||||
public AbstractDiagnostic(@NotNull E psiElement,
|
||||
@NotNull AbstractDiagnosticFactory factory,
|
||||
@NotNull DiagnosticFactoryWithPsiElement<E> factory,
|
||||
@NotNull Severity severity) {
|
||||
this.psiElement = psiElement;
|
||||
this.factory = factory;
|
||||
@@ -38,7 +42,7 @@ public abstract class AbstractDiagnostic<E extends PsiElement> implements Parame
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public AbstractDiagnosticFactory getFactory() {
|
||||
public DiagnosticFactoryWithPsiElement<E> getFactory() {
|
||||
return factory;
|
||||
}
|
||||
|
||||
@@ -59,4 +63,29 @@ public abstract class AbstractDiagnostic<E extends PsiElement> implements Parame
|
||||
public E getPsiElement() {
|
||||
return psiElement;
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public List<TextRange> getTextRanges() {
|
||||
return getFactory().getTextRanges(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isValid() {
|
||||
if (!getFactory().isValid(this)) return false;
|
||||
if (hasSyntaxErrors(psiElement)) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
private static boolean hasSyntaxErrors(@NotNull PsiElement psiElement) {
|
||||
if (psiElement instanceof PsiErrorElement) return true;
|
||||
|
||||
PsiElement lastChild = psiElement.getLastChild();
|
||||
if (lastChild != null && hasSyntaxErrors(lastChild)) return true;
|
||||
|
||||
PsiElement[] children = psiElement.getChildren();
|
||||
if (children.length > 0 && hasSyntaxErrors(children[children.length - 1])) return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,4 +42,6 @@ public interface Diagnostic {
|
||||
|
||||
@NotNull
|
||||
PsiFile getPsiFile();
|
||||
|
||||
boolean isValid();
|
||||
}
|
||||
|
||||
+4
@@ -36,4 +36,8 @@ public abstract class DiagnosticFactoryWithPsiElement<E extends PsiElement> exte
|
||||
protected List<TextRange> getTextRanges(ParametrizedDiagnostic<E> diagnostic) {
|
||||
return positioningStrategy.mark(diagnostic.getPsiElement());
|
||||
}
|
||||
|
||||
protected boolean isValid(ParametrizedDiagnostic<E> diagnostic) {
|
||||
return positioningStrategy.isValid(diagnostic.getPsiElement());
|
||||
}
|
||||
}
|
||||
|
||||
-6
@@ -43,12 +43,6 @@ public class DiagnosticWithParameters1<E extends PsiElement, A> extends Abstract
|
||||
return (DiagnosticFactory1<E, A>)super.getFactory();
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public List<TextRange> getTextRanges() {
|
||||
return getFactory().getTextRanges(this);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public A getA() {
|
||||
return a;
|
||||
|
||||
-6
@@ -46,12 +46,6 @@ public class DiagnosticWithParameters2<E extends PsiElement, A, B> extends Abstr
|
||||
return (DiagnosticFactory2<E, A, B>)super.getFactory();
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public List<TextRange> getTextRanges() {
|
||||
return getFactory().getTextRanges(this);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public A getA() {
|
||||
return a;
|
||||
|
||||
-6
@@ -49,12 +49,6 @@ public class DiagnosticWithParameters3<E extends PsiElement, A, B, C> extends Ab
|
||||
return (DiagnosticFactory3<E, A, B, C>)super.getFactory();
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public List<TextRange> getTextRanges() {
|
||||
return getFactory().getTextRanges(this);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public A getA() {
|
||||
return a;
|
||||
|
||||
@@ -31,9 +31,9 @@ import org.jetbrains.jet.lexer.JetTokens;
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.Modifier;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import static org.jetbrains.jet.lang.diagnostics.PositioningStrategies.*;
|
||||
import static org.jetbrains.jet.lang.diagnostics.Severity.ERROR;
|
||||
import static org.jetbrains.jet.lang.diagnostics.Severity.WARNING;
|
||||
|
||||
@@ -51,7 +51,7 @@ public interface Errors {
|
||||
//Elements with "INVISIBLE_REFERENCE" error are marked as unresolved, unlike elements with "INVISIBLE_MEMBER" error
|
||||
DiagnosticFactory2<JetSimpleNameExpression, DeclarationDescriptor, DeclarationDescriptor> INVISIBLE_REFERENCE =
|
||||
DiagnosticFactory2.create(ERROR);
|
||||
DiagnosticFactory2<PsiElement, DeclarationDescriptor, DeclarationDescriptor> INVISIBLE_MEMBER = DiagnosticFactory2.create(ERROR, PositioningStrategies.CALL_ELEMENT);
|
||||
DiagnosticFactory2<PsiElement, DeclarationDescriptor, DeclarationDescriptor> INVISIBLE_MEMBER = DiagnosticFactory2.create(ERROR, CALL_ELEMENT);
|
||||
|
||||
RedeclarationDiagnosticFactory REDECLARATION = new RedeclarationDiagnosticFactory(ERROR);
|
||||
RedeclarationDiagnosticFactory NAME_SHADOWING = new RedeclarationDiagnosticFactory(WARNING);
|
||||
@@ -62,16 +62,16 @@ public interface Errors {
|
||||
|
||||
DiagnosticFactory2<PsiElement, JetKeywordToken, JetKeywordToken> REDUNDANT_MODIFIER = DiagnosticFactory2.create(Severity.WARNING);
|
||||
SimpleDiagnosticFactory<JetModifierListOwner> ABSTRACT_MODIFIER_IN_TRAIT = SimpleDiagnosticFactory
|
||||
.create(WARNING, PositioningStrategies.POSITION_ABSTRACT_MODIFIER);
|
||||
.create(WARNING, ABSTRACT_MODIFIER);
|
||||
SimpleDiagnosticFactory<JetModifierListOwner> OPEN_MODIFIER_IN_TRAIT = SimpleDiagnosticFactory
|
||||
.create(WARNING, PositioningStrategies.positionModifier(JetTokens.OPEN_KEYWORD));
|
||||
.create(WARNING, positionModifier(JetTokens.OPEN_KEYWORD));
|
||||
SimpleDiagnosticFactory<PsiElement>
|
||||
REDUNDANT_MODIFIER_IN_GETTER = SimpleDiagnosticFactory.create(WARNING);
|
||||
SimpleDiagnosticFactory<PsiElement> TRAIT_CAN_NOT_BE_FINAL = SimpleDiagnosticFactory.create(ERROR);
|
||||
SimpleDiagnosticFactory<JetExpression> TYPECHECKER_HAS_RUN_INTO_RECURSIVE_PROBLEM = SimpleDiagnosticFactory.create(ERROR);
|
||||
SimpleDiagnosticFactory<JetReturnExpression> RETURN_NOT_ALLOWED = SimpleDiagnosticFactory.create(ERROR);
|
||||
SimpleDiagnosticFactory<JetTypeProjection> PROJECTION_IN_IMMEDIATE_ARGUMENT_TO_SUPERTYPE =
|
||||
SimpleDiagnosticFactory.create(ERROR, PositioningStrategies.PROJECTION_MODIFIER);
|
||||
SimpleDiagnosticFactory.create(ERROR, PROJECTION_MODIFIER);
|
||||
SimpleDiagnosticFactory<JetSimpleNameExpression>LABEL_NAME_CLASH = SimpleDiagnosticFactory.create(WARNING);
|
||||
SimpleDiagnosticFactory<JetSimpleNameExpression> EXPRESSION_EXPECTED_NAMESPACE_FOUND = SimpleDiagnosticFactory.create(ERROR);
|
||||
|
||||
@@ -95,12 +95,10 @@ public interface Errors {
|
||||
SimpleDiagnosticFactory<LeafPsiElement> NON_VARARG_SPREAD = SimpleDiagnosticFactory.create(ERROR);
|
||||
|
||||
SimpleDiagnosticFactory<JetExpression> MANY_FUNCTION_LITERAL_ARGUMENTS = SimpleDiagnosticFactory.create(ERROR);
|
||||
SimpleDiagnosticFactory<PsiElement> PROPERTY_WITH_NO_TYPE_NO_INITIALIZER = SimpleDiagnosticFactory.create(ERROR);
|
||||
SimpleDiagnosticFactory<JetProperty> PROPERTY_WITH_NO_TYPE_NO_INITIALIZER = SimpleDiagnosticFactory.create(ERROR, NAMED_ELEMENT);
|
||||
|
||||
SimpleDiagnosticFactory<JetModifierListOwner> ABSTRACT_PROPERTY_IN_PRIMARY_CONSTRUCTOR_PARAMETERS = SimpleDiagnosticFactory
|
||||
.create(ERROR, PositioningStrategies.POSITION_ABSTRACT_MODIFIER);
|
||||
SimpleDiagnosticFactory<JetProperty> ABSTRACT_PROPERTY_NOT_IN_CLASS = SimpleDiagnosticFactory.create(ERROR,
|
||||
PositioningStrategies.POSITION_ABSTRACT_MODIFIER);
|
||||
SimpleDiagnosticFactory<JetModifierListOwner> ABSTRACT_PROPERTY_IN_PRIMARY_CONSTRUCTOR_PARAMETERS = SimpleDiagnosticFactory.create(ERROR, ABSTRACT_MODIFIER);
|
||||
SimpleDiagnosticFactory<JetProperty> ABSTRACT_PROPERTY_NOT_IN_CLASS = SimpleDiagnosticFactory.create(ERROR, ABSTRACT_MODIFIER);
|
||||
SimpleDiagnosticFactory<JetExpression> ABSTRACT_PROPERTY_WITH_INITIALIZER = SimpleDiagnosticFactory.create(ERROR);
|
||||
SimpleDiagnosticFactory<JetPropertyAccessor> ABSTRACT_PROPERTY_WITH_GETTER = SimpleDiagnosticFactory.create(ERROR);
|
||||
SimpleDiagnosticFactory<JetPropertyAccessor>ABSTRACT_PROPERTY_WITH_SETTER = SimpleDiagnosticFactory.create(ERROR);
|
||||
@@ -108,35 +106,23 @@ public interface Errors {
|
||||
SimpleDiagnosticFactory<PsiElement> PACKAGE_MEMBER_CANNOT_BE_PROTECTED = SimpleDiagnosticFactory.create(ERROR);
|
||||
|
||||
SimpleDiagnosticFactory<PsiElement> GETTER_VISIBILITY_DIFFERS_FROM_PROPERTY_VISIBILITY = SimpleDiagnosticFactory.create(ERROR);
|
||||
SimpleDiagnosticFactory<JetProperty> BACKING_FIELD_IN_TRAIT = SimpleDiagnosticFactory.create(ERROR,
|
||||
PositioningStrategies.POSITION_NAME_IDENTIFIER);
|
||||
SimpleDiagnosticFactory<JetProperty> MUST_BE_INITIALIZED = SimpleDiagnosticFactory.create(ERROR,
|
||||
PositioningStrategies.POSITION_NAME_IDENTIFIER);
|
||||
SimpleDiagnosticFactory<JetProperty> MUST_BE_INITIALIZED_OR_BE_ABSTRACT = SimpleDiagnosticFactory.create(ERROR,
|
||||
PositioningStrategies.POSITION_NAME_IDENTIFIER);
|
||||
SimpleDiagnosticFactory<JetProperty> BACKING_FIELD_IN_TRAIT = SimpleDiagnosticFactory.create(ERROR, NAMED_ELEMENT);
|
||||
SimpleDiagnosticFactory<JetProperty> MUST_BE_INITIALIZED = SimpleDiagnosticFactory.create(ERROR, NAMED_ELEMENT);
|
||||
SimpleDiagnosticFactory<JetProperty> MUST_BE_INITIALIZED_OR_BE_ABSTRACT = SimpleDiagnosticFactory.create(ERROR, NAMED_ELEMENT);
|
||||
SimpleDiagnosticFactory<JetExpression>PROPERTY_INITIALIZER_IN_TRAIT = SimpleDiagnosticFactory.create(ERROR);
|
||||
SimpleDiagnosticFactory<JetExpression> PROPERTY_INITIALIZER_NO_BACKING_FIELD = SimpleDiagnosticFactory.create(ERROR);
|
||||
DiagnosticFactory2<JetModifierListOwner, String, ClassDescriptor> ABSTRACT_PROPERTY_IN_NON_ABSTRACT_CLASS =
|
||||
DiagnosticFactory2.create(ERROR, PositioningStrategies.POSITION_ABSTRACT_MODIFIER);
|
||||
DiagnosticFactory2<JetFunction, String, ClassDescriptor> ABSTRACT_FUNCTION_IN_NON_ABSTRACT_CLASS =
|
||||
DiagnosticFactory2.create(ERROR,PositioningStrategies.POSITION_ABSTRACT_MODIFIER);
|
||||
DiagnosticFactory1<JetFunction, SimpleFunctionDescriptor> ABSTRACT_FUNCTION_WITH_BODY =
|
||||
DiagnosticFactory1.create(ERROR, PositioningStrategies.POSITION_ABSTRACT_MODIFIER);
|
||||
DiagnosticFactory1<JetFunction, SimpleFunctionDescriptor> NON_ABSTRACT_FUNCTION_WITH_NO_BODY =
|
||||
DiagnosticFactory1.create(ERROR, PositioningStrategies.POSITION_NAME_IDENTIFIER);
|
||||
DiagnosticFactory1<JetModifierListOwner, SimpleFunctionDescriptor> NON_MEMBER_ABSTRACT_FUNCTION =
|
||||
DiagnosticFactory1.create(ERROR, PositioningStrategies.POSITION_ABSTRACT_MODIFIER);
|
||||
DiagnosticFactory2<JetModifierListOwner, String, ClassDescriptor> ABSTRACT_PROPERTY_IN_NON_ABSTRACT_CLASS = DiagnosticFactory2.create(ERROR, ABSTRACT_MODIFIER);
|
||||
DiagnosticFactory2<JetFunction, String, ClassDescriptor> ABSTRACT_FUNCTION_IN_NON_ABSTRACT_CLASS = DiagnosticFactory2.create(ERROR, ABSTRACT_MODIFIER);
|
||||
DiagnosticFactory1<JetFunction, SimpleFunctionDescriptor> ABSTRACT_FUNCTION_WITH_BODY = DiagnosticFactory1.create(ERROR, ABSTRACT_MODIFIER);
|
||||
DiagnosticFactory1<JetFunction, SimpleFunctionDescriptor> NON_ABSTRACT_FUNCTION_WITH_NO_BODY = DiagnosticFactory1.create(ERROR, NAMED_ELEMENT);
|
||||
DiagnosticFactory1<JetModifierListOwner, SimpleFunctionDescriptor> NON_MEMBER_ABSTRACT_FUNCTION = DiagnosticFactory1.create(ERROR, ABSTRACT_MODIFIER);
|
||||
|
||||
DiagnosticFactory1<JetFunction, SimpleFunctionDescriptor> NON_MEMBER_FUNCTION_NO_BODY =
|
||||
DiagnosticFactory1.create(ERROR, PositioningStrategies.POSITION_NAME_IDENTIFIER);
|
||||
SimpleDiagnosticFactory<JetNamedDeclaration> NON_FINAL_MEMBER_IN_FINAL_CLASS =
|
||||
SimpleDiagnosticFactory.create(ERROR, PositioningStrategies.positionModifier(JetTokens.OPEN_KEYWORD));
|
||||
DiagnosticFactory1<JetFunction, SimpleFunctionDescriptor> NON_MEMBER_FUNCTION_NO_BODY = DiagnosticFactory1.create(ERROR, NAMED_ELEMENT);
|
||||
SimpleDiagnosticFactory<JetNamedDeclaration> NON_FINAL_MEMBER_IN_FINAL_CLASS = SimpleDiagnosticFactory.create(ERROR, positionModifier(JetTokens.OPEN_KEYWORD));
|
||||
|
||||
SimpleDiagnosticFactory<JetNamedDeclaration> PUBLIC_MEMBER_SHOULD_SPECIFY_TYPE =
|
||||
SimpleDiagnosticFactory.create(ERROR, PositioningStrategies.POSITION_NAME_IDENTIFIER);
|
||||
SimpleDiagnosticFactory<JetNamedDeclaration> PUBLIC_MEMBER_SHOULD_SPECIFY_TYPE = SimpleDiagnosticFactory.create(ERROR, NAMED_ELEMENT);
|
||||
|
||||
SimpleDiagnosticFactory<JetTypeProjection> PROJECTION_ON_NON_CLASS_TYPE_ARGUMENT =
|
||||
SimpleDiagnosticFactory.create(ERROR, PositioningStrategies.PROJECTION_MODIFIER);
|
||||
SimpleDiagnosticFactory<JetTypeProjection> PROJECTION_ON_NON_CLASS_TYPE_ARGUMENT = SimpleDiagnosticFactory.create(ERROR, PROJECTION_MODIFIER);
|
||||
SimpleDiagnosticFactory<JetDelegatorToSuperClass> SUPERTYPE_NOT_INITIALIZED = SimpleDiagnosticFactory.create(ERROR);
|
||||
SimpleDiagnosticFactory<JetDelegatorToSuperClass> SUPERTYPE_NOT_INITIALIZED_DEFAULT = SimpleDiagnosticFactory.create(ERROR);
|
||||
SimpleDiagnosticFactory<PsiElement> SECONDARY_CONSTRUCTOR_BUT_NO_PRIMARY = SimpleDiagnosticFactory.create(ERROR);
|
||||
@@ -144,26 +130,21 @@ public interface Errors {
|
||||
SimpleDiagnosticFactory<JetDelegatorByExpressionSpecifier> BY_IN_SECONDARY_CONSTRUCTOR = SimpleDiagnosticFactory.create(ERROR);
|
||||
SimpleDiagnosticFactory<JetDelegatorToSuperClass> INITIALIZER_WITH_NO_ARGUMENTS = SimpleDiagnosticFactory.create(ERROR);
|
||||
SimpleDiagnosticFactory<JetDelegationSpecifier> MANY_CALLS_TO_THIS = SimpleDiagnosticFactory.create(ERROR);
|
||||
DiagnosticFactory1<JetModifierListOwner, CallableMemberDescriptor> NOTHING_TO_OVERRIDE =
|
||||
DiagnosticFactory1.create(ERROR, PositioningStrategies.POSITION_OVERRIDE_MODIFIER);
|
||||
DiagnosticFactory3<PsiNameIdentifierOwner, CallableMemberDescriptor, CallableMemberDescriptor, DeclarationDescriptor>
|
||||
VIRTUAL_MEMBER_HIDDEN = DiagnosticFactory3.create(ERROR, PositioningStrategies.POSITION_NAME_IDENTIFIER);
|
||||
DiagnosticFactory1<JetModifierListOwner, CallableMemberDescriptor> NOTHING_TO_OVERRIDE = DiagnosticFactory1.create(ERROR, OVERRIDE_MODIFIER);
|
||||
DiagnosticFactory3<PsiNameIdentifierOwner, CallableMemberDescriptor, CallableMemberDescriptor, DeclarationDescriptor> VIRTUAL_MEMBER_HIDDEN =
|
||||
DiagnosticFactory3.create(ERROR, NAMED_ELEMENT);
|
||||
DiagnosticFactory3<JetModifierListOwner, CallableMemberDescriptor, CallableDescriptor, DeclarationDescriptor> CANNOT_OVERRIDE_INVISIBLE_MEMBER =
|
||||
DiagnosticFactory3.create(ERROR, PositioningStrategies.POSITION_OVERRIDE_MODIFIER);
|
||||
SimpleDiagnosticFactory<JetModifierListOwner> CANNOT_INFER_VISIBILITY = SimpleDiagnosticFactory.create(ERROR, PositioningStrategies.POSITION_OVERRIDE_MODIFIER);
|
||||
DiagnosticFactory3.create(ERROR, OVERRIDE_MODIFIER);
|
||||
SimpleDiagnosticFactory<JetDeclaration> CANNOT_INFER_VISIBILITY = SimpleDiagnosticFactory.create(ERROR, DECLARATION);
|
||||
|
||||
DiagnosticFactory1<JetClass, ClassDescriptor> ENUM_ENTRY_SHOULD_BE_INITIALIZED =
|
||||
DiagnosticFactory1.create(ERROR, PositioningStrategies.POSITION_NAME_IDENTIFIER);
|
||||
DiagnosticFactory1<JetClass, ClassDescriptor> ENUM_ENTRY_SHOULD_BE_INITIALIZED = DiagnosticFactory1.create(ERROR, NAME_IDENTIFIER);
|
||||
DiagnosticFactory1<JetTypeReference, ClassDescriptor> ENUM_ENTRY_ILLEGAL_TYPE = DiagnosticFactory1.create(ERROR);
|
||||
|
||||
DiagnosticFactory1<JetSimpleNameExpression, VariableDescriptor> UNINITIALIZED_VARIABLE = DiagnosticFactory1.create(ERROR);
|
||||
DiagnosticFactory1<JetSimpleNameExpression, ValueParameterDescriptor> UNINITIALIZED_PARAMETER = DiagnosticFactory1.create(ERROR);
|
||||
UnusedElementDiagnosticFactory<JetProperty, VariableDescriptor> UNUSED_VARIABLE =
|
||||
UnusedElementDiagnosticFactory.create(WARNING, PositioningStrategies.POSITION_NAME_IDENTIFIER);
|
||||
UnusedElementDiagnosticFactory<JetParameter, VariableDescriptor> UNUSED_PARAMETER =
|
||||
UnusedElementDiagnosticFactory.create(WARNING, PositioningStrategies.POSITION_NAME_IDENTIFIER);
|
||||
UnusedElementDiagnosticFactory<JetNamedDeclaration, DeclarationDescriptor> ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE =
|
||||
UnusedElementDiagnosticFactory.create(WARNING, PositioningStrategies.POSITION_NAME_IDENTIFIER);
|
||||
UnusedElementDiagnosticFactory<JetProperty, VariableDescriptor> UNUSED_VARIABLE = UnusedElementDiagnosticFactory.create(WARNING, NAME_IDENTIFIER);
|
||||
UnusedElementDiagnosticFactory<JetParameter, VariableDescriptor> UNUSED_PARAMETER = UnusedElementDiagnosticFactory.create(WARNING, NAME_IDENTIFIER);
|
||||
UnusedElementDiagnosticFactory<JetNamedDeclaration, DeclarationDescriptor> ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE = UnusedElementDiagnosticFactory.create(WARNING, NAME_IDENTIFIER);
|
||||
DiagnosticFactory1<JetExpression, DeclarationDescriptor> VARIABLE_WITH_REDUNDANT_INITIALIZER = DiagnosticFactory1.create(WARNING);
|
||||
DiagnosticFactory2<JetElement, JetElement, DeclarationDescriptor> UNUSED_VALUE = DiagnosticFactory2.create(WARNING);
|
||||
DiagnosticFactory1<JetElement, JetElement> UNUSED_CHANGED_VALUE = DiagnosticFactory1.create(WARNING);
|
||||
@@ -194,10 +175,8 @@ public interface Errors {
|
||||
SimpleDiagnosticFactory<JetPropertyAccessor> LOCAL_VARIABLE_WITH_SETTER = SimpleDiagnosticFactory.create(ERROR);
|
||||
SimpleDiagnosticFactory<JetPropertyAccessor> VAL_WITH_SETTER = SimpleDiagnosticFactory.create(ERROR);
|
||||
|
||||
SimpleDiagnosticFactory<JetArrayAccessExpression> NO_GET_METHOD =
|
||||
SimpleDiagnosticFactory.create(ERROR, PositioningStrategies.POSITION_ARRAY_ACCESS);
|
||||
SimpleDiagnosticFactory<JetArrayAccessExpression> NO_SET_METHOD =
|
||||
SimpleDiagnosticFactory.create(ERROR, PositioningStrategies.POSITION_ARRAY_ACCESS);
|
||||
SimpleDiagnosticFactory<JetArrayAccessExpression> NO_GET_METHOD = SimpleDiagnosticFactory.create(ERROR, ARRAY_ACCESS);
|
||||
SimpleDiagnosticFactory<JetArrayAccessExpression> NO_SET_METHOD = SimpleDiagnosticFactory.create(ERROR, ARRAY_ACCESS);
|
||||
|
||||
SimpleDiagnosticFactory<JetSimpleNameExpression> INC_DEC_SHOULD_NOT_RETURN_UNIT = SimpleDiagnosticFactory.create(ERROR);
|
||||
DiagnosticFactory2<JetSimpleNameExpression, DeclarationDescriptor, JetSimpleNameExpression> ASSIGNMENT_OPERATOR_SHOULD_RETURN_UNIT =
|
||||
@@ -239,24 +218,7 @@ public interface Errors {
|
||||
DiagnosticFactory1<JetExpression, JetType> CALLEE_NOT_A_FUNCTION = DiagnosticFactory1.create(ERROR);
|
||||
|
||||
SimpleDiagnosticFactory<JetReturnExpression> RETURN_IN_FUNCTION_WITH_EXPRESSION_BODY = SimpleDiagnosticFactory.create(ERROR);
|
||||
SimpleDiagnosticFactory<JetDeclarationWithBody> NO_RETURN_IN_FUNCTION_WITH_BLOCK_BODY =
|
||||
SimpleDiagnosticFactory.create(ERROR,
|
||||
new PositioningStrategy<JetDeclarationWithBody>() {
|
||||
@NotNull
|
||||
@Override
|
||||
public List<TextRange> mark(@NotNull JetDeclarationWithBody element) {
|
||||
JetExpression bodyExpression = element.getBodyExpression();
|
||||
if (!(bodyExpression instanceof JetBlockExpression)) {
|
||||
return markElement(element);
|
||||
}
|
||||
JetBlockExpression blockExpression = (JetBlockExpression)bodyExpression;
|
||||
TextRange lastBracketRange = blockExpression.getLastBracketRange();
|
||||
if (lastBracketRange == null) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
return markRange(lastBracketRange);
|
||||
}
|
||||
});
|
||||
SimpleDiagnosticFactory<JetDeclarationWithBody> NO_RETURN_IN_FUNCTION_WITH_BLOCK_BODY = SimpleDiagnosticFactory.create(ERROR, DECLARATION_WITH_BODY);
|
||||
DiagnosticFactory1<JetExpression, JetType> RETURN_TYPE_MISMATCH = DiagnosticFactory1.create(ERROR);
|
||||
DiagnosticFactory1<JetExpression, JetType> EXPECTED_TYPE_MISMATCH = DiagnosticFactory1.create(ERROR);
|
||||
DiagnosticFactory1<JetBinaryExpression, JetType> ASSIGNMENT_TYPE_MISMATCH = DiagnosticFactory1.create(ERROR);
|
||||
@@ -273,33 +235,10 @@ public interface Errors {
|
||||
DiagnosticFactory1<PsiElement, CallableDescriptor> TOO_MANY_ARGUMENTS = DiagnosticFactory1.create(ERROR);
|
||||
DiagnosticFactory1<PsiElement, String> ERROR_COMPILE_TIME_VALUE = DiagnosticFactory1.create(ERROR);
|
||||
|
||||
SimpleDiagnosticFactory<JetWhenEntry> ELSE_MISPLACED_IN_WHEN = SimpleDiagnosticFactory.create(ERROR, new PositioningStrategy<JetWhenEntry>() {
|
||||
@NotNull
|
||||
@Override
|
||||
public List<TextRange> mark(@NotNull JetWhenEntry entry) {
|
||||
PsiElement elseKeywordElement = entry.getElseKeywordElement();
|
||||
assert elseKeywordElement != null;
|
||||
return markElement(elseKeywordElement);
|
||||
}
|
||||
});
|
||||
SimpleDiagnosticFactory<JetWhenEntry> ELSE_MISPLACED_IN_WHEN = SimpleDiagnosticFactory.create(ERROR, ELSE_ENTRY);
|
||||
|
||||
SimpleDiagnosticFactory<JetWhenExpression>
|
||||
NO_ELSE_IN_WHEN = new SimpleDiagnosticFactory<JetWhenExpression>(ERROR, new PositioningStrategy<JetWhenExpression>() {
|
||||
@NotNull
|
||||
@Override
|
||||
public List<TextRange> mark(@NotNull JetWhenExpression element) {
|
||||
return markElement(element.getWhenKeywordElement());
|
||||
}
|
||||
});
|
||||
SimpleDiagnosticFactory<JetWhenConditionInRange> TYPE_MISMATCH_IN_RANGE =
|
||||
new SimpleDiagnosticFactory<JetWhenConditionInRange>(ERROR,
|
||||
new PositioningStrategy<JetWhenConditionInRange>() {
|
||||
@NotNull
|
||||
@Override
|
||||
public List<TextRange> mark(@NotNull JetWhenConditionInRange condition) {
|
||||
return markElement(condition.getOperationReference());
|
||||
}
|
||||
});
|
||||
SimpleDiagnosticFactory<JetWhenExpression> NO_ELSE_IN_WHEN = new SimpleDiagnosticFactory<JetWhenExpression>(ERROR, WHEN_EXPRESSION);
|
||||
SimpleDiagnosticFactory<JetWhenConditionInRange> TYPE_MISMATCH_IN_RANGE = new SimpleDiagnosticFactory<JetWhenConditionInRange>(ERROR, WHEN_CONDITION_IN_RANGE);
|
||||
SimpleDiagnosticFactory<PsiElement> CYCLIC_INHERITANCE_HIERARCHY = SimpleDiagnosticFactory.create(ERROR);
|
||||
|
||||
SimpleDiagnosticFactory<JetTypeReference> MANY_CLASSES_IN_SUPERTYPE_LIST = SimpleDiagnosticFactory.create(ERROR);
|
||||
@@ -318,15 +257,7 @@ public interface Errors {
|
||||
DiagnosticFactory1<JetReturnExpression, String> NOT_A_RETURN_LABEL = DiagnosticFactory1.create(ERROR);
|
||||
|
||||
SimpleDiagnosticFactory<JetClassInitializer> ANONYMOUS_INITIALIZER_WITHOUT_CONSTRUCTOR = SimpleDiagnosticFactory.create(ERROR);
|
||||
SimpleDiagnosticFactory<JetNullableType> NULLABLE_SUPERTYPE = SimpleDiagnosticFactory.create(ERROR,
|
||||
new PositioningStrategy<JetNullableType>() {
|
||||
@NotNull
|
||||
@Override
|
||||
public List<TextRange> mark(@NotNull JetNullableType element) {
|
||||
return markNode(
|
||||
element.getQuestionMarkNode());
|
||||
}
|
||||
});
|
||||
SimpleDiagnosticFactory<JetNullableType> NULLABLE_SUPERTYPE = SimpleDiagnosticFactory.create(ERROR, NULLABLE_TYPE);
|
||||
DiagnosticFactory1<PsiElement, JetType> UNSAFE_CALL = DiagnosticFactory1.create(ERROR);
|
||||
SimpleDiagnosticFactory<JetSimpleNameExpression> AMBIGUOUS_LABEL = SimpleDiagnosticFactory.create(ERROR);
|
||||
DiagnosticFactory1<PsiElement, String> UNSUPPORTED = DiagnosticFactory1.create(ERROR);
|
||||
@@ -354,15 +285,14 @@ public interface Errors {
|
||||
|
||||
DiagnosticFactory2<JetBinaryExpression, JetBinaryExpression, Boolean> SENSELESS_COMPARISON = DiagnosticFactory2.create(WARNING);
|
||||
|
||||
DiagnosticFactory2<PsiElement, CallableMemberDescriptor, DeclarationDescriptor> OVERRIDING_FINAL_MEMBER =
|
||||
DiagnosticFactory2.create(ERROR);
|
||||
DiagnosticFactory2<PsiElement, CallableMemberDescriptor, DeclarationDescriptor> OVERRIDING_FINAL_MEMBER = DiagnosticFactory2.create(ERROR);
|
||||
DiagnosticFactory3<JetModifierListOwner, Visibility, CallableMemberDescriptor, DeclarationDescriptor> CANNOT_WEAKEN_ACCESS_PRIVILEGE =
|
||||
DiagnosticFactory3.create(ERROR, PositioningStrategies.POSITION_VISIBILITY_MODIFIER);
|
||||
DiagnosticFactory3.create(ERROR, VISIBILITY_MODIFIER);
|
||||
DiagnosticFactory3<JetModifierListOwner, Visibility, CallableMemberDescriptor, DeclarationDescriptor> CANNOT_CHANGE_ACCESS_PRIVILEGE =
|
||||
DiagnosticFactory3.create(ERROR, PositioningStrategies.POSITION_VISIBILITY_MODIFIER);
|
||||
DiagnosticFactory3.create(ERROR, VISIBILITY_MODIFIER);
|
||||
|
||||
DiagnosticFactory2<JetNamedDeclaration, CallableMemberDescriptor, CallableMemberDescriptor> RETURN_TYPE_MISMATCH_ON_OVERRIDE =
|
||||
DiagnosticFactory2.create(ERROR, PositioningStrategies.POSITION_DECLARATION);
|
||||
DiagnosticFactory2.create(ERROR, DECLARATION_RETURN_TYPE);
|
||||
|
||||
DiagnosticFactory2<JetProperty, PropertyDescriptor, PropertyDescriptor> VAR_OVERRIDDEN_BY_VAL =
|
||||
DiagnosticFactory2.create(ERROR, new PositioningStrategy<JetProperty>() {
|
||||
@@ -379,46 +309,16 @@ public interface Errors {
|
||||
DiagnosticFactory2<PsiElement, JetClassOrObject, CallableMemberDescriptor> MANY_IMPL_MEMBER_NOT_IMPLEMENTED =
|
||||
DiagnosticFactory2.create(ERROR);
|
||||
|
||||
SimpleDiagnosticFactory<JetParameter> DEFAULT_VALUE_NOT_ALLOWED_IN_OVERRIDE = SimpleDiagnosticFactory.create(ERROR, PositioningStrategies.PARAMETER_DEFAULT_VALUE);
|
||||
DiagnosticFactory1<JetParameter, ValueParameterDescriptor> MULTIPLE_DEFAULTS_INHERITED_FROM_SUPERTYPES = DiagnosticFactory1.create(ERROR, PositioningStrategies.POSITION_NAME_IDENTIFIER);
|
||||
DiagnosticFactory1<JetClassOrObject, ValueParameterDescriptor> MULTIPLE_DEFAULTS_INHERITED_FROM_SUPERTYPES_WHEN_NO_EXPLICIT_OVERRIDE = DiagnosticFactory1.create(ERROR, PositioningStrategies.POSITION_NAME_IDENTIFIER);
|
||||
DiagnosticFactory2<JetParameter, ClassDescriptor, ValueParameterDescriptor> PARAMETER_NAME_CHANGED_ON_OVERRIDE = DiagnosticFactory2.create(WARNING, PositioningStrategies.POSITION_NAME_IDENTIFIER);
|
||||
DiagnosticFactory2<JetClassOrObject, Collection<? extends CallableMemberDescriptor>, Integer> DIFFERENT_NAMES_FOR_THE_SAME_PARAMETER_IN_SUPERTYPES = DiagnosticFactory2.create(WARNING, PositioningStrategies.POSITION_NAME_IDENTIFIER);
|
||||
SimpleDiagnosticFactory<JetParameter> DEFAULT_VALUE_NOT_ALLOWED_IN_OVERRIDE = SimpleDiagnosticFactory.create(ERROR, PARAMETER_DEFAULT_VALUE);
|
||||
DiagnosticFactory1<JetParameter, ValueParameterDescriptor> MULTIPLE_DEFAULTS_INHERITED_FROM_SUPERTYPES = DiagnosticFactory1.create(ERROR);
|
||||
DiagnosticFactory1<JetClassOrObject, ValueParameterDescriptor> MULTIPLE_DEFAULTS_INHERITED_FROM_SUPERTYPES_WHEN_NO_EXPLICIT_OVERRIDE =
|
||||
DiagnosticFactory1.create(ERROR, NAME_IDENTIFIER);
|
||||
DiagnosticFactory2<JetParameter, ClassDescriptor, ValueParameterDescriptor> PARAMETER_NAME_CHANGED_ON_OVERRIDE =
|
||||
DiagnosticFactory2.create(WARNING, NAME_IDENTIFIER);
|
||||
DiagnosticFactory2<JetClassOrObject, Collection<? extends CallableMemberDescriptor>, Integer> DIFFERENT_NAMES_FOR_THE_SAME_PARAMETER_IN_SUPERTYPES =
|
||||
DiagnosticFactory2.create(WARNING, NAME_IDENTIFIER);
|
||||
|
||||
DiagnosticFactory2<JetDeclaration, CallableMemberDescriptor, String> CONFLICTING_OVERLOADS =
|
||||
DiagnosticFactory2.create(ERROR, new PositioningStrategy<JetDeclaration>() {
|
||||
@NotNull
|
||||
@Override
|
||||
public List<TextRange> mark(@NotNull JetDeclaration jetDeclaration) {
|
||||
if (jetDeclaration instanceof JetNamedFunction) {
|
||||
JetNamedFunction functionElement = (JetNamedFunction)jetDeclaration;
|
||||
return markRange(new TextRange(
|
||||
functionElement.getStartOfSignatureElement().getTextRange().getStartOffset(),
|
||||
functionElement.getEndOfSignatureElement().getTextRange().getEndOffset()
|
||||
));
|
||||
}
|
||||
else if (jetDeclaration instanceof JetClass) {
|
||||
// primary constructor
|
||||
JetClass klass = (JetClass)jetDeclaration;
|
||||
PsiElement nameAsDeclaration = klass.getNameIdentifier();
|
||||
if (nameAsDeclaration == null) {
|
||||
return markElement(klass);
|
||||
}
|
||||
PsiElement primaryConstructorParameterList = klass.getPrimaryConstructorParameterList();
|
||||
if (primaryConstructorParameterList == null) {
|
||||
return markRange(nameAsDeclaration.getTextRange());
|
||||
}
|
||||
return markRange(new TextRange(
|
||||
nameAsDeclaration.getTextRange().getStartOffset(),
|
||||
primaryConstructorParameterList.getTextRange().getEndOffset()
|
||||
));
|
||||
}
|
||||
else {
|
||||
// safe way
|
||||
return markElement(jetDeclaration);
|
||||
}
|
||||
}
|
||||
});
|
||||
DiagnosticFactory2<JetDeclaration, CallableMemberDescriptor, String> CONFLICTING_OVERLOADS = DiagnosticFactory2.create(ERROR, DECLARATION);
|
||||
|
||||
|
||||
DiagnosticFactory3<JetExpression, String, JetType, JetType> RESULT_TYPE_MISMATCH = DiagnosticFactory3.create(ERROR);
|
||||
|
||||
+153
-16
@@ -21,14 +21,12 @@ import com.google.common.collect.Lists;
|
||||
import com.intellij.lang.ASTNode;
|
||||
import com.intellij.openapi.util.TextRange;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.intellij.psi.PsiErrorElement;
|
||||
import com.intellij.psi.PsiNameIdentifierOwner;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.jet.lang.psi.*;
|
||||
import org.jetbrains.jet.lexer.JetKeywordToken;
|
||||
import org.jetbrains.jet.lexer.JetTokens;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -38,7 +36,7 @@ public class PositioningStrategies {
|
||||
|
||||
public static final PositioningStrategy<PsiElement> DEFAULT = new PositioningStrategy<PsiElement>();
|
||||
|
||||
public static final PositioningStrategy<JetDeclaration> POSITION_DECLARATION = new PositioningStrategy<JetDeclaration>() {
|
||||
public static final PositioningStrategy<JetDeclaration> DECLARATION_RETURN_TYPE = new PositioningStrategy<JetDeclaration>() {
|
||||
@NotNull
|
||||
@Override
|
||||
public List<TextRange> mark(@NotNull JetDeclaration declaration) {
|
||||
@@ -70,7 +68,7 @@ public class PositioningStrategies {
|
||||
}
|
||||
};
|
||||
|
||||
public static final PositioningStrategy<PsiNameIdentifierOwner> POSITION_NAME_IDENTIFIER = new PositioningStrategy<PsiNameIdentifierOwner>() {
|
||||
public static final PositioningStrategy<PsiNameIdentifierOwner> NAME_IDENTIFIER = new PositioningStrategy<PsiNameIdentifierOwner>() {
|
||||
@NotNull
|
||||
@Override
|
||||
public List<TextRange> mark(@NotNull PsiNameIdentifierOwner element) {
|
||||
@@ -82,28 +80,109 @@ public class PositioningStrategies {
|
||||
}
|
||||
};
|
||||
|
||||
public static final PositioningStrategy<JetModifierListOwner> POSITION_ABSTRACT_MODIFIER = positionModifier(JetTokens.ABSTRACT_KEYWORD);
|
||||
public static final PositioningStrategy<PsiNameIdentifierOwner> NAMED_ELEMENT = new PositioningStrategy<PsiNameIdentifierOwner>() {
|
||||
@NotNull
|
||||
@Override
|
||||
public List<TextRange> mark(@NotNull PsiNameIdentifierOwner element) {
|
||||
if (element instanceof JetNamedFunction) {
|
||||
JetNamedFunction function = (JetNamedFunction)element;
|
||||
PsiElement endOfSignatureElement;
|
||||
JetParameterList valueParameterList = function.getValueParameterList();
|
||||
JetElement returnTypeRef = function.getReturnTypeRef();
|
||||
PsiElement nameIdentifier = function.getNameIdentifier();
|
||||
if (returnTypeRef != null) {
|
||||
endOfSignatureElement = returnTypeRef;
|
||||
}
|
||||
else if (valueParameterList != null) {
|
||||
endOfSignatureElement = valueParameterList;
|
||||
}
|
||||
else if (nameIdentifier != null) {
|
||||
endOfSignatureElement = nameIdentifier;
|
||||
}
|
||||
else {
|
||||
endOfSignatureElement = function;
|
||||
}
|
||||
return markRange(new TextRange(
|
||||
function.getTextRange().getStartOffset(), endOfSignatureElement.getTextRange().getEndOffset()));
|
||||
}
|
||||
else if (element instanceof JetProperty) {
|
||||
JetProperty property = (JetProperty) element;
|
||||
PsiElement endOfSignatureElement;
|
||||
JetTypeReference propertyTypeRef = property.getPropertyTypeRef();
|
||||
PsiElement nameIdentifier = property.getNameIdentifier();
|
||||
if (propertyTypeRef != null) {
|
||||
endOfSignatureElement = propertyTypeRef;
|
||||
}
|
||||
else if (nameIdentifier != null) {
|
||||
endOfSignatureElement = nameIdentifier;
|
||||
}
|
||||
else {
|
||||
endOfSignatureElement = property;
|
||||
}
|
||||
return markRange(new TextRange(
|
||||
property.getTextRange().getStartOffset(), endOfSignatureElement.getTextRange().getEndOffset()));
|
||||
}
|
||||
else if (element instanceof JetClass) {
|
||||
// primary constructor
|
||||
JetClass klass = (JetClass)element;
|
||||
PsiElement nameAsDeclaration = klass.getNameIdentifier();
|
||||
if (nameAsDeclaration == null) {
|
||||
return markElement(klass);
|
||||
}
|
||||
PsiElement primaryConstructorParameterList = klass.getPrimaryConstructorParameterList();
|
||||
if (primaryConstructorParameterList == null) {
|
||||
return markRange(nameAsDeclaration.getTextRange());
|
||||
}
|
||||
return markRange(new TextRange(
|
||||
nameAsDeclaration.getTextRange().getStartOffset(), primaryConstructorParameterList.getTextRange().getEndOffset()));
|
||||
}
|
||||
return super.mark(element);
|
||||
}
|
||||
@Override
|
||||
public boolean isValid(@NotNull PsiNameIdentifierOwner element) {
|
||||
return element.getNameIdentifier() != null;
|
||||
}
|
||||
};
|
||||
|
||||
public static final PositioningStrategy<JetModifierListOwner> POSITION_OVERRIDE_MODIFIER = positionModifier(JetTokens.OVERRIDE_KEYWORD);
|
||||
public static final PositioningStrategy<JetDeclaration> DECLARATION = new PositioningStrategy<JetDeclaration>() {
|
||||
@NotNull
|
||||
@Override
|
||||
public List<TextRange> mark(@NotNull JetDeclaration element) {
|
||||
if (element instanceof PsiNameIdentifierOwner) {
|
||||
return NAMED_ELEMENT.mark((PsiNameIdentifierOwner) element);
|
||||
}
|
||||
return super.mark(element);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isValid(@NotNull JetDeclaration element) {
|
||||
if (element instanceof PsiNameIdentifierOwner) {
|
||||
return NAMED_ELEMENT.isValid((PsiNameIdentifierOwner) element);
|
||||
}
|
||||
return super.isValid(element);
|
||||
}
|
||||
};
|
||||
|
||||
public static final PositioningStrategy<JetModifierListOwner> ABSTRACT_MODIFIER = positionModifier(JetTokens.ABSTRACT_KEYWORD);
|
||||
|
||||
public static final PositioningStrategy<JetModifierListOwner> OVERRIDE_MODIFIER = positionModifier(JetTokens.OVERRIDE_KEYWORD);
|
||||
|
||||
public static PositioningStrategy<JetModifierListOwner> positionModifier(final JetKeywordToken token) {
|
||||
return new PositioningStrategy<JetModifierListOwner>() {
|
||||
@NotNull
|
||||
@Override
|
||||
public List<TextRange> mark(@NotNull JetModifierListOwner modifierListOwner) {
|
||||
if (modifierListOwner.hasModifier(token)) {
|
||||
JetModifierList modifierList = modifierListOwner.getModifierList();
|
||||
assert modifierList != null;
|
||||
ASTNode node = modifierList.getModifierNode(token);
|
||||
assert node != null;
|
||||
return markNode(node);
|
||||
}
|
||||
return markElement(modifierListOwner);
|
||||
assert modifierListOwner.hasModifier(token);
|
||||
JetModifierList modifierList = modifierListOwner.getModifierList();
|
||||
assert modifierList != null;
|
||||
ASTNode node = modifierList.getModifierNode(token);
|
||||
assert node != null;
|
||||
return markNode(node);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
public static PositioningStrategy<JetArrayAccessExpression> POSITION_ARRAY_ACCESS = new PositioningStrategy<JetArrayAccessExpression>() {
|
||||
public static PositioningStrategy<JetArrayAccessExpression> ARRAY_ACCESS = new PositioningStrategy<JetArrayAccessExpression>() {
|
||||
@NotNull
|
||||
@Override
|
||||
public List<TextRange> mark(@NotNull JetArrayAccessExpression element) {
|
||||
@@ -111,7 +190,7 @@ public class PositioningStrategies {
|
||||
}
|
||||
};
|
||||
|
||||
public static PositioningStrategy<JetModifierListOwner> POSITION_VISIBILITY_MODIFIER = new PositioningStrategy<JetModifierListOwner>() {
|
||||
public static PositioningStrategy<JetModifierListOwner> VISIBILITY_MODIFIER = new PositioningStrategy<JetModifierListOwner>() {
|
||||
@NotNull
|
||||
@Override
|
||||
public List<TextRange> mark(@NotNull JetModifierListOwner element) {
|
||||
@@ -161,4 +240,62 @@ public class PositioningStrategies {
|
||||
return markElement(callElement);
|
||||
}
|
||||
};
|
||||
|
||||
public static PositioningStrategy<JetDeclarationWithBody> DECLARATION_WITH_BODY = new PositioningStrategy<JetDeclarationWithBody>() {
|
||||
@NotNull
|
||||
@Override
|
||||
public List<TextRange> mark(@NotNull JetDeclarationWithBody element) {
|
||||
JetExpression bodyExpression = element.getBodyExpression();
|
||||
if ((bodyExpression instanceof JetBlockExpression)) {
|
||||
TextRange lastBracketRange = ((JetBlockExpression) bodyExpression).getLastBracketRange();
|
||||
if (lastBracketRange != null) {
|
||||
return markRange(lastBracketRange);
|
||||
}
|
||||
}
|
||||
return markElement(element);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isValid(@NotNull JetDeclarationWithBody element) {
|
||||
JetExpression bodyExpression = element.getBodyExpression();
|
||||
if (!(bodyExpression instanceof JetBlockExpression)) return false;
|
||||
if (((JetBlockExpression) bodyExpression).getLastBracketRange() == null) return false;
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
public static PositioningStrategy<JetWhenEntry> ELSE_ENTRY = new PositioningStrategy<JetWhenEntry>() {
|
||||
@NotNull
|
||||
@Override
|
||||
public List<TextRange> mark(@NotNull JetWhenEntry entry) {
|
||||
PsiElement elseKeywordElement = entry.getElseKeywordElement();
|
||||
assert elseKeywordElement != null;
|
||||
return markElement(elseKeywordElement);
|
||||
}
|
||||
};
|
||||
|
||||
public static PositioningStrategy<JetWhenExpression> WHEN_EXPRESSION = new PositioningStrategy<JetWhenExpression>() {
|
||||
@NotNull
|
||||
@Override
|
||||
public List<TextRange> mark(@NotNull JetWhenExpression element) {
|
||||
return markElement(element.getWhenKeywordElement());
|
||||
}
|
||||
};
|
||||
|
||||
public static PositioningStrategy<JetWhenConditionInRange> WHEN_CONDITION_IN_RANGE =
|
||||
new PositioningStrategy<JetWhenConditionInRange>() {
|
||||
@NotNull
|
||||
@Override
|
||||
public List<TextRange> mark(@NotNull JetWhenConditionInRange condition) {
|
||||
return markElement(condition.getOperationReference());
|
||||
}
|
||||
};
|
||||
|
||||
public static PositioningStrategy<JetNullableType> NULLABLE_TYPE = new PositioningStrategy<JetNullableType>() {
|
||||
@NotNull
|
||||
@Override
|
||||
public List<TextRange> mark(@NotNull JetNullableType element) {
|
||||
return markNode(element.getQuestionMarkNode());
|
||||
}
|
||||
};
|
||||
}
|
||||
@@ -34,8 +34,8 @@ public class PositioningStrategy<E extends PsiElement> {
|
||||
return markElement(element);
|
||||
}
|
||||
|
||||
protected boolean hasSyntaxError(@NotNull E element) {
|
||||
return element.getLastChild() instanceof PsiErrorElement;
|
||||
public boolean isValid(@NotNull E element) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
|
||||
@@ -37,10 +37,4 @@ public class SimpleDiagnostic<E extends PsiElement> extends AbstractDiagnostic<E
|
||||
public SimpleDiagnosticFactory<E> getFactory() {
|
||||
return (SimpleDiagnosticFactory<E>)super.getFactory();
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public List<TextRange> getTextRanges() {
|
||||
return getFactory().getTextRanges(this);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -69,28 +69,6 @@ public class JetNamedFunction extends JetFunction implements StubBasedPsiElement
|
||||
return findChildByType(JetTokens.EQ);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public JetElement getStartOfSignatureElement() {
|
||||
return this;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public JetElement getEndOfSignatureElement() {
|
||||
JetElement r = getReturnTypeRef();
|
||||
if (r != null) {
|
||||
return r;
|
||||
}
|
||||
|
||||
r = getValueParameterList();
|
||||
if (r != null) {
|
||||
return r;
|
||||
}
|
||||
|
||||
// otherwise it is an error
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns full qualified name for function "package_fqn.function_name"
|
||||
* Not null for top level functions.
|
||||
|
||||
@@ -221,14 +221,20 @@ public class DeclarationsChecker {
|
||||
trace.report(BACKING_FIELD_IN_TRAIT.on(property));
|
||||
}
|
||||
if (initializer == null) {
|
||||
boolean error = false;
|
||||
if (backingFieldRequired && !inTrait && !trace.getBindingContext().get(BindingContext.IS_INITIALIZED, propertyDescriptor)) {
|
||||
if (classDescriptor == null || hasAccessorImplementation) {
|
||||
error = true;
|
||||
trace.report(MUST_BE_INITIALIZED.on(property));
|
||||
}
|
||||
else {
|
||||
error = true;
|
||||
trace.report(MUST_BE_INITIALIZED_OR_BE_ABSTRACT.on(property));
|
||||
}
|
||||
}
|
||||
if (!error && property.getPropertyTypeRef() == null) {
|
||||
trace.report(PROPERTY_WITH_NO_TYPE_NO_INITIALIZER.on(property));
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (inTrait) {
|
||||
|
||||
@@ -646,10 +646,6 @@ public class DescriptorResolver {
|
||||
if (propertyTypeRef == null) {
|
||||
final JetExpression initializer = property.getInitializer();
|
||||
if (initializer == null) {
|
||||
PsiElement nameIdentifier = property.getNameIdentifier();
|
||||
if (nameIdentifier != null) {
|
||||
trace.report(PROPERTY_WITH_NO_TYPE_NO_INITIALIZER.on(nameIdentifier));
|
||||
}
|
||||
return ErrorUtils.createErrorType("No type, no body");
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
// FILE: b.kt
|
||||
package MyNamespace
|
||||
//properties
|
||||
val <!MUST_BE_INITIALIZED!>a<!>: Int
|
||||
<!MUST_BE_INITIALIZED!>val a: Int<!>
|
||||
val a1: Int = 1
|
||||
<!ABSTRACT_PROPERTY_NOT_IN_CLASS!>abstract<!> val a2: Int
|
||||
<!ABSTRACT_PROPERTY_NOT_IN_CLASS!>abstract<!> val a3: Int = 1
|
||||
|
||||
var <!MUST_BE_INITIALIZED!>b<!>: Int private set
|
||||
<!MUST_BE_INITIALIZED!>var b: Int<!> private set
|
||||
var b1: Int = 0; private set
|
||||
<!ABSTRACT_PROPERTY_NOT_IN_CLASS!>abstract<!> var b2: Int private set
|
||||
<!ABSTRACT_PROPERTY_NOT_IN_CLASS!>abstract<!> var b3: Int = 0; private set
|
||||
|
||||
var <!MUST_BE_INITIALIZED!>c<!>: Int set(v: Int) { $c = v }
|
||||
<!MUST_BE_INITIALIZED!>var c: Int<!> set(v: Int) { $c = v }
|
||||
var c1: Int = 0; set(v: Int) { $c1 = v }
|
||||
<!ABSTRACT_PROPERTY_NOT_IN_CLASS!>abstract<!> var c2: Int set(v: Int) { $c2 = v }
|
||||
<!ABSTRACT_PROPERTY_NOT_IN_CLASS!>abstract<!> var c3: Int = 0; set(v: Int) { $c3 = v }
|
||||
@@ -22,7 +22,7 @@ package MyNamespace
|
||||
<!ABSTRACT_PROPERTY_NOT_IN_CLASS!>abstract<!> val e3: Int = 0; get() = a
|
||||
|
||||
//methods
|
||||
fun <!NON_MEMBER_FUNCTION_NO_BODY!>f<!>()
|
||||
<!NON_MEMBER_FUNCTION_NO_BODY!>fun f()<!>
|
||||
fun g() {}
|
||||
<!NON_MEMBER_ABSTRACT_FUNCTION!>abstract<!> fun h()
|
||||
<!NON_MEMBER_ABSTRACT_FUNCTION!>abstract<!> fun j() {}
|
||||
@@ -34,7 +34,7 @@ package MyNamespace
|
||||
var j: Int get() = i; <!ILLEGAL_MODIFIER!>abstract<!> set
|
||||
var j1: Int = <!PROPERTY_INITIALIZER_NO_BACKING_FIELD!>0<!>; get() = i; <!ILLEGAL_MODIFIER!>abstract<!> set
|
||||
|
||||
var <!MUST_BE_INITIALIZED!>k<!>: Int <!ILLEGAL_MODIFIER!>abstract<!> set
|
||||
<!MUST_BE_INITIALIZED!>var k: Int<!> <!ILLEGAL_MODIFIER!>abstract<!> set
|
||||
var k1: Int = 0; <!ILLEGAL_MODIFIER!>abstract<!> set
|
||||
|
||||
var l: Int <!ILLEGAL_MODIFIER!>abstract<!> get <!ILLEGAL_MODIFIER!>abstract<!> set
|
||||
|
||||
@@ -2,17 +2,17 @@ package abstract
|
||||
|
||||
abstract class MyAbstractClass() {
|
||||
//properties
|
||||
val <!MUST_BE_INITIALIZED_OR_BE_ABSTRACT!>a<!>: Int
|
||||
<!MUST_BE_INITIALIZED_OR_BE_ABSTRACT!>val a: Int<!>
|
||||
val a1: Int = 1
|
||||
abstract val a2: Int
|
||||
abstract val a3: Int = <!ABSTRACT_PROPERTY_WITH_INITIALIZER!>1<!>
|
||||
|
||||
var <!MUST_BE_INITIALIZED_OR_BE_ABSTRACT!>b<!>: Int private set
|
||||
<!MUST_BE_INITIALIZED_OR_BE_ABSTRACT!>var b: Int<!> private set
|
||||
var b1: Int = 0; private set
|
||||
abstract var b2: Int private set
|
||||
abstract var b3: Int = <!ABSTRACT_PROPERTY_WITH_INITIALIZER!>0<!>; private set
|
||||
|
||||
var <!MUST_BE_INITIALIZED!>c<!>: Int set(v: Int) { $c = v }
|
||||
<!MUST_BE_INITIALIZED!>var c: Int<!> set(v: Int) { $c = v }
|
||||
var c1: Int = 0; set(v: Int) { $c1 = v }
|
||||
abstract var c2: Int <!ABSTRACT_PROPERTY_WITH_SETTER!>set(v: Int) { $c2 = v }<!>
|
||||
abstract var c3: Int = <!ABSTRACT_PROPERTY_WITH_INITIALIZER!>0<!>; <!ABSTRACT_PROPERTY_WITH_SETTER!>set(v: Int) { $c3 = v }<!>
|
||||
@@ -23,7 +23,7 @@ abstract class MyAbstractClass() {
|
||||
abstract val e3: Int = <!ABSTRACT_PROPERTY_WITH_INITIALIZER!>0<!>; <!ABSTRACT_PROPERTY_WITH_GETTER!>get() = a<!>
|
||||
|
||||
//methods
|
||||
fun <!NON_ABSTRACT_FUNCTION_WITH_NO_BODY!>f<!>()
|
||||
<!NON_ABSTRACT_FUNCTION_WITH_NO_BODY!>fun f()<!>
|
||||
fun g() {}
|
||||
abstract fun h()
|
||||
<!ABSTRACT_FUNCTION_WITH_BODY!>abstract<!> fun j() {}
|
||||
@@ -35,12 +35,11 @@ abstract class MyAbstractClass() {
|
||||
var j: Int get() = i; <!ILLEGAL_MODIFIER!>abstract<!> set
|
||||
var j1: Int get() = i; <!ILLEGAL_MODIFIER!>abstract<!> set
|
||||
|
||||
var <!MUST_BE_INITIALIZED_OR_BE_ABSTRACT!>k<!>: Int <!ILLEGAL_MODIFIER!>abstract<!> set
|
||||
<!MUST_BE_INITIALIZED_OR_BE_ABSTRACT!>var k: Int<!> <!ILLEGAL_MODIFIER!>abstract<!> set
|
||||
var k1: Int = 0; <!ILLEGAL_MODIFIER!>abstract<!> set
|
||||
|
||||
var l: Int <!ILLEGAL_MODIFIER!>abstract<!> get <!ILLEGAL_MODIFIER!>abstract<!> set
|
||||
var l1: Int = <!PROPERTY_INITIALIZER_NO_BACKING_FIELD!>0<!>; <!ILLEGAL_MODIFIER!>abstract<!> get <!ILLEGAL_MODIFIER!>abstract<!> set
|
||||
|
||||
var n: Int <!ILLEGAL_MODIFIER!>abstract<!> get <!ILLEGAL_MODIFIER!>abstract<!> set(v: Int) {}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -2,17 +2,17 @@ package abstract
|
||||
|
||||
class MyClass() {
|
||||
//properties
|
||||
val <!MUST_BE_INITIALIZED_OR_BE_ABSTRACT!>a<!>: Int
|
||||
<!MUST_BE_INITIALIZED_OR_BE_ABSTRACT!>val a: Int<!>
|
||||
val a1: Int = 1
|
||||
<!ABSTRACT_PROPERTY_IN_NON_ABSTRACT_CLASS!>abstract<!> val a2: Int
|
||||
<!ABSTRACT_PROPERTY_IN_NON_ABSTRACT_CLASS!>abstract<!> val a3: Int = 1
|
||||
|
||||
var <!MUST_BE_INITIALIZED_OR_BE_ABSTRACT!>b<!>: Int private set
|
||||
<!MUST_BE_INITIALIZED_OR_BE_ABSTRACT!>var b: Int<!> private set
|
||||
var b1: Int = 0; private set
|
||||
<!ABSTRACT_PROPERTY_IN_NON_ABSTRACT_CLASS!>abstract<!> var b2: Int private set
|
||||
<!ABSTRACT_PROPERTY_IN_NON_ABSTRACT_CLASS!>abstract<!> var b3: Int = 0; private set
|
||||
|
||||
var <!MUST_BE_INITIALIZED!>c<!>: Int set(v: Int) { $c = v }
|
||||
<!MUST_BE_INITIALIZED!>var c: Int<!> set(v: Int) { $c = v }
|
||||
var c1: Int = 0; set(v: Int) { $c1 = v }
|
||||
<!ABSTRACT_PROPERTY_IN_NON_ABSTRACT_CLASS!>abstract<!> var c2: Int set(v: Int) { $c2 = v }
|
||||
<!ABSTRACT_PROPERTY_IN_NON_ABSTRACT_CLASS!>abstract<!> var c3: Int = 0; set(v: Int) { $c3 = v }
|
||||
@@ -23,7 +23,7 @@ class MyClass() {
|
||||
<!ABSTRACT_PROPERTY_IN_NON_ABSTRACT_CLASS!>abstract<!> val e3: Int = 0; get() = a
|
||||
|
||||
//methods
|
||||
fun <!NON_ABSTRACT_FUNCTION_WITH_NO_BODY!>f<!>()
|
||||
<!NON_ABSTRACT_FUNCTION_WITH_NO_BODY!>fun f()<!>
|
||||
fun g() {}
|
||||
<!ABSTRACT_FUNCTION_IN_NON_ABSTRACT_CLASS!>abstract<!> fun h()
|
||||
<!ABSTRACT_FUNCTION_IN_NON_ABSTRACT_CLASS, ABSTRACT_FUNCTION_WITH_BODY!>abstract<!> fun j() {}
|
||||
@@ -35,12 +35,11 @@ class MyClass() {
|
||||
var j: Int get() = i; <!ILLEGAL_MODIFIER!>abstract<!> set
|
||||
var j1: Int = <!PROPERTY_INITIALIZER_NO_BACKING_FIELD!>0<!>; get() = i; <!ILLEGAL_MODIFIER!>abstract<!> set
|
||||
|
||||
var <!MUST_BE_INITIALIZED_OR_BE_ABSTRACT!>k<!>: Int <!ILLEGAL_MODIFIER!>abstract<!> set
|
||||
<!MUST_BE_INITIALIZED_OR_BE_ABSTRACT!>var k: Int<!> <!ILLEGAL_MODIFIER!>abstract<!> set
|
||||
var k1: Int = 0; <!ILLEGAL_MODIFIER!>abstract<!> set
|
||||
|
||||
var l: Int <!ILLEGAL_MODIFIER!>abstract<!> get <!ILLEGAL_MODIFIER!>abstract<!> set
|
||||
var l1: Int = <!PROPERTY_INITIALIZER_NO_BACKING_FIELD!>0<!>; <!ILLEGAL_MODIFIER!>abstract<!> get <!ILLEGAL_MODIFIER!>abstract<!> set
|
||||
|
||||
var n: Int <!ILLEGAL_MODIFIER!>abstract<!> get <!ILLEGAL_MODIFIER!>abstract<!> set(v: Int) {}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -3,17 +3,17 @@ package abstract
|
||||
|
||||
enum class MyEnum() {
|
||||
//properties
|
||||
val <!MUST_BE_INITIALIZED_OR_BE_ABSTRACT!>a<!>: Int
|
||||
<!MUST_BE_INITIALIZED_OR_BE_ABSTRACT!>val a: Int<!>
|
||||
val a1: Int = 1
|
||||
abstract val a2: Int
|
||||
abstract val a3: Int = <!ABSTRACT_PROPERTY_WITH_INITIALIZER!>1<!>
|
||||
|
||||
var <!MUST_BE_INITIALIZED_OR_BE_ABSTRACT!>b<!>: Int private set
|
||||
<!MUST_BE_INITIALIZED_OR_BE_ABSTRACT!>var b: Int<!> private set
|
||||
var b1: Int = 0; private set
|
||||
abstract var b2: Int private set
|
||||
abstract var b3: Int = <!ABSTRACT_PROPERTY_WITH_INITIALIZER!>0<!>; private set
|
||||
|
||||
var <!MUST_BE_INITIALIZED!>c<!>: Int set(v: Int) { $c = v }
|
||||
<!MUST_BE_INITIALIZED!>var c: Int<!> set(v: Int) { $c = v }
|
||||
var c1: Int = 0; set(v: Int) { $c1 = v }
|
||||
abstract var c2: Int <!ABSTRACT_PROPERTY_WITH_SETTER!>set(v: Int) { $c2 = v }<!>
|
||||
abstract var c3: Int = <!ABSTRACT_PROPERTY_WITH_INITIALIZER!>0<!>; <!ABSTRACT_PROPERTY_WITH_SETTER!>set(v: Int) { $c3 = v }<!>
|
||||
@@ -24,7 +24,7 @@ enum class MyEnum() {
|
||||
abstract val e3: Int = <!ABSTRACT_PROPERTY_WITH_INITIALIZER!>0<!>; <!ABSTRACT_PROPERTY_WITH_GETTER!>get() = a<!>
|
||||
|
||||
//methods
|
||||
fun <!NON_ABSTRACT_FUNCTION_WITH_NO_BODY!>f<!>()
|
||||
<!NON_ABSTRACT_FUNCTION_WITH_NO_BODY!>fun f()<!>
|
||||
fun g() {}
|
||||
abstract fun h()
|
||||
<!ABSTRACT_FUNCTION_WITH_BODY!>abstract<!> fun j() {}
|
||||
@@ -36,12 +36,11 @@ enum class MyEnum() {
|
||||
var j: Int get() = i; <!ILLEGAL_MODIFIER!>abstract<!> set
|
||||
var j1: Int = <!PROPERTY_INITIALIZER_NO_BACKING_FIELD!>0<!>; get() = i; <!ILLEGAL_MODIFIER!>abstract<!> set
|
||||
|
||||
var <!MUST_BE_INITIALIZED_OR_BE_ABSTRACT!>k<!>: Int <!ILLEGAL_MODIFIER!>abstract<!> set
|
||||
<!MUST_BE_INITIALIZED_OR_BE_ABSTRACT!>var k: Int<!> <!ILLEGAL_MODIFIER!>abstract<!> set
|
||||
var k1: Int = 0; <!ILLEGAL_MODIFIER!>abstract<!> set
|
||||
|
||||
var l: Int <!ILLEGAL_MODIFIER!>abstract<!> get <!ILLEGAL_MODIFIER!>abstract<!> set
|
||||
var l1: Int = <!PROPERTY_INITIALIZER_NO_BACKING_FIELD!>0<!>; <!ILLEGAL_MODIFIER!>abstract<!> get <!ILLEGAL_MODIFIER!>abstract<!> set
|
||||
|
||||
var n: Int <!ILLEGAL_MODIFIER!>abstract<!> get <!ILLEGAL_MODIFIER!>abstract<!> set(v: Int) {}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -12,8 +12,8 @@ trait MyTrait {
|
||||
<!ABSTRACT_MODIFIER_IN_TRAIT!>abstract<!> var b2: Int private set
|
||||
<!ABSTRACT_MODIFIER_IN_TRAIT!>abstract<!> var b3: Int = <!ABSTRACT_PROPERTY_WITH_INITIALIZER!>0<!>; private set
|
||||
|
||||
var <!BACKING_FIELD_IN_TRAIT!>c<!>: Int set(v: Int) { $c = v }
|
||||
var <!BACKING_FIELD_IN_TRAIT!>c1<!>: Int = <!PROPERTY_INITIALIZER_IN_TRAIT!>0<!>; set(v: Int) { $c1 = v }
|
||||
<!BACKING_FIELD_IN_TRAIT!>var c: Int<!> set(v: Int) { $c = v }
|
||||
<!BACKING_FIELD_IN_TRAIT!>var c1: Int<!> = <!PROPERTY_INITIALIZER_IN_TRAIT!>0<!>; set(v: Int) { $c1 = v }
|
||||
<!ABSTRACT_MODIFIER_IN_TRAIT!>abstract<!> var c2: Int <!ABSTRACT_PROPERTY_WITH_SETTER!>set(v: Int) { $c2 = v }<!>
|
||||
<!ABSTRACT_MODIFIER_IN_TRAIT!>abstract<!> var c3: Int = <!ABSTRACT_PROPERTY_WITH_INITIALIZER!>0<!>; <!ABSTRACT_PROPERTY_WITH_SETTER!>set(v: Int) { $c3 = v }<!>
|
||||
|
||||
@@ -42,4 +42,4 @@ trait MyTrait {
|
||||
var l1: Int = <!PROPERTY_INITIALIZER_IN_TRAIT!>0<!>; <!ILLEGAL_MODIFIER!>abstract<!> get <!ILLEGAL_MODIFIER!>abstract<!> set
|
||||
|
||||
var n: Int <!ILLEGAL_MODIFIER!>abstract<!> get <!ILLEGAL_MODIFIER!>abstract<!> set(v: Int) {}
|
||||
}
|
||||
}
|
||||
@@ -28,12 +28,12 @@ class WithPC1(a : Int) {
|
||||
}
|
||||
|
||||
|
||||
class Foo() : <!SUPERTYPE_NOT_INITIALIZED_DEFAULT, FINAL_SUPERTYPE!>WithPC0<!>, <!MANY_CLASSES_IN_SUPERTYPE_LIST, SYNTAX!>this<!>() {
|
||||
class Foo() : <!SUPERTYPE_NOT_INITIALIZED_DEFAULT, FINAL_SUPERTYPE!>WithPC0<!>, <!SYNTAX!>this<!>() {
|
||||
|
||||
}
|
||||
|
||||
class WithCPI_Dup(x : Int) {
|
||||
var <!MUST_BE_INITIALIZED_OR_BE_ABSTRACT!>x<!> : Int
|
||||
<!MUST_BE_INITIALIZED_OR_BE_ABSTRACT!>var x : Int<!>
|
||||
}
|
||||
|
||||
class WithCPI(x : Int) {
|
||||
|
||||
@@ -168,9 +168,9 @@ fun f(): Int {
|
||||
|
||||
fun f1(): Int = if (1 < 2) 1 else returnNothing()
|
||||
|
||||
public fun <!PUBLIC_MEMBER_SHOULD_SPECIFY_TYPE!>f2<!>() = 1
|
||||
<!PUBLIC_MEMBER_SHOULD_SPECIFY_TYPE!>public fun f2()<!> = 1
|
||||
class B() {
|
||||
protected fun <!PUBLIC_MEMBER_SHOULD_SPECIFY_TYPE!>f<!>() = "ss"
|
||||
<!PUBLIC_MEMBER_SHOULD_SPECIFY_TYPE!>protected fun f()<!> = "ss"
|
||||
}
|
||||
|
||||
fun testFunctionLiterals() {
|
||||
|
||||
@@ -5,7 +5,7 @@ abstract class A() {
|
||||
abstract <!REDUNDANT_MODIFIER!>open<!> fun g()
|
||||
<!INCOMPATIBLE_MODIFIERS!>final<!> <!INCOMPATIBLE_MODIFIERS!>open<!> fun h() {}
|
||||
|
||||
open var <!MUST_BE_INITIALIZED_OR_BE_ABSTRACT!>r<!>: String
|
||||
<!MUST_BE_INITIALIZED_OR_BE_ABSTRACT!>open var r: String<!>
|
||||
get
|
||||
<!ILLEGAL_MODIFIER!>abstract<!> protected set
|
||||
}
|
||||
@@ -18,4 +18,4 @@ class FinalClass() {
|
||||
<!ILLEGAL_MODIFIER!>open<!> get(): Int = $i
|
||||
var j: Int = 1
|
||||
<!ILLEGAL_MODIFIER!>open<!> set(v: Int) {}
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
class X {
|
||||
val <!MUST_BE_INITIALIZED_OR_BE_ABSTRACT!>x<!> : Int
|
||||
<!MUST_BE_INITIALIZED_OR_BE_ABSTRACT!>val x : Int<!>
|
||||
}
|
||||
|
||||
open class Y() {
|
||||
@@ -26,4 +26,4 @@ class MyIterable<T> : Iterable<T>
|
||||
throw UnsupportedOperationException()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -25,5 +25,5 @@ class Test() {
|
||||
<!NO_BACKING_FIELD_CUSTOM_ACCESSORS!>$b<!> = $a
|
||||
a = <!NO_BACKING_FIELD_CUSTOM_ACCESSORS!>$b<!>
|
||||
}
|
||||
public val <!PUBLIC_MEMBER_SHOULD_SPECIFY_TYPE!>i<!> = 1
|
||||
<!PUBLIC_MEMBER_SHOULD_SPECIFY_TYPE!>public val i<!> = 1
|
||||
}
|
||||
@@ -161,7 +161,7 @@ class AnonymousInitializers(var a: String, val b: String) {
|
||||
}
|
||||
}
|
||||
|
||||
val <!MUST_BE_INITIALIZED_OR_BE_ABSTRACT!>o<!>: String
|
||||
<!MUST_BE_INITIALIZED_OR_BE_ABSTRACT!>val o: String<!>
|
||||
{
|
||||
if (1 < 3) {
|
||||
$o = "a"
|
||||
@@ -198,7 +198,7 @@ open class Open(a: Int, w: Int) {}
|
||||
|
||||
class LocalValsVsProperties(val a: Int, w: Int) : Open(a, w) {
|
||||
val x : Int
|
||||
val <!MUST_BE_INITIALIZED_OR_BE_ABSTRACT!>y<!> : Int
|
||||
<!MUST_BE_INITIALIZED_OR_BE_ABSTRACT!>val y : Int<!>
|
||||
{
|
||||
$x = 1
|
||||
val b = x
|
||||
@@ -267,7 +267,7 @@ class ClassObject() {
|
||||
fun foo() {
|
||||
val <!UNUSED_VARIABLE!>a<!> = object {
|
||||
val x : Int
|
||||
val <!MUST_BE_INITIALIZED_OR_BE_ABSTRACT!>y<!> : Int
|
||||
<!MUST_BE_INITIALIZED_OR_BE_ABSTRACT!>val y : Int<!>
|
||||
val z : Int
|
||||
{
|
||||
$x = 1
|
||||
@@ -281,11 +281,11 @@ fun foo() {
|
||||
}
|
||||
|
||||
class TestObjectExpression() {
|
||||
val <!MUST_BE_INITIALIZED_OR_BE_ABSTRACT!>a<!> : Int
|
||||
<!MUST_BE_INITIALIZED_OR_BE_ABSTRACT!>val a : Int<!>
|
||||
fun foo() {
|
||||
val <!UNUSED_VARIABLE!>a<!> = object {
|
||||
val x : Int
|
||||
val <!MUST_BE_INITIALIZED_OR_BE_ABSTRACT!>y<!> : Int
|
||||
<!MUST_BE_INITIALIZED_OR_BE_ABSTRACT!>val y : Int<!>
|
||||
{
|
||||
if (true)
|
||||
x = 12
|
||||
@@ -308,7 +308,7 @@ class TestObjectExpression() {
|
||||
|
||||
object TestObjectDeclaration {
|
||||
val x : Int
|
||||
val <!MUST_BE_INITIALIZED_OR_BE_ABSTRACT!>y<!> : Int
|
||||
<!MUST_BE_INITIALIZED_OR_BE_ABSTRACT!>val y : Int<!>
|
||||
{
|
||||
$x = 1
|
||||
}
|
||||
@@ -349,4 +349,4 @@ fun test(m : M) {
|
||||
fun test1(m : M) {
|
||||
<!VAL_REASSIGNMENT!>m.x<!>++
|
||||
m.y--
|
||||
}
|
||||
}
|
||||
@@ -36,7 +36,7 @@ fun test() {
|
||||
val Int.abs : Int
|
||||
get() = if (this > 0) this else -this;
|
||||
|
||||
val <T> T.<!MUST_BE_INITIALIZED!>foo<!> : T
|
||||
<!MUST_BE_INITIALIZED!>val <T> T.foo : T<!>
|
||||
|
||||
fun Int.foo() = this
|
||||
|
||||
@@ -72,4 +72,4 @@ import outer.*
|
||||
c<!UNNECESSARY_SAFE_CALL!>?.<!>equals2(null)
|
||||
|
||||
if (command == null) 1
|
||||
}
|
||||
}
|
||||
+1
@@ -0,0 +1 @@
|
||||
fun foo() =<!SYNTAX!><!>
|
||||
+1
@@ -0,0 +1 @@
|
||||
fun<!SYNTAX, SYNTAX, SYNTAX, SYNTAX, SYNTAX!><!>
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
package c
|
||||
|
||||
val i =<!SYNTAX!><!>
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
package c
|
||||
|
||||
val i : String get() =<!SYNTAX!><!>
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
fun test(a: Any) {
|
||||
when (a)<!SYNTAX!><!>
|
||||
}<!SYNTAX!><!>
|
||||
+1
@@ -0,0 +1 @@
|
||||
<!NON_MEMBER_FUNCTION_NO_BODY!>fun bar()<!>
|
||||
@@ -6,7 +6,7 @@ fun sum(a : IntArray) : Int {
|
||||
<!UNRESOLVED_REFERENCE!>res<!> = 0
|
||||
for (e in a)
|
||||
res +=<!SYNTAX!><!>
|
||||
<!NO_RETURN_IN_FUNCTION_WITH_BLOCK_BODY!>}<!>
|
||||
}
|
||||
fun main(args : Array<String>) {
|
||||
test(0)
|
||||
test(1, 1)
|
||||
@@ -27,4 +27,4 @@ fun assertEquals<T>(actual : T?, expected : T?, message : Any? = null) {
|
||||
else
|
||||
throw AssertionError(message)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3,8 +3,8 @@ abstract class Test() {
|
||||
abstract val x1 : Int get
|
||||
abstract val x2 : Int <!ABSTRACT_PROPERTY_WITH_GETTER!>get() = 1<!>
|
||||
|
||||
val <!MUST_BE_INITIALIZED_OR_BE_ABSTRACT!>a<!> : Int
|
||||
val <!MUST_BE_INITIALIZED_OR_BE_ABSTRACT!>b<!> : Int get
|
||||
<!MUST_BE_INITIALIZED_OR_BE_ABSTRACT!>val a : Int<!>
|
||||
<!MUST_BE_INITIALIZED_OR_BE_ABSTRACT!>val b : Int<!> get
|
||||
val c = 1
|
||||
|
||||
val c1 = 1
|
||||
@@ -15,7 +15,7 @@ abstract class Test() {
|
||||
get() { return 1 }
|
||||
val c4 : Int
|
||||
get() = 1
|
||||
val <!MUST_BE_INITIALIZED!>c5<!> : Int
|
||||
<!MUST_BE_INITIALIZED!>val c5 : Int<!>
|
||||
get() = $c5 + 1
|
||||
|
||||
abstract var y : Int
|
||||
@@ -26,19 +26,19 @@ abstract class Test() {
|
||||
abstract var y5 : Int <!ABSTRACT_PROPERTY_WITH_SETTER!>set(x) {}<!> <!ABSTRACT_PROPERTY_WITH_GETTER!>get() = 1<!>
|
||||
abstract var y6 : Int <!ABSTRACT_PROPERTY_WITH_SETTER!>set(x) {}<!>
|
||||
|
||||
var <!MUST_BE_INITIALIZED_OR_BE_ABSTRACT!>v<!> : Int
|
||||
var <!MUST_BE_INITIALIZED_OR_BE_ABSTRACT!>v1<!> : Int get
|
||||
var <!MUST_BE_INITIALIZED_OR_BE_ABSTRACT!>v2<!> : Int get set
|
||||
var <!MUST_BE_INITIALIZED!>v3<!> : Int get() = 1; set
|
||||
<!MUST_BE_INITIALIZED_OR_BE_ABSTRACT!>var v : Int<!>
|
||||
<!MUST_BE_INITIALIZED_OR_BE_ABSTRACT!>var v1 : Int<!> get
|
||||
<!MUST_BE_INITIALIZED_OR_BE_ABSTRACT!>var v2 : Int<!> get set
|
||||
<!MUST_BE_INITIALIZED!>var v3 : Int<!> get() = 1; set
|
||||
var v4 : Int get() = 1; set(x){}
|
||||
|
||||
var <!MUST_BE_INITIALIZED!>v5<!> : Int get() = 1; set(x){$v5 = x}
|
||||
var <!MUST_BE_INITIALIZED!>v6<!> : Int get() = $v6 + 1; set(x){}
|
||||
<!MUST_BE_INITIALIZED!>var v5 : Int<!> get() = 1; set(x){$v5 = x}
|
||||
<!MUST_BE_INITIALIZED!>var v6 : Int<!> get() = $v6 + 1; set(x){}
|
||||
|
||||
abstract val v7 : Int get
|
||||
abstract var v8 : Int get set
|
||||
var <!MUST_BE_INITIALIZED_OR_BE_ABSTRACT!>v9<!> : Int set
|
||||
var <!MUST_BE_INITIALIZED_OR_BE_ABSTRACT!>v10<!> : Int get
|
||||
<!MUST_BE_INITIALIZED_OR_BE_ABSTRACT!>var v9 : Int<!> set
|
||||
<!MUST_BE_INITIALIZED_OR_BE_ABSTRACT!>var v10 : Int<!> get
|
||||
abstract val v11 : Int <!ILLEGAL_MODIFIER!>abstract<!> get
|
||||
abstract var v12 : Int <!ILLEGAL_MODIFIER!>abstract<!> get <!ILLEGAL_MODIFIER!>abstract<!> set
|
||||
|
||||
@@ -56,4 +56,4 @@ class TestPCParameters(w : Int, x : Int, val y : Int, var z : Int) : Super(w) {
|
||||
|
||||
fun foo() = <!UNRESOLVED_REFERENCE!>x<!>
|
||||
|
||||
}
|
||||
}
|
||||
@@ -5,5 +5,5 @@ abstract class MyAbstractClass<T> {
|
||||
}
|
||||
|
||||
abstract class MyLegalAbstractClass2<T>(t : T) : MyAbstractClass<Int>() {
|
||||
<!CONFLICTING_OVERLOADS!>val <R> pr : T = t<!>
|
||||
}
|
||||
<!CONFLICTING_OVERLOADS!>val <R> pr : T<!> = t
|
||||
}
|
||||
+2
-2
@@ -3,5 +3,5 @@ open class Aaa() {
|
||||
}
|
||||
|
||||
open class Bbb() : Aaa() {
|
||||
<!CONFLICTING_OVERLOADS!>val <T> bar = "aa"<!>
|
||||
}
|
||||
<!CONFLICTING_OVERLOADS!>val <T> bar<!> = "aa"
|
||||
}
|
||||
@@ -23,8 +23,8 @@ open class MyGenericClass<T>(t : T) : MyTrait<T>, MyAbstractClass<T>(), MyProps<
|
||||
class MyChildClass() : MyGenericClass<Int>(1) {}
|
||||
class MyChildClass1<T>(t : T) : MyGenericClass<T>(t) {}
|
||||
class MyChildClass2<T>(t : T) : MyGenericClass<T>(t) {
|
||||
fun <!VIRTUAL_MEMBER_HIDDEN!>foo<!>(t: T) = t
|
||||
val <!VIRTUAL_MEMBER_HIDDEN!>pr<!> : T = t
|
||||
<!VIRTUAL_MEMBER_HIDDEN!>fun foo(t: T)<!> = t
|
||||
<!VIRTUAL_MEMBER_HIDDEN!>val pr : T<!> = t
|
||||
override fun bar(t: T) = t
|
||||
override val p : T = t
|
||||
}
|
||||
@@ -43,7 +43,7 @@ abstract class MyAbstractClass1 : MyTrait<Int>, MyAbstractClass<String>() {
|
||||
class <!ABSTRACT_MEMBER_NOT_IMPLEMENTED!>MyIllegalGenericClass1<!><T> : MyTrait<T>, MyAbstractClass<T>() {}
|
||||
class <!ABSTRACT_MEMBER_NOT_IMPLEMENTED!>MyIllegalGenericClass2<!><T, R>(r : R) : MyTrait<T>, MyAbstractClass<R>() {
|
||||
<!NOTHING_TO_OVERRIDE!>override<!> fun foo(r: R) = r
|
||||
<!CONFLICTING_OVERLOADS!><!NOTHING_TO_OVERRIDE!>override<!> val <T> pr : R = r<!>
|
||||
<!CONFLICTING_OVERLOADS!><!NOTHING_TO_OVERRIDE!>override<!> val <T> pr : R<!> = r
|
||||
}
|
||||
class <!ABSTRACT_MEMBER_NOT_IMPLEMENTED!>MyIllegalClass1<!> : MyTrait<Int>, MyAbstractClass<String>() {}
|
||||
abstract class MyLegalAbstractClass1 : MyTrait<Int>, MyAbstractClass<String>() {}
|
||||
@@ -51,10 +51,10 @@ abstract class MyLegalAbstractClass1 : MyTrait<Int>, MyAbstractClass<String>() {
|
||||
class <!ABSTRACT_MEMBER_NOT_IMPLEMENTED!>MyIllegalClass2<!><T>(t : T) : MyTrait<Int>, MyAbstractClass<Int>() {
|
||||
fun foo(t: T) = t
|
||||
fun bar(t: T) = t
|
||||
<!CONFLICTING_OVERLOADS!>val <R> pr : T = t<!>
|
||||
<!CONFLICTING_OVERLOADS!>val <R> pr : T<!> = t
|
||||
}
|
||||
abstract class MyLegalAbstractClass2<T>(t : T) : MyTrait<Int>, MyAbstractClass<Int>() {
|
||||
fun foo(t: T) = t
|
||||
fun bar(t: T) = t
|
||||
<!CONFLICTING_OVERLOADS!>val <R> pr : T = t<!>
|
||||
}
|
||||
<!CONFLICTING_OVERLOADS!>val <R> pr : T<!> = t
|
||||
}
|
||||
+2
-2
@@ -7,9 +7,9 @@ trait Y {
|
||||
}
|
||||
|
||||
class Z : X, Y {
|
||||
override fun foo(<!MULTIPLE_DEFAULTS_INHERITED_FROM_SUPERTYPES!>a<!> : Int) {}
|
||||
override fun foo(<!MULTIPLE_DEFAULTS_INHERITED_FROM_SUPERTYPES!>a : Int<!>) {}
|
||||
}
|
||||
|
||||
object ZO : X, Y {
|
||||
override fun foo(<!MULTIPLE_DEFAULTS_INHERITED_FROM_SUPERTYPES!>a<!> : Int) {}
|
||||
override fun foo(<!MULTIPLE_DEFAULTS_INHERITED_FROM_SUPERTYPES!>a : Int<!>) {}
|
||||
}
|
||||
+2
-2
@@ -7,9 +7,9 @@ trait Y {
|
||||
}
|
||||
|
||||
class Z : X, Y {
|
||||
fun <!VIRTUAL_MEMBER_HIDDEN!>foo<!>(a : Int) {}
|
||||
<!VIRTUAL_MEMBER_HIDDEN!>fun foo(a : Int)<!> {}
|
||||
}
|
||||
|
||||
object ZO : X, Y {
|
||||
fun <!VIRTUAL_MEMBER_HIDDEN!>foo<!>(a : Int) {}
|
||||
<!VIRTUAL_MEMBER_HIDDEN!>fun foo(a : Int)<!> {}
|
||||
}
|
||||
@@ -36,15 +36,15 @@ class <!ABSTRACT_MEMBER_NOT_IMPLEMENTED!>MyIllegalClass3<!>() : MyTrait, MyAbstr
|
||||
}
|
||||
|
||||
class <!ABSTRACT_MEMBER_NOT_IMPLEMENTED!>MyIllegalClass4<!>() : MyTrait, MyAbstractClass() {
|
||||
fun <!VIRTUAL_MEMBER_HIDDEN!>foo<!>() {}
|
||||
val <!VIRTUAL_MEMBER_HIDDEN, MUST_BE_INITIALIZED_OR_BE_ABSTRACT!>pr<!> : Unit
|
||||
<!VIRTUAL_MEMBER_HIDDEN!>fun foo()<!> {}
|
||||
<!VIRTUAL_MEMBER_HIDDEN, MUST_BE_INITIALIZED_OR_BE_ABSTRACT!>val pr : Unit<!>
|
||||
<!NOTHING_TO_OVERRIDE!>override<!> fun other() {}
|
||||
<!NOTHING_TO_OVERRIDE!>override<!> val otherPr : Int = 1
|
||||
}
|
||||
|
||||
class MyChildClass1() : MyClass() {
|
||||
fun <!VIRTUAL_MEMBER_HIDDEN!>foo<!>() {}
|
||||
val <!VIRTUAL_MEMBER_HIDDEN!>pr<!> : Unit = #()
|
||||
<!VIRTUAL_MEMBER_HIDDEN!>fun foo()<!> {}
|
||||
<!VIRTUAL_MEMBER_HIDDEN!>val pr : Unit<!> = #()
|
||||
override fun bar() {}
|
||||
override val prr : Unit = #()
|
||||
}
|
||||
}
|
||||
@@ -10,7 +10,7 @@ trait T {
|
||||
}
|
||||
|
||||
class G : C(), T {
|
||||
<!CANNOT_INFER_VISIBILITY!>override<!> fun foo() {} //should be an error "cannot infer visibility"; for now 'public' is inferred in such cases
|
||||
<!CANNOT_INFER_VISIBILITY!>override fun foo()<!> {} //should be an error "cannot infer visibility"; for now 'public' is inferred in such cases
|
||||
}
|
||||
|
||||
open class A {
|
||||
|
||||
@@ -142,6 +142,7 @@ public class JetPsiChecker implements Annotator {
|
||||
private static void registerDiagnosticAnnotations(@NotNull Diagnostic diagnostic,
|
||||
@NotNull Set<PsiElement> redeclarations,
|
||||
@NotNull final AnnotationHolder holder) {
|
||||
if (!diagnostic.isValid()) return;
|
||||
List<TextRange> textRanges = diagnostic.getTextRanges();
|
||||
if (diagnostic.getSeverity() == Severity.ERROR) {
|
||||
if (diagnostic.getFactory() == Errors.UNRESOLVED_IDE_TEMPLATE) {
|
||||
@@ -271,7 +272,7 @@ public class JetPsiChecker implements Annotator {
|
||||
@NotNull AnnotationHolder holder) {
|
||||
if (!redeclarations.add(redeclarationDiagnostic.getPsiElement())) return null;
|
||||
List<TextRange> textRanges = redeclarationDiagnostic.getTextRanges();
|
||||
if (textRanges.isEmpty()) return null;
|
||||
if (!redeclarationDiagnostic.isValid()) return null;
|
||||
Annotation annotation = holder.createErrorAnnotation(textRanges.get(0), "");
|
||||
annotation.setTooltip(getMessage(redeclarationDiagnostic));
|
||||
return annotation;
|
||||
|
||||
@@ -2,17 +2,17 @@ package abstract
|
||||
|
||||
class MyClass() {
|
||||
//properties
|
||||
val <error>a</error>: Int
|
||||
<error>val a: Int</error>
|
||||
val a1: Int = 1
|
||||
<error>abstract</error> val a2: Int
|
||||
<error>abstract</error> val a3: Int = 1
|
||||
|
||||
var <error>b</error>: Int private set
|
||||
<error>var b: Int</error> private set
|
||||
var b1: Int = 0; private set
|
||||
<error>abstract</error> var b2: Int private set
|
||||
<error>abstract</error> var b3: Int = 0; private set
|
||||
|
||||
var <error>c</error>: Int set(v: Int) { $c = v }
|
||||
<error>var c: Int</error> set(v: Int) { $c = v }
|
||||
var c1: Int = 0; set(v: Int) { $c1 = v }
|
||||
<error>abstract</error> var c2: Int set(v: Int) { $c2 = v }
|
||||
<error>abstract</error> var c3: Int = 0; set(v: Int) { $c3 = v }
|
||||
@@ -23,7 +23,7 @@ class MyClass() {
|
||||
<error>abstract</error> val e3: Int = 0; get() = a
|
||||
|
||||
//methods
|
||||
fun <error>f</error>()
|
||||
<error>fun f()</error>
|
||||
fun g() {}
|
||||
<error>abstract</error> fun h()
|
||||
<error><error>abstract</error></error> fun j() {}
|
||||
@@ -31,17 +31,17 @@ class MyClass() {
|
||||
|
||||
abstract class MyAbstractClass() {
|
||||
//properties
|
||||
val <error>a</error>: Int
|
||||
<error>val a: Int</error>
|
||||
val a1: Int = 1
|
||||
abstract val a2: Int
|
||||
abstract val a3: Int = <error>1</error>
|
||||
|
||||
var <error>b</error>: Int private set
|
||||
<error>var b: Int</error> private set
|
||||
var b1: Int = 0; private set
|
||||
abstract var b2: Int private set
|
||||
abstract var b3: Int = <error>0</error>; private set
|
||||
|
||||
var <error>c</error>: Int set(v: Int) { $c = v }
|
||||
<error>var c: Int</error> set(v: Int) { $c = v }
|
||||
var c1: Int = 0; set(v: Int) { $c1 = v }
|
||||
abstract var c2: Int <error>set(v: Int) { $c2 = v }</error>
|
||||
abstract var c3: Int = <error>0</error>; <error>set(v: Int) { $c3 = v }</error>
|
||||
@@ -52,7 +52,7 @@ abstract class MyAbstractClass() {
|
||||
abstract val e3: Int = <error>0</error>; <error>get() = a</error>
|
||||
|
||||
//methods
|
||||
fun <error>f</error>()
|
||||
<error>fun f()</error>
|
||||
fun g() {}
|
||||
abstract fun h()
|
||||
<error>abstract</error> fun j() {}
|
||||
@@ -70,8 +70,8 @@ trait MyTrait {
|
||||
<warning>abstract</warning> var b2: Int private set
|
||||
<warning>abstract</warning> var b3: Int = <error>0</error>; private set
|
||||
|
||||
var <error>c</error>: Int set(v: Int) { $c = v }
|
||||
var <error>c1</error>: Int = <error>0</error>; set(v: Int) { $c1 = v }
|
||||
<error>var c: Int</error> set(v: Int) { $c = v }
|
||||
<error>var c1: Int</error> = <error>0</error>; set(v: Int) { $c1 = v }
|
||||
<warning>abstract</warning> var c2: Int <error>set(v: Int) { $c2 = v }</error>
|
||||
<warning>abstract</warning> var c3: Int = <error>0</error>; <error>set(v: Int) { $c3 = v }</error>
|
||||
|
||||
@@ -89,17 +89,17 @@ trait MyTrait {
|
||||
|
||||
enum class MyEnum() {
|
||||
//properties
|
||||
val <error>a</error>: Int
|
||||
<error>val a: Int</error>
|
||||
val a1: Int = 1
|
||||
abstract val a2: Int
|
||||
abstract val a3: Int = <error>1</error>
|
||||
|
||||
var <error>b</error>: Int private set
|
||||
<error>var b: Int</error> private set
|
||||
var b1: Int = 0; private set
|
||||
abstract var b2: Int private set
|
||||
abstract var b3: Int = <error>0</error>; private set
|
||||
|
||||
var <error>c</error>: Int set(v: Int) { $c = v }
|
||||
<error>var c: Int</error> set(v: Int) { $c = v }
|
||||
var c1: Int = 0; set(v: Int) { $c1 = v }
|
||||
abstract var c2: Int <error>set(v: Int) { $c2 = v }</error>
|
||||
abstract var c3: Int = <error>0</error>; <error>set(v: Int) { $c3 = v }</error>
|
||||
@@ -110,7 +110,7 @@ enum class MyEnum() {
|
||||
abstract val e3: Int = <error>0</error>; <error>get() = a</error>
|
||||
|
||||
//methods
|
||||
fun <error>f</error>()
|
||||
<error>fun f()</error>
|
||||
fun g() {}
|
||||
abstract fun h()
|
||||
<error>abstract</error> fun j() {}
|
||||
@@ -120,17 +120,17 @@ abstract enum class MyAbstractEnum() {}
|
||||
|
||||
//package MyNamespace {
|
||||
//properties
|
||||
val <error>a</error>: Int
|
||||
<error>val a: Int</error>
|
||||
val a1: Int = 1
|
||||
<error>abstract</error> val a2: Int
|
||||
<error>abstract</error> val a3: Int = 1
|
||||
|
||||
var <error>b</error>: Int private set
|
||||
<error>var b: Int</error> private set
|
||||
var b1: Int = 0; private set
|
||||
<error>abstract</error> var b2: Int private set
|
||||
<error>abstract</error> var b3: Int = 0; private set
|
||||
|
||||
var <error>c</error>: Int set(v: Int) { $c = v }
|
||||
<error>var c: Int</error> set(v: Int) { $c = v }
|
||||
var c1: Int = 0; set(v: Int) { $c1 = v }
|
||||
<error>abstract</error> var c2: Int set(v: Int) { $c2 = v }
|
||||
<error>abstract</error> var c3: Int = 0; set(v: Int) { $c3 = v }
|
||||
@@ -141,7 +141,7 @@ abstract enum class MyAbstractEnum() {}
|
||||
<error>abstract</error> val e3: Int = 0; get() = a
|
||||
|
||||
//methods
|
||||
fun <error>f</error>()
|
||||
<error>fun f()</error>
|
||||
fun g() {}
|
||||
<error>abstract</error> fun h()
|
||||
<error>abstract</error> fun j() {}
|
||||
|
||||
@@ -34,7 +34,7 @@ class Foo() : <error>WithPC0</error>(), <error>this</error>() {
|
||||
}
|
||||
|
||||
class WithCPI_Dup(x : Int) {
|
||||
var <error>x</error> : Int
|
||||
<error>var x : Int</error>
|
||||
}
|
||||
|
||||
class WithCPI(x : Int) {
|
||||
|
||||
@@ -33,7 +33,7 @@ fun test() {
|
||||
val Int.abs : Int
|
||||
get() = if (this > 0) this else -this;
|
||||
|
||||
val <T> T.<error>foo</error> : T
|
||||
<error>val <T> T.foo : T</error>
|
||||
|
||||
fun Int.foo() = this
|
||||
|
||||
|
||||
@@ -26,11 +26,11 @@ package override
|
||||
}
|
||||
|
||||
class <error>MyIllegalClass4</error> : MyTrait, MyAbstractClass() {
|
||||
fun <error>foo</error>() {}
|
||||
<error>fun foo()</error> {}
|
||||
<error>override</error> fun other() {}
|
||||
}
|
||||
|
||||
class MyChildClass1 : MyClass() {
|
||||
fun <error>foo</error>() {}
|
||||
<error>fun foo()</error> {}
|
||||
override fun bar() {}
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
class MyChildClass : MyGenericClass<Int>() {}
|
||||
class MyChildClass1<T> : MyGenericClass<T>() {}
|
||||
class MyChildClass2<T> : MyGenericClass<T>() {
|
||||
fun <error>foo</error>(t: T) = t
|
||||
<error>fun foo(t: T)</error> = t
|
||||
override fun bar(t: T) = t
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
class X {
|
||||
val <error>x</error> : Int
|
||||
<error>val x : Int</error>
|
||||
}
|
||||
|
||||
open class Y() {
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
<info>abstract</info> val x1 : Int <info>get</info>
|
||||
<info>abstract</info> val x2 : Int <error><info>get</info>() = 1</error>
|
||||
|
||||
val <error>a</error> : Int
|
||||
val <error>b</error> : Int <info>get</info>
|
||||
<error>val a : Int</error>
|
||||
<error>val b : Int</error> <info>get</info>
|
||||
val <info>c</info> = 1
|
||||
|
||||
val <info>c1</info> = 1
|
||||
@@ -15,7 +15,7 @@
|
||||
<info>get</info>() { return 1 }
|
||||
val c4 : Int
|
||||
<info>get</info>() = 1
|
||||
val <error>c5</error> : Int
|
||||
<error>val c5 : Int</error>
|
||||
<info>get</info>() = $c5 + 1
|
||||
|
||||
<info>abstract</info> var y : Int
|
||||
@@ -26,17 +26,17 @@
|
||||
<info>abstract</info> var y5 : Int <error><info>set</info>(x) {}</error> <error><info>get</info>() = 1</error>
|
||||
<info>abstract</info> var y6 : Int <error><info>set</info>(x) {}</error>
|
||||
|
||||
var <error>v</error> : Int
|
||||
var <error>v1</error> : Int <info>get</info>
|
||||
var <error>v2</error> : Int <info>get</info> <info>set</info>
|
||||
var <error>v3</error> : Int <info>get</info>() = 1; <info>set</info>
|
||||
<error>var v : Int</error>
|
||||
<error>var v1 : Int</error> <info>get</info>
|
||||
<error>var v2 : Int</error> <info>get</info> <info>set</info>
|
||||
<error>var v3 : Int</error> <info>get</info>() = 1; <info>set</info>
|
||||
var v4 : Int <info>get</info>() = 1; <info>set</info>(x){}
|
||||
|
||||
var <error>v5</error> : Int <info>get</info>() = 1; <info>set</info>(x){$v5 = x}
|
||||
var <error>v6</error> : Int <info>get</info>() = $v6 + 1; <info>set</info>(x){}
|
||||
<error>var v5 : Int</error> <info>get</info>() = 1; <info>set</info>(x){$v5 = x}
|
||||
<error>var v6 : Int</error> <info>get</info>() = $v6 + 1; <info>set</info>(x){}
|
||||
|
||||
var <error>v9</error> : Int <info>set</info>
|
||||
var <error>v10</error> : Int <info>get</info>
|
||||
<error>var v9 : Int</error> <info>set</info>
|
||||
<error>var v10 : Int</error> <info>get</info>
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user