Test for JET-17 Do not infer property types by the initializer before the containing scope is ready
Granular highlighting for redeclaration errors
This commit is contained in:
@@ -70,7 +70,10 @@ public class JetPsiChecker implements Annotator {
|
|||||||
private void markRedeclaration(DeclarationDescriptor redeclaration) {
|
private void markRedeclaration(DeclarationDescriptor redeclaration) {
|
||||||
if (!redeclarations.add(redeclaration)) return;
|
if (!redeclarations.add(redeclaration)) return;
|
||||||
PsiElement declarationPsiElement = bindingContext.getDeclarationPsiElement(redeclaration);
|
PsiElement declarationPsiElement = bindingContext.getDeclarationPsiElement(redeclaration);
|
||||||
if (declarationPsiElement != null) {
|
if (declarationPsiElement instanceof JetNamedDeclaration) {
|
||||||
|
holder.createErrorAnnotation(((JetNamedDeclaration) declarationPsiElement).getNameIdentifier(), "Redeclaration");
|
||||||
|
}
|
||||||
|
else if (declarationPsiElement != null) {
|
||||||
holder.createErrorAnnotation(declarationPsiElement, "Redeclaration");
|
holder.createErrorAnnotation(declarationPsiElement, "Redeclaration");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,8 +33,8 @@ class Foo() : <error>WithPC0</error>, <error>this</error>() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class WithCPI_Dup(<error>x : Int</error>) {
|
class WithCPI_Dup(<error>x</error> : Int) {
|
||||||
<error>var x : Int</error>
|
var <error>x</error> : Int
|
||||||
}
|
}
|
||||||
|
|
||||||
class WithCPI(x : Int) {
|
class WithCPI(x : Int) {
|
||||||
|
|||||||
@@ -0,0 +1,6 @@
|
|||||||
|
// JET-17 Do not infer property types by the initializer before the containing scope is ready
|
||||||
|
|
||||||
|
class WithC() {
|
||||||
|
val a = 1
|
||||||
|
val b = $a // error here, but must not be
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user