Added navigation to source of constructor.

#KT-3168 fixed
This commit is contained in:
Evgeny Gerashchenko
2012-12-18 17:12:31 +04:00
parent 32699133cd
commit 5bdd68e502
4 changed files with 19 additions and 2 deletions
@@ -57,6 +57,13 @@ public class JetClsNavigationPolicy implements ClsCustomNavigationPolicy {
return sourceFunction;
}
}
else if (jetDeclaration instanceof JetClass) {
assert clsMethod.getReturnType() == null; // constructor
JetClassOrObject sourceClass = JetSourceNavigationHelper.getSourceClass((JetClass) jetDeclaration);
if (sourceClass != null) {
return sourceClass;
}
}
return jetDeclaration;
}
@@ -0,0 +1,6 @@
import testData.libraries.*
val x: ClassWithConstructor = ClassWithConstructor("abc", 239)
// main.kt
//public class <1><2>ClassWithConstructor(val a: String, b: Any)
@@ -17,6 +17,6 @@ fun foo() {
// return this
//}
//
//public class Pair<A, B>(val first: A, val second: B)
//public class <2>Pair<A, B>(val first: A, val second: B)
//
//public val <T> Pair<T, T>.<2>exProp : String
//public val <T> Pair<T, T>.<3>exProp : String
@@ -75,6 +75,10 @@ public class LibrariesWithSourcesTest extends AbstractLibrariesTest {
doTest();
}
public void testConstructor() {
doTest();
}
private void doTest() {
userFile = LocalFileSystem.getInstance().findFileByPath(TEST_DATA_PATH + "/usercode/" + getTestName(false) + ".kt");
assertNotNull(userFile);