[FIR] Improve diagnostic reporting & don't use error symbol for candidate if possible

Also introduce few new diagnostics:
- NONE_APPLICABLE more many inapplicable candidates
- HIDDEN for visible candidates
This commit is contained in:
Dmitriy Novozhilov
2020-07-22 16:40:14 +03:00
committed by Mikhail Glukhikh
parent 5c0528b61e
commit f283f2db43
365 changed files with 1400 additions and 1451 deletions
@@ -11,8 +11,8 @@ fun takeFirst(expr: StringBuilder): Char {
fun evaluateArg(expr: CharSequence, numbers: ArrayList<Int>): Int {
if (expr.length == 0) throw Exception("Syntax error: Character expected");
val c = <!INAPPLICABLE_CANDIDATE!>takeFirst<!>(expr)
if (c <!UNRESOLVED_REFERENCE!>>=<!> '0' && c <!UNRESOLVED_REFERENCE!><=<!> '9') {
val n = c <!UNRESOLVED_REFERENCE!>-<!> '0'
if (c >= '0' && c <= '9') {
val n = c - '0'
if (!numbers.contains(n)) throw Exception("You used incorrect number: " + n)
numbers.remove(n)
return n
@@ -5,5 +5,5 @@ fun <T : Bar, T1> foo(x : Int) {}
fun <T1, T : Foo> foo(x : Long) {}
fun f(): Unit {
<!INAPPLICABLE_CANDIDATE!>foo<!><Int, Int>(1)
<!NONE_APPLICABLE!>foo<!><Int, Int>(1)
}
@@ -13,7 +13,7 @@ operator fun Int.set(s: Int, x: String = "", z: Int) {
fun main() {
<!INAPPLICABLE_CANDIDATE!>1[2] = 1<!>
1.set(2, z = 1)
<!UNRESOLVED_REFERENCE!>1[2] += 1<!>
1[2] += 1
1.<!INAPPLICABLE_CANDIDATE!>set<!>(2, 1)
}
@@ -12,7 +12,7 @@ operator fun Int?.contains(x : Int) : Boolean = false
fun f(): Unit {
var set : Set? = null
val i : Int? = null
i <!INAPPLICABLE_CANDIDATE!>+<!> 1
i <!NONE_APPLICABLE!>+<!> 1
set + 1
1 <!INAPPLICABLE_CANDIDATE!>in<!> set
1 in 2