diff --git a/compiler/testData/diagnostics/testsWithStdLib/experimental/annotation.kt b/compiler/testData/diagnostics/testsWithStdLib/experimental/annotation.kt index 61e114d2d4e..d93f889eb88 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/experimental/annotation.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/experimental/annotation.kt @@ -80,7 +80,7 @@ fun returnType(): @EAnno Unit {} @UseExperimental(ExperimentalAPI::class) @EAnno val property = "" -@UseExperimental(ExperimentalAPI::class) +@UseExperimental(ExperimentalAPI::class) @EAnno typealias Typealias = Unit @UseExperimental(ExperimentalAPI::class) diff --git a/compiler/testData/diagnostics/testsWithStdLib/experimental/useExperimentalTargets.kt b/compiler/testData/diagnostics/testsWithStdLib/experimental/useExperimentalTargets.kt index 03ac37da9e2..ca8d9b387c9 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/experimental/useExperimentalTargets.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/experimental/useExperimentalTargets.kt @@ -52,3 +52,6 @@ fun expression(): String { val s = @UseExperimental(E::class) Foo().s return s } + +@UseExperimental(E::class) +typealias TypeAlias = Foo diff --git a/compiler/testData/diagnostics/testsWithStdLib/experimental/useExperimentalTargets.txt b/compiler/testData/diagnostics/testsWithStdLib/experimental/useExperimentalTargets.txt index d6195ed2db8..9791dca39e2 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/experimental/useExperimentalTargets.txt +++ b/compiler/testData/diagnostics/testsWithStdLib/experimental/useExperimentalTargets.txt @@ -19,6 +19,7 @@ public final class Constructor { public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String } +@kotlin.UseExperimental(markerClass = {api.E::class}) public typealias TypeAlias = api.Foo package api { diff --git a/libraries/stdlib/src/kotlin/annotations/Experimental.kt b/libraries/stdlib/src/kotlin/annotations/Experimental.kt index 772101f281a..2cc78f0491e 100644 --- a/libraries/stdlib/src/kotlin/annotations/Experimental.kt +++ b/libraries/stdlib/src/kotlin/annotations/Experimental.kt @@ -43,7 +43,9 @@ annotation class Experimental(val level: Level = Level.ERROR) { * * This class is experimental itself and can only be used with the compiler argument `-Xuse-experimental=kotlin.Experimental`. */ -@Target(CLASS, PROPERTY, LOCAL_VARIABLE, VALUE_PARAMETER, CONSTRUCTOR, FUNCTION, PROPERTY_GETTER, PROPERTY_SETTER, EXPRESSION, FILE) +@Target( + CLASS, PROPERTY, LOCAL_VARIABLE, VALUE_PARAMETER, CONSTRUCTOR, FUNCTION, PROPERTY_GETTER, PROPERTY_SETTER, EXPRESSION, FILE, TYPEALIAS +) @Retention(SOURCE) @SinceKotlin("1.2") @RequireKotlin("1.2.50", versionKind = RequireKotlinVersionKind.COMPILER_VERSION)