Report warning when SinceKotlin value is greater than -api-version value

To prevent this diagnostic be reported in each test on SinceKotlin, disable it
when a diagnostic test contains the "!API_VERSION" directive
This commit is contained in:
Alexander Udalov
2016-10-10 14:49:48 +03:00
parent 167ab1f860
commit 4eac12e350
10 changed files with 53 additions and 6 deletions
@@ -0,0 +1,5 @@
$TESTDATA_DIR$/apiVersionAndSinceNewerKotlin.kt
-d
$TEMP_DIR$
-api-version
1.0
@@ -0,0 +1,5 @@
@SinceKotlin("1.0")
fun old() {}
@SinceKotlin("1.1")
fun new() {}
@@ -0,0 +1,4 @@
compiler/testData/cli/jvm/apiVersionAndSinceNewerKotlin.kt:4:1: warning: the version is greater than the specified API version 1.0
@SinceKotlin("1.1")
^
OK
+1
View File
@@ -87,6 +87,7 @@ This directive lets you enable or disable certain language features. Language fe
### 5. API_VERSION
This directive emulates the behavior of the `-api-version` command line option, disallowing to use declarations annotated with `@SinceKotlin(X)` where X is greater than the specified API version.
Note that if this directive is present, the NEWER_VERSION_IN_SINCE_KOTLIN diagnostic is automatically disabled, _unless_ the "!DIAGNOSTICS" directive is present.
#### Usage:
@@ -70,5 +70,5 @@ fun ok2() {}
@SinceKotlin("0.0.0")
fun ok3() {}
@SinceKotlin("123456789012345678901234567890.123456789012345678901234567890.123456789012345678901234567890")
<!NEWER_VERSION_IN_SINCE_KOTLIN!>@SinceKotlin("123456789012345678901234567890.123456789012345678901234567890.123456789012345678901234567890")<!>
fun ok4() {}