KT-156 Fix the this<Super> syntax

This commit is contained in:
Andrey Breslav
2011-10-20 18:00:19 +04:00
parent 7bb7ea912e
commit e91d20f326
7 changed files with 68 additions and 8 deletions
@@ -46,4 +46,17 @@ fun foo() {
<!SUPER_IS_NOT_AN_EXPRESSION!>super<!>
super.foo()
super<Nothing>.foo()
}
}
trait G<T> {
fun foo() {}
}
class CG : G<Int> {
fun test() {
super<G>.foo() // OK
super<G<!TYPE_ARGUMENTS_REDUNDANT_IN_SUPER_QUALIFIER!><Int><!>>.foo() // Warning
super<<!NOT_A_SUPERTYPE!>G<<!UNRESOLVED_REFERENCE!>E<!>><!>>.foo() // Error
super<<!NOT_A_SUPERTYPE!>G<String><!>>.foo() // Error
}
}
+10
View File
@@ -23,4 +23,14 @@
`T`super.foo()
}
}
}
~G~trait G<T> {
fun foo() {}
}
class CG : G<Int> {
fun test() {
`G`super<`G`G>.foo() // OK
}
}
@@ -7,6 +7,7 @@ import com.intellij.mock.*;
import com.intellij.openapi.Disposable;
import com.intellij.openapi.editor.Document;
import com.intellij.openapi.editor.EditorFactory;
import com.intellij.openapi.extensions.Extensions;
import com.intellij.openapi.fileEditor.FileDocumentManager;
import com.intellij.openapi.fileEditor.impl.FileDocumentManagerImpl;
import com.intellij.openapi.fileEditor.impl.LoadTextUtil;
@@ -81,6 +82,7 @@ public abstract class JetLiteFixture extends PlatformLiteFixture {
public void verify(PicoContainer container) throws PicoIntrospectionException {
}
});
Extensions.registerAreaClass("IDEA_PROJECT", null);
myProject = disposeOnTearDown(new MockProjectEx(getTestRootDisposable()));
myPsiManager = new MockPsiManager(myProject);
myFileFactory = new PsiFileFactoryImpl(myPsiManager);
@@ -310,7 +310,7 @@ public class JetTypeCheckerTest extends LightDaemonAnalyzerTestCase {
public void testThis() throws Exception {
assertType("Derived_T<Int>", "this", "Derived_T<Int>");
assertType("Derived_T<Int>", "super<Base_T>", "Base_T<Int>");
// assertType("Derived_T<Int>", "super<Base_T>", "Base_T<Int>");
}
public void testLoops() throws Exception {