Imports resolution tests

This commit is contained in:
Nikolay Krasko
2013-02-01 21:11:43 +04:00
parent e69acd9198
commit 54e5fa5256
22 changed files with 795 additions and 118 deletions
@@ -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