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:
Andrey Breslav
2011-05-16 21:29:07 +04:00
parent 92e1391ca5
commit 7f07ae6aeb
3 changed files with 12 additions and 3 deletions
@@ -70,7 +70,10 @@ public class JetPsiChecker implements Annotator {
private void markRedeclaration(DeclarationDescriptor redeclaration) {
if (!redeclarations.add(redeclaration)) return;
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");
}
}
+2 -2
View File
@@ -33,8 +33,8 @@ class Foo() : <error>WithPC0</error>, <error>this</error>() {
}
class WithCPI_Dup(<error>x : Int</error>) {
<error>var x : Int</error>
class WithCPI_Dup(<error>x</error> : Int) {
var <error>x</error> : 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
}