[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
@@ -10,14 +10,14 @@ FILE: default.kt
R|/foo|(Int(1), Double(2.0))
R|/foo|(Int(1), Double(2.0), Boolean(true))
R|/foo|(Int(1), third = Boolean(true))
<Inapplicable(PARAMETER_MAPPING_ERROR): [/foo]>#()
<Inapplicable(PARAMETER_MAPPING_ERROR): [/foo]>#(Int(0), Double(0.0), Boolean(false), String())
<Inapplicable(PARAMETER_MAPPING_ERROR): /foo>#()
<Inapplicable(PARAMETER_MAPPING_ERROR): /foo>#(Int(0), Double(0.0), Boolean(false), String())
R|/bar|(Int(1), third = Boolean(true))
R|/bar|(Int(1), Double(2.0), Boolean(true))
R|/bar|(Int(1), Double(2.0), Boolean(true), String(my))
<Inapplicable(PARAMETER_MAPPING_ERROR): [/bar]>#(Int(1), Boolean(true))
<Inapplicable(PARAMETER_MAPPING_ERROR): /bar>#(Int(1), Boolean(true))
R|/baz|(Int(1))
R|/baz|(Int(1), vararg(String(my), String(yours)))
R|/baz|(Int(1), z = Boolean(true))
<Inapplicable(INAPPLICABLE): [/baz]>#(Int(0), String(), Boolean(false))
<Inapplicable(INAPPLICABLE): /baz>#(Int(0), String(), Boolean(false))
}
@@ -22,8 +22,8 @@ FILE: defaultFromOverrides.kt
public final fun foo(a: R|A|): R|kotlin/Unit| {
R|<local>/a|.R|/A.foo|()
R|<local>/a|.R|/A.foo|(Int(1))
R|<local>/a|.<Inapplicable(PARAMETER_MAPPING_ERROR): [/A.bar]>#()
R|<local>/a|.<Inapplicable(PARAMETER_MAPPING_ERROR): [/A.bar]>#(String())
R|<local>/a|.<Inapplicable(PARAMETER_MAPPING_ERROR): /A.bar>#()
R|<local>/a|.<Inapplicable(PARAMETER_MAPPING_ERROR): /A.bar>#(String())
R|<local>/a|.R|/A.bar|(y = Int(1))
R|<local>/a|.R|/A.bar|(String(), Int(2))
}
@@ -20,9 +20,9 @@ FILE: integerLiteralTypes.kt
R|/takeLong|(Long(1))
}
public final fun test_2(): R|kotlin/Unit| {
<Inapplicable(INAPPLICABLE): [/takeInt]>#(Long(10000000000))
<Inapplicable(INAPPLICABLE): /takeInt>#(Long(10000000000))
R|/takeLong|(Long(10000000000))
<Inapplicable(INAPPLICABLE): [/takeByte]>#(Int(1000))
<Inapplicable(INAPPLICABLE): /takeByte>#(Int(1000))
}
public final fun test_3(): R|kotlin/Unit| {
R|/takeInt|(R|kotlin/run|<R|kotlin/Int|>(<L> = run@fun <anonymous>(): R|kotlin/Int| <kind=EXACTLY_ONCE> {
@@ -46,8 +46,8 @@ FILE: integerLiteralTypes.kt
))
}
public final fun test_5(): R|kotlin/Unit| {
<Inapplicable(INAPPLICABLE): [/takeString]>#(Int(1))
<Inapplicable(INAPPLICABLE): [/takeString]>#(R|kotlin/run|<R|kotlin/Int|>(<L> = run@fun <anonymous>(): R|kotlin/Int| <kind=EXACTLY_ONCE> {
<Inapplicable(INAPPLICABLE): /takeString>#(Int(1))
<Inapplicable(INAPPLICABLE): /takeString>#(R|kotlin/run|<R|kotlin/Int|>(<L> = run@fun <anonymous>(): R|kotlin/Int| <kind=EXACTLY_ONCE> {
^ Int(1)
}
))
@@ -5,6 +5,6 @@ FILE: main.kt
}
public final fun test(array: R|kotlin/Array<B>|): R|kotlin/Unit| {
Q|A|.R|/A.take|(R|<local>/array|)
<Inapplicable(INAPPLICABLE): [/takeA]>#(R|<local>/array|)
<Inapplicable(INAPPLICABLE): /takeA>#(R|<local>/array|)
R|/takeOutA|(R|<local>/array|)
}
@@ -18,11 +18,11 @@ FILE: lambda.kt
^@foo Unit
}
)
<Inapplicable(PARAMETER_MAPPING_ERROR): [/foo]>#(Int(1), <L> = foo@fun <anonymous>(): R|kotlin/Unit| {
<Inapplicable(PARAMETER_MAPPING_ERROR): /foo>#(Int(1), <L> = foo@fun <anonymous>(): R|kotlin/Unit| {
^@foo Unit
}
)
<Inapplicable(PARAMETER_MAPPING_ERROR): [/foo]>#(f = foo@fun <anonymous>(): R|kotlin/Unit| {
<Inapplicable(PARAMETER_MAPPING_ERROR): /foo>#(f = foo@fun <anonymous>(): R|kotlin/Unit| {
^@foo Unit
}
, <L> = foo@fun <anonymous>(): R|kotlin/Unit| {
@@ -45,11 +45,11 @@ FILE: lambda.kt
^@bar Unit
}
)
<Inapplicable(PARAMETER_MAPPING_ERROR): [/bar]>#(<L> = bar@fun <anonymous>(): R|kotlin/Unit| {
<Inapplicable(PARAMETER_MAPPING_ERROR): /bar>#(<L> = bar@fun <anonymous>(): R|kotlin/Unit| {
^@bar Unit
}
)
<Inapplicable(PARAMETER_MAPPING_ERROR): [/bar]>#(bar@fun <anonymous>(): R|kotlin/Unit| {
<Inapplicable(PARAMETER_MAPPING_ERROR): /bar>#(bar@fun <anonymous>(): R|kotlin/Unit| {
^@bar Unit
}
)
@@ -61,15 +61,15 @@ FILE: lambda.kt
^@baz Unit
}
, Boolean(false))
<Inapplicable(PARAMETER_MAPPING_ERROR): [/baz]>#(<L> = baz@fun <anonymous>(): R|kotlin/Unit| {
<Inapplicable(PARAMETER_MAPPING_ERROR): /baz>#(<L> = baz@fun <anonymous>(): R|kotlin/Unit| {
^@baz Unit
}
)
<Inapplicable(PARAMETER_MAPPING_ERROR): [/baz]>#(<L> = baz@fun <anonymous>(): R|kotlin/Unit| {
<Inapplicable(PARAMETER_MAPPING_ERROR): /baz>#(<L> = baz@fun <anonymous>(): R|kotlin/Unit| {
^@baz Unit
}
)
<Inapplicable(PARAMETER_MAPPING_ERROR): [/baz]>#(other = Boolean(false), <L> = baz@fun <anonymous>(): R|kotlin/Unit| {
<Inapplicable(PARAMETER_MAPPING_ERROR): /baz>#(other = Boolean(false), <L> = baz@fun <anonymous>(): R|kotlin/Unit| {
^@baz Unit
}
)
@@ -30,20 +30,20 @@ FILE: operatorsOverLiterals.kt
}
public final fun test_4(): R|kotlin/Unit| {
R|/takeByte|(Byte(1).R|kotlin/Byte.plus|(Byte(1)))
<Inapplicable(INAPPLICABLE): [/takeByte]>#(Int(1).R|kotlin/Int.plus|(Int(127)))
<Inapplicable(INAPPLICABLE): /takeByte>#(Int(1).R|kotlin/Int.plus|(Int(127)))
R|/takeByte|(Byte(1).R|kotlin/Byte.minus|(Byte(1)))
<Inapplicable(INAPPLICABLE): [/takeByte]>#(Int(100).R|kotlin/Int.unaryMinus|().R|kotlin/Int.minus|(Int(100)))
<Inapplicable(INAPPLICABLE): /takeByte>#(Int(100).R|kotlin/Int.unaryMinus|().R|kotlin/Int.minus|(Int(100)))
R|/takeByte|(Byte(10).R|kotlin/Byte.times|(Byte(10)))
<Inapplicable(INAPPLICABLE): [/takeByte]>#(Int(100).R|kotlin/Int.times|(Int(100)))
<Inapplicable(INAPPLICABLE): /takeByte>#(Int(100).R|kotlin/Int.times|(Int(100)))
<Unresolved name: taleByte>#(Int(10).R|kotlin/Int.div|(Int(10)))
R|/takeByte|(Byte(100).R|kotlin/Byte.rem|(Byte(10)))
R|/takeByte|(Int(1000).R|kotlin/Int.rem|(Byte(10)))
R|/takeByte|(Int(1000).R|<local>/and|(Byte(100)))
<Inapplicable(INAPPLICABLE): [/takeByte]>#(Int(128).R|kotlin/Int.and|(Int(511)))
<Inapplicable(INAPPLICABLE): /takeByte>#(Int(128).R|kotlin/Int.and|(Int(511)))
R|/takeByte|(Byte(100).R|<local>/or|(Byte(100)))
<Inapplicable(INAPPLICABLE): [/takeByte]>#(Int(1000).R|kotlin/Int.or|(Int(0)))
<Inapplicable(INAPPLICABLE): /takeByte>#(Int(1000).R|kotlin/Int.or|(Int(0)))
R|/takeByte|(Int(511).R|kotlin/Int.xor|(Int(511)))
<Inapplicable(INAPPLICABLE): [/takeByte]>#(Int(512).R|kotlin/Int.xor|(Int(511)))
<Inapplicable(INAPPLICABLE): /takeByte>#(Int(512).R|kotlin/Int.xor|(Int(511)))
}
public final fun test_5(): R|kotlin/Unit| {
R|/takeByte|(Byte(1).R|kotlin/Byte.unaryMinus|())
@@ -51,11 +51,11 @@ FILE: operatorsOverLiterals.kt
R|/takeByte|(Byte(1).R|<local>/inv|())
}
public final fun test_6(): R|kotlin/Unit| {
<Inapplicable(INAPPLICABLE): [/takeByte]>#(R|kotlin/run|<R|kotlin/Int|>(<L> = run@fun <anonymous>(): R|kotlin/Int| <kind=EXACTLY_ONCE> {
<Inapplicable(INAPPLICABLE): /takeByte>#(R|kotlin/run|<R|kotlin/Int|>(<L> = run@fun <anonymous>(): R|kotlin/Int| <kind=EXACTLY_ONCE> {
^ Int(127).R|kotlin/Int.plus|(Int(1))
}
))
<Inapplicable(INAPPLICABLE): [/takeByte]>#(Int(1).R|<local>/plus|(R|kotlin/run|<R|kotlin/Int|>(<L> = run@fun <anonymous>(): R|kotlin/Int| <kind=EXACTLY_ONCE> {
<Inapplicable(INAPPLICABLE): /takeByte>#(Int(1).R|<local>/plus|(R|kotlin/run|<R|kotlin/Int|>(<L> = run@fun <anonymous>(): R|kotlin/Int| <kind=EXACTLY_ONCE> {
^ Int(1)
}
)))
@@ -7,11 +7,11 @@ FILE: simple.kt
R|/foo|(Int(1), Double(2.0), fourth = String(???), third = Boolean(false))
R|/foo|(Int(1), second = Double(3.14), third = Boolean(false), fourth = String(!?))
R|/foo|(third = Boolean(false), second = Double(2.71), fourth = String(?!), first = Int(0))
<Inapplicable(PARAMETER_MAPPING_ERROR): [/foo]>#()
<Inapplicable(INAPPLICABLE): [/foo]>#(Double(0.0), Boolean(false), Int(0), String())
<Inapplicable(PARAMETER_MAPPING_ERROR): /foo>#()
<Inapplicable(INAPPLICABLE): /foo>#(Double(0.0), Boolean(false), Int(0), String())
R|/foo|(Int(1), Double(2.0), third = Boolean(true), String())
<Inapplicable(PARAMETER_MAPPING_ERROR): [/foo]>#(second = Double(0.0), first = Int(0), fourth = String())
<Inapplicable(INAPPLICABLE): [/foo]>#(first = Double(0.0), second = Int(0), third = String(), fourth = Boolean(false))
<Inapplicable(INAPPLICABLE): [/foo]>#(first = Int(0), second = Double(0.0), third = Boolean(false), fourth = String(), first = Int(1))
<Inapplicable(PARAMETER_MAPPING_ERROR): [/foo]>#(Int(0), Double(0.0), Boolean(false), foth = String())
<Inapplicable(PARAMETER_MAPPING_ERROR): /foo>#(second = Double(0.0), first = Int(0), fourth = String())
<Inapplicable(INAPPLICABLE): /foo>#(first = Double(0.0), second = Int(0), third = String(), fourth = Boolean(false))
<Inapplicable(INAPPLICABLE): /foo>#(first = Int(0), second = Double(0.0), third = Boolean(false), fourth = String(), first = Int(1))
<Inapplicable(PARAMETER_MAPPING_ERROR): /foo>#(Int(0), Double(0.0), Boolean(false), foth = String())
}
@@ -8,9 +8,9 @@ FILE: vararg.kt
R|/foo|(Int(1), vararg(String()))
R|/foo|(Int(1), vararg(String(my), String(yours)))
R|/foo|(Int(1), vararg(*R|kotlin/arrayOf|<R|kotlin/String|>(vararg(String(my), String(yours)))))
<Inapplicable(INAPPLICABLE): [/foo]>#(String())
<Inapplicable(INAPPLICABLE): [/foo]>#(Int(1), Int(2))
<Inapplicable(INAPPLICABLE): /foo>#(String())
<Inapplicable(INAPPLICABLE): /foo>#(Int(1), Int(2))
R|/bar|(Int(1), z = Boolean(true), vararg(y = *R|kotlin/arrayOf|<R|kotlin/String|>(vararg(String(my), String(yours)))))
<Inapplicable(INAPPLICABLE): [/bar]>#(Int(0), z = Boolean(false), y = String(), y = String(other))
<Inapplicable(PARAMETER_MAPPING_ERROR): [/bar]>#(Int(0), String(), Boolean(true))
<Inapplicable(INAPPLICABLE): /bar>#(Int(0), z = Boolean(false), y = String(), y = String(other))
<Inapplicable(PARAMETER_MAPPING_ERROR): /bar>#(Int(0), String(), Boolean(true))
}