Add warning for ambiguous annotated expression syntax

#KT-14238 In Progress
This commit is contained in:
Denis Zharkov
2016-10-12 11:40:12 +03:00
parent 993d226c8f
commit 84153f9636
13 changed files with 159 additions and 12 deletions
@@ -3,7 +3,7 @@ annotation class ExprAnn
fun foo(): Int {
var a: Int
@ExprAnn a = 1
@ExprAnn a += 1
<!ANNOTATIONS_ON_BLOCK_LEVEL_EXPRESSION_ON_THE_SAME_LINE!>@ExprAnn a<!> = 1
<!ANNOTATIONS_ON_BLOCK_LEVEL_EXPRESSION_ON_THE_SAME_LINE!>@ExprAnn a<!> += 1
return a
}
}
@@ -7,5 +7,5 @@ fun transform(i: Int, tr: (Int) -> Int): Int = <!WRONG_ANNOTATION_TARGET!>@base<
@base <!WRONG_ANNOTATION_TARGET!>@special<!> fun foo(i: Int): Int {
val j = <!WRONG_ANNOTATION_TARGET!>@base<!> @special i + 1
if (j == 1) return foo(@special <!WRONG_ANNOTATION_TARGET!>@base<!> 42)
return transform(@special j, @base @special { @special it * 2 })
return transform(@special j, @base @special { <!ANNOTATIONS_ON_BLOCK_LEVEL_EXPRESSION_ON_THE_SAME_LINE!>@special it<!> * 2 })
}
@@ -9,5 +9,5 @@ fun transform(i: Int, tr: (@<!DEBUG_INFO_MISSING_UNRESOLVED!>special<!> Int) ->
fun foo(i: Int): Int {
val j = @special i + 1
if (j == 1) return foo(@special 42)
return transform(@special j, @special { i: @base Int -> <!WRONG_ANNOTATION_TARGET!>@base<!> i * 2 })
return transform(@special j, @special { i: @base Int -> <!ANNOTATIONS_ON_BLOCK_LEVEL_EXPRESSION_ON_THE_SAME_LINE!><!WRONG_ANNOTATION_TARGET!>@base<!> i<!> * 2 })
}