Changed imports semantics: imports order does not affect resolve, explicit imports have higher priority for classes

This commit is contained in:
Valentin Kipyatkov
2015-01-14 20:55:53 +03:00
parent 8fc0063410
commit b888ea601c
23 changed files with 427 additions and 142 deletions
@@ -0,0 +1,17 @@
// FILE: a.kt
package a
class X
// FILE: b.kt
package b
class X
// FILE: c.kt
package c
import a.*
import b.*
class Y : <!UNRESOLVED_REFERENCE!>X<!>
@@ -0,0 +1,31 @@
package
package a {
internal final class X {
public constructor X()
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
}
package b {
internal final class X {
public constructor X()
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
}
package c {
internal final class Y {
public constructor Y()
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
}
@@ -0,0 +1,17 @@
// FILE: a.kt
package a
open class X
// FILE: b.kt
package b
class X
// FILE: c.kt
package c
import a.X
import b.*
class Y : X()
@@ -0,0 +1,31 @@
package
package a {
internal open class X {
public constructor X()
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
}
package b {
internal final class X {
public constructor X()
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
}
package c {
internal final class Y : a.X {
public constructor Y()
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
}
@@ -0,0 +1,19 @@
// FILE: a.kt
package a
fun X(<!UNUSED_PARAMETER!>p<!>: Int) {}
// FILE: b.kt
package b
fun X(): Int = 1
// FILE: c.kt
package c
import b.*
import a.X
fun foo() {
val <!UNUSED_VARIABLE!>v<!>: Int = X()
}
@@ -0,0 +1,13 @@
package
package a {
internal fun X(/*0*/ p: kotlin.Int): kotlin.Unit
}
package b {
internal fun X(): kotlin.Int
}
package c {
internal fun foo(): kotlin.Unit
}
@@ -0,0 +1,19 @@
// FILE: a.kt
package a
var X: Int = 1
// FILE: b.kt
package b
var X: String = ""
// FILE: c.kt
package c
import a.X
import b.*
fun foo() {
<!OVERLOAD_RESOLUTION_AMBIGUITY!>X<!> = 1
}
@@ -0,0 +1,13 @@
package
package a {
internal var X: kotlin.Int
}
package b {
internal var X: kotlin.String
}
package c {
internal fun foo(): kotlin.Unit
}
@@ -0,0 +1,17 @@
// FILE: a.kt
package a
class X
// FILE: b.kt
package b
class X
// FILE: c.kt
package c
import a.X
import b.X
class Y : <!UNRESOLVED_REFERENCE!>X<!>
@@ -0,0 +1,31 @@
package
package a {
internal final class X {
public constructor X()
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
}
package b {
internal final class X {
public constructor X()
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
}
package c {
internal final class Y {
public constructor Y()
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
}
@@ -0,0 +1,19 @@
// FILE: a.kt
package a
fun X(<!UNUSED_PARAMETER!>p<!>: Int) {}
// FILE: b.kt
package b
fun X(): Int = 1
// FILE: c.kt
package c
import b.X
import a.X
fun foo() {
val <!UNUSED_VARIABLE!>v<!>: Int = X()
}
@@ -0,0 +1,13 @@
package
package a {
internal fun X(/*0*/ p: kotlin.Int): kotlin.Unit
}
package b {
internal fun X(): kotlin.Int
}
package c {
internal fun foo(): kotlin.Unit
}
@@ -5,7 +5,7 @@ package test
import testing.first.*
import testing.second.*
val a1: `second`TestClass? = null
val a1: `!`TestClass? = null
//FILE:mainToFirst.kt
//----------------------------------------------------------------------------------
@@ -14,16 +14,16 @@ package test
import testing.second.*
import testing.first.*
val a2: `first`TestClass? = null
val a2: `!`TestClass? = null
//FILE:importFirst.kt
//----------------------------------------------------------------------------------
package testing.first
class ~first~TestClass
class TestClass
//FILE:importSecond.kt
//----------------------------------------------------------------------------------
package testing.second
class ~second~TestClass
class TestClass
@@ -16,7 +16,7 @@ import testing.second.TestClass
import testing.first.*
// Single import has priority over package import
val a2: `first`TestClass? = null
val a2: `second`TestClass? = null
//FILE:importFirst.kt
@@ -5,7 +5,7 @@ package test
import testing.first.TestClass
import testing.second.TestClass
val a1: `second`TestClass? = null
val a1: `!`TestClass? = null
//FILE:mainToFirst.kt
//----------------------------------------------------------------------------------
@@ -14,13 +14,13 @@ package test
import testing.second.TestClass
import testing.first.TestClass
val a2: `first`TestClass? = null
val a2: `!`TestClass? = null
//FILE:importFirst.kt
//----------------------------------------------------------------------------------
package testing.first
class ~first~TestClass
class TestClass
//FILE:importSecond.kt
@@ -28,4 +28,4 @@ class ~first~TestClass
package testing.second
class testing.second
class ~second~TestClass
class TestClass
@@ -8,7 +8,7 @@ import testing.allUnder.*
// The goal is to activate lazy resolve in order Second, Other
class FirstOrder: `other`Other, FirstInternal
trait FirstInternal: `allUnder`Second
trait FirstInternal: `exact`Second
@@ -22,7 +22,7 @@ import testing.allUnder.*
// The goal is to activate lazy resolve in order Other, Second
class FirstOrder: FirstInternal, `other`Other
trait FirstInternal: `allUnder`Second
trait FirstInternal: `exact`Second