Imports resolution tests
This commit is contained in:
@@ -128,6 +128,10 @@ public class ResolveSession {
|
||||
return specialClasses.apply(fqName);
|
||||
}
|
||||
|
||||
public ModuleDescriptor getRootModuleDescriptor() {
|
||||
return module;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
/*package*/ StorageManager getStorageManager() {
|
||||
return storageManager;
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
//FILE:mainToSecond.kt
|
||||
//----------------------------------------------------------------------------------
|
||||
package test
|
||||
|
||||
import testing.first.*
|
||||
import testing.second.*
|
||||
|
||||
val a1: `second`TestClass? = null
|
||||
|
||||
//FILE:mainToFirst.kt
|
||||
//----------------------------------------------------------------------------------
|
||||
package test
|
||||
|
||||
import testing.second.*
|
||||
import testing.first.*
|
||||
|
||||
val a2: `first`TestClass? = null
|
||||
|
||||
//FILE:importFirst.kt
|
||||
//----------------------------------------------------------------------------------
|
||||
package testing.first
|
||||
|
||||
class ~first~TestClass
|
||||
|
||||
//FILE:importSecond.kt
|
||||
//----------------------------------------------------------------------------------
|
||||
package testing.second
|
||||
|
||||
class ~second~TestClass
|
||||
@@ -0,0 +1,17 @@
|
||||
//FILE:mainFile.jet
|
||||
//----------------------------------------------------------------------------------
|
||||
package test
|
||||
|
||||
import testing.*
|
||||
|
||||
val a1: `fromRoot`TestClass? = null
|
||||
|
||||
//FILE:fromRoot.kt
|
||||
//----------------------------------------------------------------------------------
|
||||
trait ~fromRoot~TestClass
|
||||
|
||||
//FILE:fromOtherPackage.kt
|
||||
//----------------------------------------------------------------------------------
|
||||
package testing
|
||||
|
||||
trait ~fromOtherPackage~TestClass
|
||||
@@ -0,0 +1,20 @@
|
||||
//FILE:mainFile.jet
|
||||
//----------------------------------------------------------------------------------
|
||||
package test
|
||||
|
||||
import otherPackage.*
|
||||
|
||||
val a1: `fromSamePackage`TestClass? = null
|
||||
|
||||
//FILE:fromOtherPackage.kt
|
||||
//----------------------------------------------------------------------------------
|
||||
package otherPackage
|
||||
|
||||
trait ~fromOtherPackage~TestClass
|
||||
|
||||
|
||||
//FILE:fromSamePackage.kt
|
||||
//----------------------------------------------------------------------------------
|
||||
package test
|
||||
|
||||
class ~fromSamePackage~TestClass
|
||||
@@ -0,0 +1,29 @@
|
||||
//FILE:withAllUnderImportsSecond.kt
|
||||
//----------------------------------------------------------------------------------
|
||||
package test
|
||||
|
||||
import testing.first.*
|
||||
import testing.second.*
|
||||
|
||||
val a1 = ~second~testFun()
|
||||
|
||||
//FILE:withAllUnderImportsFirst.kt
|
||||
//----------------------------------------------------------------------------------
|
||||
package test
|
||||
|
||||
import testing.second.*
|
||||
import testing.first.*
|
||||
|
||||
val a1 = ~first~testFun()
|
||||
|
||||
//FILE:importFirst.kt
|
||||
//----------------------------------------------------------------------------------
|
||||
package testing.first
|
||||
|
||||
fun ~first~testFun(): Int = 12
|
||||
|
||||
//FILE:importSecond.kt
|
||||
//----------------------------------------------------------------------------------
|
||||
package testing.second
|
||||
|
||||
fun ~second~testFun(): Int = 12
|
||||
@@ -0,0 +1,34 @@
|
||||
//FILE:mainToSecond.kt
|
||||
//----------------------------------------------------------------------------------
|
||||
package test
|
||||
|
||||
import testing.first.*
|
||||
import testing.second.TestClass
|
||||
|
||||
val a1: `second`TestClass? = null
|
||||
|
||||
|
||||
//FILE:mainToFirst.kt
|
||||
//----------------------------------------------------------------------------------
|
||||
package test
|
||||
|
||||
import testing.second.TestClass
|
||||
import testing.first.*
|
||||
|
||||
// Single import has priority over package import
|
||||
val a2: `first`TestClass? = null
|
||||
|
||||
|
||||
//FILE:importFirst.kt
|
||||
//----------------------------------------------------------------------------------
|
||||
package testing.first
|
||||
|
||||
class ~first~TestClass
|
||||
|
||||
|
||||
//FILE:importSecond.kt
|
||||
//----------------------------------------------------------------------------------
|
||||
package testing.second
|
||||
class testing.second
|
||||
|
||||
class ~second~TestClass
|
||||
@@ -0,0 +1,31 @@
|
||||
//FILE:mainToSecond.kt
|
||||
//----------------------------------------------------------------------------------
|
||||
package test
|
||||
|
||||
import testing.first.TestClass
|
||||
import testing.second.TestClass
|
||||
|
||||
val a1: `second`TestClass? = null
|
||||
|
||||
//FILE:mainToFirst.kt
|
||||
//----------------------------------------------------------------------------------
|
||||
package test
|
||||
|
||||
import testing.second.TestClass
|
||||
import testing.first.TestClass
|
||||
|
||||
val a2: `first`TestClass? = null
|
||||
|
||||
//FILE:importFirst.kt
|
||||
//----------------------------------------------------------------------------------
|
||||
package testing.first
|
||||
|
||||
class ~first~TestClass
|
||||
|
||||
|
||||
//FILE:importSecond.kt
|
||||
//----------------------------------------------------------------------------------
|
||||
package testing.second
|
||||
class testing.second
|
||||
|
||||
class ~second~TestClass
|
||||
@@ -0,0 +1,21 @@
|
||||
//FILE:classObject.kt
|
||||
//----------------------------------------------------------------------------------
|
||||
package test
|
||||
|
||||
import testing.TestClass
|
||||
|
||||
class WithClassObject {
|
||||
class object {
|
||||
class ~class-object~TestClass
|
||||
}
|
||||
|
||||
// TODO: Isn't it a bug?
|
||||
val a2: `testing`TestClass? = null
|
||||
}
|
||||
|
||||
|
||||
//FILE:testing.kt
|
||||
//----------------------------------------------------------------------------------
|
||||
package testing
|
||||
|
||||
class ~testing~TestClass
|
||||
@@ -0,0 +1,16 @@
|
||||
//FILE:sameFile.kt
|
||||
//----------------------------------------------------------------------------------
|
||||
package test
|
||||
|
||||
import testing.TestClass
|
||||
|
||||
class ~same-file~TestClass
|
||||
|
||||
val a1: `same-file`TestClass? = null
|
||||
|
||||
|
||||
//FILE:testing.kt
|
||||
//----------------------------------------------------------------------------------
|
||||
package testing
|
||||
|
||||
class ~testing~TestClass
|
||||
@@ -0,0 +1,18 @@
|
||||
//FILE:insideClass.kt
|
||||
//----------------------------------------------------------------------------------
|
||||
package test
|
||||
|
||||
import testing.TestClass
|
||||
|
||||
class WithInnerClass {
|
||||
inner class ~inner-class~TestClass
|
||||
|
||||
val a3: `inner-class`TestClass? = null
|
||||
}
|
||||
|
||||
|
||||
//FILE:testing.kt
|
||||
//----------------------------------------------------------------------------------
|
||||
package testing
|
||||
|
||||
class ~testing~TestClass
|
||||
@@ -0,0 +1,54 @@
|
||||
//FILE:allPackageImport.kt
|
||||
//----------------------------------------------------------------------------------
|
||||
package test
|
||||
|
||||
import testing.custom.*
|
||||
|
||||
// Non default import has priority over default one. No conflicts are expected.
|
||||
val a1: `custom`List<Int>? = null
|
||||
|
||||
//FILE:javaUtilImport.kt
|
||||
//----------------------------------------------------------------------------------
|
||||
package test
|
||||
|
||||
import java.util.*
|
||||
|
||||
// Mapped declarations are dropped from on-demand imports.
|
||||
// TODO: Fix for lazy resolve test
|
||||
// val a2: 'kotlin::List'List<Int>? = null
|
||||
|
||||
//FILE:allPackageWithJavaUtilImport.kt
|
||||
//----------------------------------------------------------------------------------
|
||||
package test
|
||||
|
||||
import testing.custom.*
|
||||
import java.util.*
|
||||
|
||||
// Mapped declarations are dropped from on-demand "java.util" import. So no conflicts are expected.
|
||||
val a3: `custom`List<Int>? = null
|
||||
|
||||
//FILE:singleClassImportFromJavaUtil.kt
|
||||
//----------------------------------------------------------------------------------
|
||||
package test
|
||||
|
||||
import java.util.List
|
||||
|
||||
// Single import doesn't processed with Java->Kotlin class mapper. This is the way how
|
||||
// java classes can be imported.
|
||||
val a4: `java::java.util.List`List<Int>? = null
|
||||
|
||||
//FILE:singleClassImport.kt
|
||||
//----------------------------------------------------------------------------------
|
||||
package test
|
||||
|
||||
import testing.custom.List
|
||||
|
||||
// Single import doesn't processed with Java->Kotlin class mapper
|
||||
val a5: `custom`List<Int>? = null
|
||||
|
||||
|
||||
//FILE:importFirst.kt
|
||||
//----------------------------------------------------------------------------------
|
||||
package testing.custom
|
||||
|
||||
class ~custom~List<T>
|
||||
@@ -0,0 +1,18 @@
|
||||
//FILE:firstOrder.kt
|
||||
//----------------------------------------------------------------------------------
|
||||
package test
|
||||
|
||||
import testing.InTesting2
|
||||
import testing.InTesting1
|
||||
|
||||
trait ~InTest1~InTest1 : `InTesting1`InTesting1
|
||||
trait ~InTest2~InTest2 : `InTesting2`InTesting2
|
||||
|
||||
//FILE:testing.kt
|
||||
//----------------------------------------------------------------------------------
|
||||
package testing
|
||||
|
||||
import test.InTest2
|
||||
|
||||
trait ~InTesting1~InTesting1 : `InTest2`InTest2
|
||||
trait ~InTesting2~InTesting2
|
||||
@@ -0,0 +1,45 @@
|
||||
//FILE:firstOrder.kt
|
||||
//----------------------------------------------------------------------------------
|
||||
package test
|
||||
|
||||
import testing.other.*
|
||||
import testing.exact.Second
|
||||
import testing.allUnder.*
|
||||
|
||||
// The goal is to activate lazy resolve in order Second, Other
|
||||
class FirstOrder: `other`Other, FirstInternal
|
||||
trait FirstInternal: `allUnder`Second
|
||||
|
||||
|
||||
|
||||
//FILE:secondOrder.kt
|
||||
//----------------------------------------------------------------------------------
|
||||
package test
|
||||
|
||||
import testing.other.*
|
||||
import testing.exact.Second
|
||||
import testing.allUnder.*
|
||||
|
||||
// The goal is to activate lazy resolve in order Other, Second
|
||||
class FirstOrder: FirstInternal, `other`Other
|
||||
trait FirstInternal: `allUnder`Second
|
||||
|
||||
|
||||
|
||||
//FILE:secondForAllUnderImport.kt
|
||||
//----------------------------------------------------------------------------------
|
||||
package testing.allUnder
|
||||
|
||||
trait ~allUnder~Second
|
||||
|
||||
//FILE:secondForExactImport.kt
|
||||
//----------------------------------------------------------------------------------
|
||||
package testing.exact
|
||||
|
||||
trait ~exact~Second
|
||||
|
||||
//FILE:someOther.kt
|
||||
//----------------------------------------------------------------------------------
|
||||
package testing.other
|
||||
|
||||
trait ~other~Other
|
||||
@@ -0,0 +1,84 @@
|
||||
/*
|
||||
* Copyright 2010-2013 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.jetbrains.jet.lang.resolve.lazy;
|
||||
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.util.io.FileUtil;
|
||||
import junit.framework.Assert;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.jet.ConfigurationKind;
|
||||
import org.jetbrains.jet.JetLiteFixture;
|
||||
import org.jetbrains.jet.JetTestUtils;
|
||||
import org.jetbrains.jet.cli.jvm.compiler.JetCoreEnvironment;
|
||||
import org.jetbrains.jet.lang.descriptors.NamespaceDescriptor;
|
||||
import org.jetbrains.jet.lang.psi.JetFile;
|
||||
import org.jetbrains.jet.lang.resolve.name.Name;
|
||||
import org.jetbrains.jet.resolve.ExpectedResolveData;
|
||||
import org.jetbrains.jet.resolve.JetExpectedResolveDataUtil;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.List;
|
||||
|
||||
public abstract class AbstractLazyResolveTest extends JetLiteFixture {
|
||||
private ExpectedResolveData expectedResolveData;
|
||||
|
||||
@Override
|
||||
protected JetCoreEnvironment createEnvironment() {
|
||||
return createEnvironmentWithMockJdk(ConfigurationKind.JDK_AND_ANNOTATIONS);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setUp() throws Exception {
|
||||
super.setUp();
|
||||
expectedResolveData = getExpectedResolveData();
|
||||
}
|
||||
|
||||
protected ExpectedResolveData getExpectedResolveData() {
|
||||
Project project = getProject();
|
||||
|
||||
return new ExpectedResolveData(
|
||||
JetExpectedResolveDataUtil.prepareDefaultNameToDescriptors(project),
|
||||
JetExpectedResolveDataUtil.prepareDefaultNameToDeclaration(project),
|
||||
getEnvironment()) {
|
||||
@Override
|
||||
protected JetFile createJetFile(String fileName, String text) {
|
||||
return createCheckAndReturnPsiFile(fileName, null, text);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
protected void doTest(@NonNls String testFile) throws Exception {
|
||||
String text = FileUtil.loadFile(new File(testFile), true);
|
||||
|
||||
List<JetFile> files = JetTestUtils.createTestFiles("file.kt", text, new JetTestUtils.TestFileFactory<JetFile>() {
|
||||
@Override
|
||||
public JetFile create(String fileName, String text) {
|
||||
return expectedResolveData.createFileFromMarkedUpText(fileName, text);
|
||||
}
|
||||
});
|
||||
|
||||
ResolveSession resolveSession = LazyResolveTestUtil.resolveLazilyWithSession(files, getEnvironment());
|
||||
|
||||
NamespaceDescriptor actual = resolveSession.getPackageDescriptor(Name.identifier("test"));
|
||||
Assert.assertNotNull("Package 'test' was not found", actual);
|
||||
|
||||
resolveSession.forceResolveAll();
|
||||
|
||||
expectedResolveData.checkResult(resolveSession.getBindingContext());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,98 @@
|
||||
/*
|
||||
* Copyright 2010-2013 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.jetbrains.jet.lang.resolve.lazy;
|
||||
|
||||
import junit.framework.Assert;
|
||||
import junit.framework.Test;
|
||||
import junit.framework.TestSuite;
|
||||
|
||||
import java.io.File;
|
||||
import org.jetbrains.jet.JetTestUtils;
|
||||
import org.jetbrains.jet.test.InnerTestClasses;
|
||||
import org.jetbrains.jet.test.TestMetadata;
|
||||
|
||||
import org.jetbrains.jet.lang.resolve.lazy.AbstractLazyResolveTest;
|
||||
|
||||
/** This class is generated by {@link org.jetbrains.jet.generators.tests.GenerateTests}. DO NOT MODIFY MANUALLY */
|
||||
@SuppressWarnings("all")
|
||||
@TestMetadata("compiler/testData/resolve/imports")
|
||||
public class LazyResolveFullTestGenerated extends AbstractLazyResolveTest {
|
||||
public void testAllFilesPresentInImports() throws Exception {
|
||||
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.GenerateTests", new File("compiler/testData/resolve/imports"), "resolve", false);
|
||||
}
|
||||
|
||||
@TestMetadata("ImportConflictAllPackage.resolve")
|
||||
public void testImportConflictAllPackage() throws Exception {
|
||||
doTest("compiler/testData/resolve/imports/ImportConflictAllPackage.resolve");
|
||||
}
|
||||
|
||||
@TestMetadata("ImportConflictBetweenImportedAndRootPackage.resolve")
|
||||
public void testImportConflictBetweenImportedAndRootPackage() throws Exception {
|
||||
doTest("compiler/testData/resolve/imports/ImportConflictBetweenImportedAndRootPackage.resolve");
|
||||
}
|
||||
|
||||
@TestMetadata("ImportConflictBetweenImportedAndSamePackage.resolve")
|
||||
public void testImportConflictBetweenImportedAndSamePackage() throws Exception {
|
||||
doTest("compiler/testData/resolve/imports/ImportConflictBetweenImportedAndSamePackage.resolve");
|
||||
}
|
||||
|
||||
@TestMetadata("ImportConflictForFunctions.resolve")
|
||||
public void testImportConflictForFunctions() throws Exception {
|
||||
doTest("compiler/testData/resolve/imports/ImportConflictForFunctions.resolve");
|
||||
}
|
||||
|
||||
@TestMetadata("ImportConflictPackageAndClass.resolve")
|
||||
public void testImportConflictPackageAndClass() throws Exception {
|
||||
doTest("compiler/testData/resolve/imports/ImportConflictPackageAndClass.resolve");
|
||||
}
|
||||
|
||||
@TestMetadata("ImportConflictSameNameClass.resolve")
|
||||
public void testImportConflictSameNameClass() throws Exception {
|
||||
doTest("compiler/testData/resolve/imports/ImportConflictSameNameClass.resolve");
|
||||
}
|
||||
|
||||
@TestMetadata("ImportConflictWithClassObject.resolve")
|
||||
public void testImportConflictWithClassObject() throws Exception {
|
||||
doTest("compiler/testData/resolve/imports/ImportConflictWithClassObject.resolve");
|
||||
}
|
||||
|
||||
@TestMetadata("ImportConflictWithInFileClass.resolve")
|
||||
public void testImportConflictWithInFileClass() throws Exception {
|
||||
doTest("compiler/testData/resolve/imports/ImportConflictWithInFileClass.resolve");
|
||||
}
|
||||
|
||||
@TestMetadata("ImportConflictWithInnerClass.resolve")
|
||||
public void testImportConflictWithInnerClass() throws Exception {
|
||||
doTest("compiler/testData/resolve/imports/ImportConflictWithInnerClass.resolve");
|
||||
}
|
||||
|
||||
@TestMetadata("ImportConflictsWithMappedToJava.resolve")
|
||||
public void testImportConflictsWithMappedToJava() throws Exception {
|
||||
doTest("compiler/testData/resolve/imports/ImportConflictsWithMappedToJava.resolve");
|
||||
}
|
||||
|
||||
@TestMetadata("ImportNonBlockingAnalysis.resolve")
|
||||
public void testImportNonBlockingAnalysis() throws Exception {
|
||||
doTest("compiler/testData/resolve/imports/ImportNonBlockingAnalysis.resolve");
|
||||
}
|
||||
|
||||
@TestMetadata("ImportResolveOrderStable.resolve")
|
||||
public void testImportResolveOrderStable() throws Exception {
|
||||
doTest("compiler/testData/resolve/imports/ImportResolveOrderStable.resolve");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,98 @@
|
||||
/*
|
||||
* Copyright 2010-2013 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.jetbrains.jet.lang.resolve.lazy;
|
||||
|
||||
import junit.framework.Assert;
|
||||
import junit.framework.Test;
|
||||
import junit.framework.TestSuite;
|
||||
|
||||
import java.io.File;
|
||||
import org.jetbrains.jet.JetTestUtils;
|
||||
import org.jetbrains.jet.test.InnerTestClasses;
|
||||
import org.jetbrains.jet.test.TestMetadata;
|
||||
|
||||
import org.jetbrains.jet.lang.resolve.lazy.AbstractLazyResolveTest;
|
||||
|
||||
/** This class is generated by {@link org.jetbrains.jet.generators.tests.GenerateTests}. DO NOT MODIFY MANUALLY */
|
||||
@SuppressWarnings("all")
|
||||
@TestMetadata("compiler/testData/resolve/imports")
|
||||
public class LazyResolveTestGenerated extends AbstractLazyResolveTest {
|
||||
public void testAllFilesPresentInImports() throws Exception {
|
||||
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.GenerateTests", new File("compiler/testData/resolve/imports"), "resolve", false);
|
||||
}
|
||||
|
||||
@TestMetadata("ImportConflictAllPackage.resolve")
|
||||
public void testImportConflictAllPackage() throws Exception {
|
||||
doTest("compiler/testData/resolve/imports/ImportConflictAllPackage.resolve");
|
||||
}
|
||||
|
||||
@TestMetadata("ImportConflictBetweenImportedAndRootPackage.resolve")
|
||||
public void testImportConflictBetweenImportedAndRootPackage() throws Exception {
|
||||
doTest("compiler/testData/resolve/imports/ImportConflictBetweenImportedAndRootPackage.resolve");
|
||||
}
|
||||
|
||||
@TestMetadata("ImportConflictBetweenImportedAndSamePackage.resolve")
|
||||
public void testImportConflictBetweenImportedAndSamePackage() throws Exception {
|
||||
doTest("compiler/testData/resolve/imports/ImportConflictBetweenImportedAndSamePackage.resolve");
|
||||
}
|
||||
|
||||
@TestMetadata("ImportConflictForFunctions.resolve")
|
||||
public void testImportConflictForFunctions() throws Exception {
|
||||
doTest("compiler/testData/resolve/imports/ImportConflictForFunctions.resolve");
|
||||
}
|
||||
|
||||
@TestMetadata("ImportConflictPackageAndClass.resolve")
|
||||
public void testImportConflictPackageAndClass() throws Exception {
|
||||
doTest("compiler/testData/resolve/imports/ImportConflictPackageAndClass.resolve");
|
||||
}
|
||||
|
||||
@TestMetadata("ImportConflictSameNameClass.resolve")
|
||||
public void testImportConflictSameNameClass() throws Exception {
|
||||
doTest("compiler/testData/resolve/imports/ImportConflictSameNameClass.resolve");
|
||||
}
|
||||
|
||||
@TestMetadata("ImportConflictWithClassObject.resolve")
|
||||
public void testImportConflictWithClassObject() throws Exception {
|
||||
doTest("compiler/testData/resolve/imports/ImportConflictWithClassObject.resolve");
|
||||
}
|
||||
|
||||
@TestMetadata("ImportConflictWithInFileClass.resolve")
|
||||
public void testImportConflictWithInFileClass() throws Exception {
|
||||
doTest("compiler/testData/resolve/imports/ImportConflictWithInFileClass.resolve");
|
||||
}
|
||||
|
||||
@TestMetadata("ImportConflictWithInnerClass.resolve")
|
||||
public void testImportConflictWithInnerClass() throws Exception {
|
||||
doTest("compiler/testData/resolve/imports/ImportConflictWithInnerClass.resolve");
|
||||
}
|
||||
|
||||
@TestMetadata("ImportConflictsWithMappedToJava.resolve")
|
||||
public void testImportConflictsWithMappedToJava() throws Exception {
|
||||
doTest("compiler/testData/resolve/imports/ImportConflictsWithMappedToJava.resolve");
|
||||
}
|
||||
|
||||
@TestMetadata("ImportNonBlockingAnalysis.resolve")
|
||||
public void testImportNonBlockingAnalysis() throws Exception {
|
||||
doTest("compiler/testData/resolve/imports/ImportNonBlockingAnalysis.resolve");
|
||||
}
|
||||
|
||||
@TestMetadata("ImportResolveOrderStable.resolve")
|
||||
public void testImportResolveOrderStable() throws Exception {
|
||||
doTest("compiler/testData/resolve/imports/ImportResolveOrderStable.resolve");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -82,7 +82,7 @@ public class LazyResolveTestUtil {
|
||||
return module;
|
||||
}
|
||||
|
||||
public static ModuleDescriptor resolveLazily(List<JetFile> files, JetCoreEnvironment environment) {
|
||||
public static ResolveSession resolveLazilyWithSession(List<JetFile> files, JetCoreEnvironment environment) {
|
||||
JetTestUtils.newTrace(environment);
|
||||
|
||||
ModuleDescriptor javaModule = new ModuleDescriptor(Name.special("<java module>"));
|
||||
@@ -136,9 +136,11 @@ public class LazyResolveTestUtil {
|
||||
};
|
||||
|
||||
ModuleDescriptor lazyModule = new ModuleDescriptor(Name.special("<lazy module>"));
|
||||
ResolveSession
|
||||
session = new ResolveSession(project, storageManager, lazyModule, moduleConfiguration, declarationProviderFactory);
|
||||
return lazyModule;
|
||||
return new ResolveSession(project, storageManager, lazyModule, moduleConfiguration, declarationProviderFactory, sharedTrace);
|
||||
}
|
||||
|
||||
public static ModuleDescriptor resolveLazily(List<JetFile> files, JetCoreEnvironment environment) {
|
||||
return resolveLazilyWithSession(files, environment).getRootModuleDescriptor();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
|
||||
@@ -143,18 +143,22 @@ public abstract class ExpectedResolveData {
|
||||
|
||||
protected abstract JetFile createJetFile(String fileName, String text);
|
||||
|
||||
public final void checkResult(List<JetFile> files) {
|
||||
protected BindingContext analyze(List<JetFile> files) {
|
||||
if (files.isEmpty()) {
|
||||
System.err.println("Suspicious: no files");
|
||||
return;
|
||||
return BindingContext.EMPTY;
|
||||
}
|
||||
final Set<PsiElement> unresolvedReferences = Sets.newHashSet();
|
||||
|
||||
Project project = files.iterator().next().getProject();
|
||||
AnalyzeExhaust analyzeExhaust = AnalyzerFacadeForJVM.analyzeFilesWithJavaIntegration(
|
||||
project, files, Collections.<AnalyzerScriptParameter>emptyList(), Predicates.<PsiFile>alwaysTrue());
|
||||
return analyzeExhaust.getBindingContext();
|
||||
}
|
||||
|
||||
public final void checkResult(BindingContext bindingContext) {
|
||||
KotlinBuiltIns builtIns = KotlinBuiltIns.getInstance();
|
||||
|
||||
AnalyzeExhaust analyzeExhaust = AnalyzerFacadeForJVM.analyzeFilesWithJavaIntegration(project, files,
|
||||
Collections.<AnalyzerScriptParameter>emptyList(), Predicates.<PsiFile>alwaysTrue());
|
||||
BindingContext bindingContext = analyzeExhaust.getBindingContext();
|
||||
final Set<PsiElement> unresolvedReferences = Sets.newHashSet();
|
||||
for (Diagnostic diagnostic : bindingContext.getDiagnostics()) {
|
||||
if (diagnostic.getFactory() instanceof UnresolvedReferenceDiagnosticFactory) {
|
||||
unresolvedReferences.add(diagnostic.getPsiElement());
|
||||
|
||||
@@ -55,6 +55,6 @@ public abstract class ExtensibleResolveTestCase extends JetLiteFixture {
|
||||
return expectedResolveData.createFileFromMarkedUpText(fileName, text);
|
||||
}
|
||||
});
|
||||
expectedResolveData.checkResult(files);
|
||||
expectedResolveData.checkResult(expectedResolveData.analyze(files));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,152 @@
|
||||
/*
|
||||
* Copyright 2010-2013 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.jetbrains.jet.resolve;
|
||||
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.psi.*;
|
||||
import junit.framework.Assert;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.jet.di.InjectorForJavaSemanticServices;
|
||||
import org.jetbrains.jet.di.InjectorForTests;
|
||||
import org.jetbrains.jet.lang.descriptors.ClassDescriptor;
|
||||
import org.jetbrains.jet.lang.descriptors.DeclarationDescriptor;
|
||||
import org.jetbrains.jet.lang.descriptors.FunctionDescriptor;
|
||||
import org.jetbrains.jet.lang.descriptors.ValueParameterDescriptor;
|
||||
import org.jetbrains.jet.lang.resolve.BindingTraceContext;
|
||||
import org.jetbrains.jet.lang.resolve.calls.autocasts.DataFlowInfo;
|
||||
import org.jetbrains.jet.lang.resolve.calls.model.ResolvedCall;
|
||||
import org.jetbrains.jet.lang.resolve.calls.results.OverloadResolutionResults;
|
||||
import org.jetbrains.jet.lang.resolve.java.PsiClassFinder;
|
||||
import org.jetbrains.jet.lang.resolve.name.FqName;
|
||||
import org.jetbrains.jet.lang.resolve.name.Name;
|
||||
import org.jetbrains.jet.lang.resolve.scopes.receivers.ReceiverValue;
|
||||
import org.jetbrains.jet.lang.types.JetType;
|
||||
import org.jetbrains.jet.lang.types.TypeUtils;
|
||||
import org.jetbrains.jet.lang.types.expressions.ExpressionTypingContext;
|
||||
import org.jetbrains.jet.lang.types.expressions.ExpressionTypingServices;
|
||||
import org.jetbrains.jet.lang.types.lang.KotlinBuiltIns;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import static org.jetbrains.jet.lang.types.expressions.ExpressionTypingUtils.resolveFakeCall;
|
||||
|
||||
public class JetExpectedResolveDataUtil {
|
||||
private JetExpectedResolveDataUtil() {
|
||||
}
|
||||
|
||||
public static Map<String, DeclarationDescriptor> prepareDefaultNameToDescriptors(Project project) {
|
||||
KotlinBuiltIns builtIns = KotlinBuiltIns.getInstance();
|
||||
|
||||
Map<String, DeclarationDescriptor> nameToDescriptor = new HashMap<String, DeclarationDescriptor>();
|
||||
nameToDescriptor.put("kotlin::Int.plus(Int)", standardFunction(builtIns.getInt(), "plus", project, builtIns.getIntType()));
|
||||
FunctionDescriptor descriptorForGet = standardFunction(builtIns.getArray(), "get", project, builtIns.getIntType());
|
||||
nameToDescriptor.put("kotlin::Array.get(Int)", descriptorForGet.getOriginal());
|
||||
nameToDescriptor.put("kotlin::Int.compareTo(Double)", standardFunction(builtIns.getInt(), "compareTo", project, builtIns.getDoubleType()));
|
||||
@NotNull
|
||||
FunctionDescriptor descriptorForSet = standardFunction(builtIns.getArray(), "set", project, builtIns.getIntType(), builtIns.getIntType());
|
||||
nameToDescriptor.put("kotlin::Array.set(Int, Int)", descriptorForSet.getOriginal());
|
||||
|
||||
return nameToDescriptor;
|
||||
}
|
||||
|
||||
public static Map<String, PsiElement> prepareDefaultNameToDeclaration(Project project) {
|
||||
Map<String, PsiElement> nameToDeclaration = new HashMap<String, PsiElement>();
|
||||
|
||||
PsiClass java_util_Collections = findClass("java.util.Collections", project);
|
||||
nameToDeclaration.put("java::java.util.Collections.emptyList()", findMethod(java_util_Collections, "emptyList"));
|
||||
nameToDeclaration.put("java::java.util.Collections", java_util_Collections);
|
||||
PsiClass java_util_List = findClass("java.util.ArrayList", project);
|
||||
nameToDeclaration.put("java::java.util.List", findClass("java.util.List", project));
|
||||
nameToDeclaration.put("java::java.util.ArrayList", java_util_List);
|
||||
nameToDeclaration.put("java::java.util.ArrayList.set()", java_util_List.findMethodsByName("set", true)[0]);
|
||||
nameToDeclaration.put("java::java.util.ArrayList.get()", java_util_List.findMethodsByName("get", true)[0]);
|
||||
nameToDeclaration.put("java::java", findPackage("java", project));
|
||||
nameToDeclaration.put("java::java.util", findPackage("java.util", project));
|
||||
nameToDeclaration.put("java::java.lang", findPackage("java.lang", project));
|
||||
nameToDeclaration.put("java::java.lang.Object", findClass("java.lang.Object", project));
|
||||
nameToDeclaration.put("java::java.lang.Comparable", findClass("java.lang.Comparable", project));
|
||||
PsiClass java_lang_System = findClass("java.lang.System", project);
|
||||
nameToDeclaration.put("java::java.lang.System", java_lang_System);
|
||||
PsiMethod[] methods = findClass("java.io.PrintStream", project).findMethodsByName("print", true);
|
||||
nameToDeclaration.put("java::java.io.PrintStream.print(Object)", methods[8]);
|
||||
nameToDeclaration.put("java::java.io.PrintStream.print(Int)", methods[2]);
|
||||
nameToDeclaration.put("java::java.io.PrintStream.print(char[])", methods[6]);
|
||||
nameToDeclaration.put("java::java.io.PrintStream.print(Double)", methods[5]);
|
||||
PsiField outField = java_lang_System.findFieldByName("out", true);
|
||||
Assert.assertNotNull("'out' property wasn't found", outField);
|
||||
nameToDeclaration.put("java::java.lang.System.out", outField);
|
||||
PsiClass java_lang_Number = findClass("java.lang.Number", project);
|
||||
nameToDeclaration.put("java::java.lang.Number", java_lang_Number);
|
||||
nameToDeclaration.put("java::java.lang.Number.intValue()", java_lang_Number.findMethodsByName("intValue", true)[0]);
|
||||
|
||||
return nameToDeclaration;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private static PsiElement findPackage(String qualifiedName, Project project) {
|
||||
JavaPsiFacade javaFacade = JavaPsiFacade.getInstance(project);
|
||||
PsiPackage javaFacadePackage = javaFacade.findPackage(qualifiedName);
|
||||
Assert.assertNotNull("Package wasn't found: " + qualifiedName, javaFacadePackage);
|
||||
return javaFacadePackage;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private static PsiMethod findMethod(PsiClass psiClass, String name) {
|
||||
PsiMethod[] emptyLists = psiClass.findMethodsByName(name, true);
|
||||
return emptyLists[0];
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private static PsiClass findClass(String qualifiedName, Project project) {
|
||||
InjectorForJavaSemanticServices injector = new InjectorForJavaSemanticServices(project);
|
||||
PsiClass psiClass = injector.getPsiClassFinder().findPsiClass(new FqName(qualifiedName), PsiClassFinder.RuntimeClassesHandleMode.THROW);
|
||||
Assert.assertNotNull("Class wasn't found: " + qualifiedName, psiClass);
|
||||
return psiClass;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private static FunctionDescriptor standardFunction(
|
||||
ClassDescriptor classDescriptor,
|
||||
String name,
|
||||
Project project,
|
||||
JetType... parameterTypes
|
||||
) {
|
||||
ExpressionTypingServices expressionTypingServices = new InjectorForTests(project).getExpressionTypingServices();
|
||||
|
||||
ExpressionTypingContext context = ExpressionTypingContext.newContext(
|
||||
expressionTypingServices, new BindingTraceContext(), classDescriptor.getDefaultType().getMemberScope(),
|
||||
DataFlowInfo.EMPTY, TypeUtils.NO_EXPECTED_TYPE, false);
|
||||
|
||||
OverloadResolutionResults<FunctionDescriptor> functions = resolveFakeCall(
|
||||
context, ReceiverValue.NO_RECEIVER, Name.identifier(name), parameterTypes);
|
||||
|
||||
for (ResolvedCall<? extends FunctionDescriptor> resolvedCall : functions.getResultingCalls()) {
|
||||
List<ValueParameterDescriptor> unsubstitutedValueParameters = resolvedCall.getResultingDescriptor().getValueParameters();
|
||||
for (int i = 0, unsubstitutedValueParametersSize = unsubstitutedValueParameters.size(); i < unsubstitutedValueParametersSize; i++) {
|
||||
ValueParameterDescriptor unsubstitutedValueParameter = unsubstitutedValueParameters.get(i);
|
||||
if (unsubstitutedValueParameter.getType().equals(parameterTypes[i])) {
|
||||
return resolvedCall.getResultingDescriptor();
|
||||
}
|
||||
}
|
||||
}
|
||||
throw new IllegalArgumentException("Not found: kotlin::" + classDescriptor.getName() + "." + name + "(" +
|
||||
Arrays.toString(parameterTypes) + ")");
|
||||
}
|
||||
}
|
||||
@@ -18,42 +18,13 @@ package org.jetbrains.jet.resolve;
|
||||
|
||||
import com.intellij.openapi.application.PathManager;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.psi.JavaPsiFacade;
|
||||
import com.intellij.psi.PsiClass;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.intellij.psi.PsiMethod;
|
||||
import junit.framework.Test;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.jet.JetTestCaseBuilder;
|
||||
import org.jetbrains.jet.di.InjectorForJavaSemanticServices;
|
||||
import org.jetbrains.jet.di.InjectorForTests;
|
||||
import org.jetbrains.jet.lang.descriptors.ClassDescriptor;
|
||||
import org.jetbrains.jet.lang.descriptors.DeclarationDescriptor;
|
||||
import org.jetbrains.jet.lang.descriptors.FunctionDescriptor;
|
||||
import org.jetbrains.jet.lang.descriptors.ValueParameterDescriptor;
|
||||
import org.jetbrains.jet.lang.psi.JetFile;
|
||||
import org.jetbrains.jet.lang.resolve.BindingTraceContext;
|
||||
import org.jetbrains.jet.lang.resolve.calls.autocasts.DataFlowInfo;
|
||||
import org.jetbrains.jet.lang.resolve.calls.model.ResolvedCall;
|
||||
import org.jetbrains.jet.lang.resolve.calls.results.OverloadResolutionResults;
|
||||
import org.jetbrains.jet.lang.resolve.java.PsiClassFinder;
|
||||
import org.jetbrains.jet.lang.resolve.name.FqName;
|
||||
import org.jetbrains.jet.lang.resolve.name.Name;
|
||||
import org.jetbrains.jet.lang.resolve.scopes.receivers.ReceiverValue;
|
||||
import org.jetbrains.jet.lang.types.JetType;
|
||||
import org.jetbrains.jet.lang.types.TypeUtils;
|
||||
import org.jetbrains.jet.lang.types.expressions.ExpressionTypingContext;
|
||||
import org.jetbrains.jet.lang.types.expressions.ExpressionTypingServices;
|
||||
import org.jetbrains.jet.lang.types.lang.KotlinBuiltIns;
|
||||
import org.jetbrains.jet.parsing.JetParsingTest;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import static org.jetbrains.jet.lang.types.expressions.ExpressionTypingUtils.resolveFakeCall;
|
||||
|
||||
@SuppressWarnings("JUnitTestCaseWithNoTests")
|
||||
public class JetResolveTest extends ExtensibleResolveTestCase {
|
||||
@@ -70,41 +41,11 @@ public class JetResolveTest extends ExtensibleResolveTestCase {
|
||||
@Override
|
||||
protected ExpectedResolveData getExpectedResolveData() {
|
||||
Project project = getProject();
|
||||
KotlinBuiltIns builtIns = KotlinBuiltIns.getInstance();
|
||||
Map<String, DeclarationDescriptor> nameToDescriptor = new HashMap<String, DeclarationDescriptor>();
|
||||
nameToDescriptor.put("kotlin::Int.plus(Int)", standardFunction(builtIns.getInt(), "plus", builtIns.getIntType()));
|
||||
FunctionDescriptor descriptorForGet = standardFunction(builtIns.getArray(), "get", builtIns.getIntType());
|
||||
nameToDescriptor.put("kotlin::Array.get(Int)", descriptorForGet.getOriginal());
|
||||
nameToDescriptor.put("kotlin::Int.compareTo(Double)", standardFunction(builtIns.getInt(), "compareTo", builtIns.getDoubleType()));
|
||||
@NotNull
|
||||
FunctionDescriptor descriptorForSet = standardFunction(builtIns.getArray(), "set", builtIns.getIntType(), builtIns.getIntType());
|
||||
nameToDescriptor.put("kotlin::Array.set(Int, Int)", descriptorForSet.getOriginal());
|
||||
|
||||
Map<String, PsiElement> nameToDeclaration = new HashMap<String, PsiElement>();
|
||||
PsiClass java_util_Collections = findClass("java.util.Collections");
|
||||
nameToDeclaration.put("java::java.util.Collections.emptyList()", findMethod(java_util_Collections, "emptyList"));
|
||||
nameToDeclaration.put("java::java.util.Collections", java_util_Collections);
|
||||
PsiClass java_util_List = findClass("java.util.ArrayList");
|
||||
nameToDeclaration.put("java::java.util.ArrayList", java_util_List);
|
||||
nameToDeclaration.put("java::java.util.ArrayList.set()", java_util_List.findMethodsByName("set", true)[0]);
|
||||
nameToDeclaration.put("java::java.util.ArrayList.get()", java_util_List.findMethodsByName("get", true)[0]);
|
||||
nameToDeclaration.put("java::java", findPackage("java"));
|
||||
nameToDeclaration.put("java::java.util", findPackage("java.util"));
|
||||
nameToDeclaration.put("java::java.lang", findPackage("java.lang"));
|
||||
nameToDeclaration.put("java::java.lang.Object", findClass("java.lang.Object"));
|
||||
PsiClass java_lang_System = findClass("java.lang.System");
|
||||
nameToDeclaration.put("java::java.lang.System", java_lang_System);
|
||||
PsiMethod[] methods = findClass("java.io.PrintStream").findMethodsByName("print", true);
|
||||
nameToDeclaration.put("java::java.io.PrintStream.print(Object)", methods[8]);
|
||||
nameToDeclaration.put("java::java.io.PrintStream.print(Int)", methods[2]);
|
||||
nameToDeclaration.put("java::java.io.PrintStream.print(char[])", methods[6]);
|
||||
nameToDeclaration.put("java::java.io.PrintStream.print(Double)", methods[5]);
|
||||
nameToDeclaration.put("java::java.lang.System.out", java_lang_System.findFieldByName("out", true));
|
||||
PsiClass java_lang_Number = findClass("java.lang.Number");
|
||||
nameToDeclaration.put("java::java.lang.Number", java_lang_Number);
|
||||
nameToDeclaration.put("java::java.lang.Number.intValue()", java_lang_Number.findMethodsByName("intValue", true)[0]);
|
||||
|
||||
return new ExpectedResolveData(nameToDescriptor, nameToDeclaration, getEnvironment()) {
|
||||
return new ExpectedResolveData(
|
||||
JetExpectedResolveDataUtil.prepareDefaultNameToDescriptors(project),
|
||||
JetExpectedResolveDataUtil.prepareDefaultNameToDeclaration(project),
|
||||
getEnvironment()) {
|
||||
@Override
|
||||
protected JetFile createJetFile(String fileName, String text) {
|
||||
return createCheckAndReturnPsiFile(fileName, null, text);
|
||||
@@ -112,50 +53,6 @@ public class JetResolveTest extends ExtensibleResolveTestCase {
|
||||
};
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private PsiElement findPackage(String qualifiedName) {
|
||||
JavaPsiFacade javaFacade = JavaPsiFacade.getInstance(getProject());
|
||||
return javaFacade.findPackage(qualifiedName);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private PsiMethod findMethod(PsiClass psiClass, String name) {
|
||||
PsiMethod[] emptyLists = psiClass.findMethodsByName(name, true);
|
||||
return emptyLists[0];
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private PsiClass findClass(String qualifiedName) {
|
||||
Project project = getProject();
|
||||
InjectorForJavaSemanticServices injector = new InjectorForJavaSemanticServices(project);
|
||||
return injector.getPsiClassFinder().findPsiClass(new FqName(qualifiedName), PsiClassFinder.RuntimeClassesHandleMode.THROW);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private FunctionDescriptor standardFunction(ClassDescriptor classDescriptor, String name, JetType... parameterTypes) {
|
||||
|
||||
ExpressionTypingServices expressionTypingServices = new InjectorForTests(getProject()).getExpressionTypingServices();
|
||||
|
||||
ExpressionTypingContext context = ExpressionTypingContext.newContext(
|
||||
expressionTypingServices, new BindingTraceContext(), classDescriptor.getDefaultType().getMemberScope(),
|
||||
DataFlowInfo.EMPTY, TypeUtils.NO_EXPECTED_TYPE, false);
|
||||
|
||||
OverloadResolutionResults<FunctionDescriptor> functions = resolveFakeCall(
|
||||
context, ReceiverValue.NO_RECEIVER, Name.identifier(name), parameterTypes);
|
||||
|
||||
for (ResolvedCall<? extends FunctionDescriptor> resolvedCall : functions.getResultingCalls()) {
|
||||
List<ValueParameterDescriptor> unsubstitutedValueParameters = resolvedCall.getResultingDescriptor().getValueParameters();
|
||||
for (int i = 0, unsubstitutedValueParametersSize = unsubstitutedValueParameters.size(); i < unsubstitutedValueParametersSize; i++) {
|
||||
ValueParameterDescriptor unsubstitutedValueParameter = unsubstitutedValueParameters.get(i);
|
||||
if (unsubstitutedValueParameter.getType().equals(parameterTypes[i])) {
|
||||
return resolvedCall.getResultingDescriptor();
|
||||
}
|
||||
}
|
||||
}
|
||||
throw new IllegalArgumentException("Not found: kotlin::" + classDescriptor.getName() + "." + name + "(" +
|
||||
Arrays.toString(parameterTypes) + ")");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getTestDataPath() {
|
||||
return getHomeDirectory() + "/compiler/testData";
|
||||
|
||||
@@ -29,6 +29,7 @@ import org.jetbrains.jet.codegen.generated.AbstractRangesCodegenTest;
|
||||
import org.jetbrains.jet.jvm.compiler.*;
|
||||
import org.jetbrains.jet.lang.resolve.lazy.AbstractLazyResolveDescriptorRendererTest;
|
||||
import org.jetbrains.jet.lang.resolve.lazy.AbstractLazyResolveNamespaceComparingTest;
|
||||
import org.jetbrains.jet.lang.resolve.lazy.AbstractLazyResolveTest;
|
||||
import org.jetbrains.jet.plugin.highlighter.AbstractDeprecatedHighlightingTest;
|
||||
import org.jetbrains.jet.test.generator.SimpleTestClassModel;
|
||||
import org.jetbrains.jet.test.generator.TestClassModel;
|
||||
@@ -167,6 +168,11 @@ public class GenerateTests {
|
||||
// new SimpleTestClassModel(AbstractLazyResolveDiagnosticsTest.TEST_DATA_DIR, true, "kt", "doTest")
|
||||
//);
|
||||
|
||||
generateTest("compiler/tests",
|
||||
"LazyResolveTestGenerated",
|
||||
AbstractLazyResolveTest.class,
|
||||
testModel("compiler/testData/resolve/imports", false, "resolve", "doTest"));
|
||||
|
||||
generateTest(
|
||||
"compiler/tests/",
|
||||
"LazyResolveNamespaceComparingTestGenerated",
|
||||
|
||||
Reference in New Issue
Block a user