JS: ignore annotation on expression when its retention is SOURCE
#KT-8258
This commit is contained in:
@@ -1,4 +0,0 @@
|
||||
$TESTDATA_DIR$/diagnosticForUnhandledElements.kt
|
||||
-no-stdlib
|
||||
-output
|
||||
$TEMP_DIR$/out.js
|
||||
@@ -1,12 +0,0 @@
|
||||
package foo
|
||||
|
||||
@Target(AnnotationTarget.CLASS, AnnotationTarget.FUNCTION, AnnotationTarget.VALUE_PARAMETER, AnnotationTarget.EXPRESSION)
|
||||
annotation class fancy
|
||||
|
||||
@fancy
|
||||
class Foo {
|
||||
@fancy
|
||||
fun baz(@fancy foo : Int) : Int {
|
||||
return (@fancy 1)
|
||||
}
|
||||
}
|
||||
@@ -1,4 +0,0 @@
|
||||
compiler/testData/cli/js/diagnosticForUnhandledElements.kt:10:17: error: cannot translate (not supported yet): '@fancy 1'
|
||||
return (@fancy 1)
|
||||
^
|
||||
COMPILATION_ERROR
|
||||
+40
@@ -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<!>)
|
||||
}
|
||||
}
|
||||
|
||||
+49
@@ -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
|
||||
}
|
||||
}
|
||||
+16
-1
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010-2015 JetBrains s.r.o.
|
||||
* Copyright 2010-2016 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -67,4 +67,19 @@ public class DiagnosticsTestWithJsStdLibAndBackendCompilationGenerated extends A
|
||||
doTest(fileName);
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/diagnostics/testsWithJsStdLibAndBackendCompilation/unsupportedFeatures")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class UnsupportedFeatures extends AbstractDiagnosticsTestWithJsStdLibAndBackendCompilation {
|
||||
public void testAllFilesPresentInUnsupportedFeatures() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/diagnostics/testsWithJsStdLibAndBackendCompilation/unsupportedFeatures"), Pattern.compile("^(.+)\\.kt$"), true);
|
||||
}
|
||||
|
||||
@TestMetadata("annotations.kt")
|
||||
public void testAnnotations() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/testsWithJsStdLibAndBackendCompilation/unsupportedFeatures/annotations.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010-2015 JetBrains s.r.o.
|
||||
* Copyright 2010-2016 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -304,12 +304,6 @@ public class KotlincExecutableTestGenerated extends AbstractKotlincExecutableTes
|
||||
doJsTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("diagnosticForUnhandledElements.args")
|
||||
public void testDiagnosticForUnhandledElements() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/cli/js/diagnosticForUnhandledElements.args");
|
||||
doJsTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("diagnosticWhenReferenceToBuiltinsMember.args")
|
||||
public void testDiagnosticWhenReferenceToBuiltinsMember() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/cli/js/diagnosticWhenReferenceToBuiltinsMember.args");
|
||||
|
||||
Reference in New Issue
Block a user