forked from JetBrains/kotlin
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support @SinceKotlin annotation for type aliases.
- Loading branch information
Showing
15 changed files
with
208 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
...er/testData/diagnostics/tests/sourceCompatibility/apiVersion/typealiasesAsConstructors.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// !API_VERSION: 1.0 | ||
|
||
@SinceKotlin("1.1") | ||
open class C1 | ||
|
||
typealias C1_Alias = <!API_NOT_AVAILABLE!>C1<!> | ||
|
||
open class C2(val x: Int) { | ||
@SinceKotlin("1.1") | ||
constructor() : this(0) | ||
} | ||
|
||
typealias C2_Alias = C2 | ||
|
||
val test1 = <!UNRESOLVED_REFERENCE!>C1_Alias<!>() | ||
val test2 = C2_Alias(<!NO_VALUE_FOR_PARAMETER!>)<!> | ||
|
||
class Test3 : <!UNRESOLVED_REFERENCE, API_NOT_AVAILABLE, DEBUG_INFO_UNRESOLVED_WITH_TARGET!>C1_Alias<!>() | ||
|
||
class Test4 : C2_Alias(<!NO_VALUE_FOR_PARAMETER!>)<!> |
37 changes: 37 additions & 0 deletions
37
...r/testData/diagnostics/tests/sourceCompatibility/apiVersion/typealiasesAsConstructors.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package | ||
|
||
public val test1: [ERROR : Type for C1_Alias()] | ||
public val test2: C2 | ||
|
||
@kotlin.SinceKotlin(version = "1.1") public open class C1 { | ||
public constructor C1() | ||
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 | ||
} | ||
|
||
public open class C2 { | ||
@kotlin.SinceKotlin(version = "1.1") public constructor C2() | ||
public constructor C2(/*0*/ x: kotlin.Int) | ||
public final val x: kotlin.Int | ||
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 | ||
} | ||
|
||
public final class Test3 : C1_Alias /* = C1 */ { | ||
public constructor Test3() | ||
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 | ||
} | ||
|
||
public final class Test4 : C2_Alias /* = C2 */ { | ||
public constructor Test4() | ||
public final override /*1*/ /*fake_override*/ val x: kotlin.Int | ||
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 | ||
} | ||
public typealias C1_Alias = C1 | ||
public typealias C2_Alias = C2 |
11 changes: 11 additions & 0 deletions
11
compiler/testData/diagnostics/tests/sourceCompatibility/apiVersion/typealiasesAsObjects.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
// !API_VERSION: 1.0 | ||
|
||
@SinceKotlin("1.1") | ||
object Since_1_1 { | ||
val x = 42 | ||
} | ||
|
||
typealias Since_1_1_Alias = <!API_NOT_AVAILABLE!>Since_1_1<!> | ||
|
||
val test1 = <!API_NOT_AVAILABLE!>Since_1_1_Alias<!> | ||
val test2 = <!API_NOT_AVAILABLE!>Since_1_1_Alias<!>.x |
13 changes: 13 additions & 0 deletions
13
compiler/testData/diagnostics/tests/sourceCompatibility/apiVersion/typealiasesAsObjects.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package | ||
|
||
public val test1: [ERROR : Type for Since_1_1_Alias] | ||
public val test2: kotlin.Int = 42 | ||
|
||
@kotlin.SinceKotlin(version = "1.1") public object Since_1_1 { | ||
private constructor Since_1_1() | ||
public final val x: kotlin.Int = 42 | ||
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 | ||
} | ||
public typealias Since_1_1_Alias = Since_1_1 |
21 changes: 21 additions & 0 deletions
21
compiler/testData/diagnostics/tests/sourceCompatibility/apiVersion/typealiasesAsTypes.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
// !API_VERSION: 1.0 | ||
|
||
@SinceKotlin("1.1") | ||
class Since_1_1 | ||
|
||
class C | ||
|
||
typealias Since_1_1_Alias = <!API_NOT_AVAILABLE!>Since_1_1<!> | ||
|
||
typealias L = List<<!API_NOT_AVAILABLE!>Since_1_1<!>> | ||
|
||
@SinceKotlin("1.1") | ||
typealias C_1_1_Alias = C | ||
|
||
fun test1(x: <!API_NOT_AVAILABLE!>Since_1_1_Alias<!>) = x | ||
|
||
fun test2(x: <!API_NOT_AVAILABLE!>C_1_1_Alias<!>) = x | ||
|
||
fun test3(x: List<<!API_NOT_AVAILABLE!>C_1_1_Alias<!>>) = x | ||
|
||
fun test4(x: L) = x |
23 changes: 23 additions & 0 deletions
23
compiler/testData/diagnostics/tests/sourceCompatibility/apiVersion/typealiasesAsTypes.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package | ||
|
||
public fun test1(/*0*/ x: Since_1_1_Alias /* = Since_1_1 */): Since_1_1_Alias /* = Since_1_1 */ | ||
public fun test2(/*0*/ x: C_1_1_Alias /* = C */): C_1_1_Alias /* = C */ | ||
public fun test3(/*0*/ x: kotlin.collections.List<C_1_1_Alias /* = C */>): kotlin.collections.List<C_1_1_Alias /* = C */> | ||
public fun test4(/*0*/ x: L /* = kotlin.collections.List<Since_1_1> */): L /* = kotlin.collections.List<Since_1_1> */ | ||
|
||
public final class C { | ||
public constructor C() | ||
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 | ||
} | ||
|
||
@kotlin.SinceKotlin(version = "1.1") public final class Since_1_1 { | ||
public constructor Since_1_1() | ||
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 | ||
} | ||
@kotlin.SinceKotlin(version = "1.1") public typealias C_1_1_Alias = C | ||
public typealias L = kotlin.collections.List<Since_1_1> | ||
public typealias Since_1_1_Alias = Since_1_1 |
18 changes: 18 additions & 0 deletions
18
compiler/testData/diagnostics/tests/sourceCompatibility/apiVersion/typealiasesOnImport.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// !API_VERSION: 1.0 | ||
|
||
// FILE: a.kt | ||
package a | ||
|
||
@SinceKotlin("1.1") | ||
class Since_1_1 | ||
|
||
typealias Since_1_1_Alias = <!API_NOT_AVAILABLE!>Since_1_1<!> | ||
|
||
@SinceKotlin("1.1") | ||
typealias Alias_1_1 = String | ||
|
||
// FILE: b.kt | ||
package b | ||
|
||
import a.<!API_NOT_AVAILABLE!>Since_1_1_Alias<!> | ||
import a.<!API_NOT_AVAILABLE!>Alias_1_1<!> |
16 changes: 16 additions & 0 deletions
16
compiler/testData/diagnostics/tests/sourceCompatibility/apiVersion/typealiasesOnImport.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package | ||
|
||
package a { | ||
|
||
@kotlin.SinceKotlin(version = "1.1") public final class Since_1_1 { | ||
public constructor Since_1_1() | ||
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 | ||
} | ||
@kotlin.SinceKotlin(version = "1.1") public typealias Alias_1_1 = kotlin.String | ||
public typealias Since_1_1_Alias = a.Since_1_1 | ||
} | ||
|
||
package b { | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters