JS: ignore annotation on expression when its retention is SOURCE

#KT-8258
This commit is contained in:
Zalim Bashorov
2016-02-15 18:34:20 +03:00
parent 90927cfd19
commit c28b701ccf
9 changed files with 135 additions and 32 deletions

View File

@@ -0,0 +1,40 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER
package foo
@Retention(AnnotationRetention.SOURCE)
@Target(AnnotationTarget.CLASS, AnnotationTarget.FUNCTION, AnnotationTarget.VALUE_PARAMETER, AnnotationTarget.EXPRESSION)
annotation class AnnotationWithSourceRetention
@Retention(AnnotationRetention.BINARY)
@Target(AnnotationTarget.CLASS, AnnotationTarget.FUNCTION, AnnotationTarget.VALUE_PARAMETER, AnnotationTarget.EXPRESSION)
annotation class AnnotationWithBinaryRetention
@Retention(AnnotationRetention.RUNTIME)
@Target(AnnotationTarget.CLASS, AnnotationTarget.FUNCTION, AnnotationTarget.VALUE_PARAMETER, AnnotationTarget.EXPRESSION)
annotation class AnnotationWithRuntimeRetention
@AnnotationWithSourceRetention
class TestSource {
@AnnotationWithSourceRetention
fun baz(@AnnotationWithSourceRetention foo : Int) : Int {
return (@AnnotationWithSourceRetention 1)
}
}
@AnnotationWithBinaryRetention
class TestBinary {
@AnnotationWithBinaryRetention
fun baz(@AnnotationWithBinaryRetention foo : Int) : Int {
return (<!NOT_SUPPORTED!>@AnnotationWithBinaryRetention 1<!>)
}
}
@AnnotationWithRuntimeRetention
class TestRuntime {
@AnnotationWithRuntimeRetention
fun baz(@AnnotationWithRuntimeRetention foo : Int) : Int {
return (<!NOT_SUPPORTED!>@AnnotationWithRuntimeRetention 1<!>)
}
}

View File

@@ -0,0 +1,49 @@
package
package foo {
@kotlin.annotation.Retention(value = AnnotationRetention.BINARY) @kotlin.annotation.Target(allowedTargets = {AnnotationTarget.CLASS, AnnotationTarget.FUNCTION, AnnotationTarget.VALUE_PARAMETER, AnnotationTarget.EXPRESSION}) public final annotation class AnnotationWithBinaryRetention : kotlin.Annotation {
public constructor AnnotationWithBinaryRetention()
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.annotation.Retention(value = AnnotationRetention.RUNTIME) @kotlin.annotation.Target(allowedTargets = {AnnotationTarget.CLASS, AnnotationTarget.FUNCTION, AnnotationTarget.VALUE_PARAMETER, AnnotationTarget.EXPRESSION}) public final annotation class AnnotationWithRuntimeRetention : kotlin.Annotation {
public constructor AnnotationWithRuntimeRetention()
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.annotation.Retention(value = AnnotationRetention.SOURCE) @kotlin.annotation.Target(allowedTargets = {AnnotationTarget.CLASS, AnnotationTarget.FUNCTION, AnnotationTarget.VALUE_PARAMETER, AnnotationTarget.EXPRESSION}) public final annotation class AnnotationWithSourceRetention : kotlin.Annotation {
public constructor AnnotationWithSourceRetention()
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
}
@foo.AnnotationWithBinaryRetention() public final class TestBinary {
public constructor TestBinary()
@foo.AnnotationWithBinaryRetention() public final fun baz(/*0*/ @foo.AnnotationWithBinaryRetention() foo: kotlin.Int): 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
}
@foo.AnnotationWithRuntimeRetention() public final class TestRuntime {
public constructor TestRuntime()
@foo.AnnotationWithRuntimeRetention() public final fun baz(/*0*/ @foo.AnnotationWithRuntimeRetention() foo: kotlin.Int): 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
}
@foo.AnnotationWithSourceRetention() public final class TestSource {
public constructor TestSource()
@foo.AnnotationWithSourceRetention() public final fun baz(/*0*/ @foo.AnnotationWithSourceRetention() foo: kotlin.Int): 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
}
}