[FIR] Introduce TYPE_ARGUMENTS_NOT_ALLOWED & some other type errors

This commit introduces several different things, in particular:
- check type arguments in expressions
- new TypeArgumentList node to deal with diagnostic source
- ConeDiagnostic was moved to fir:cones
- ConeIntermediateDiagnostic to use in inference (?) without reporting
- detailed diagnostics on error type
This commit is contained in:
Mikhail Glukhikh
2020-07-22 10:29:59 +03:00
parent c744dfba9c
commit 0804c6a0f3
196 changed files with 774 additions and 484 deletions
@@ -1,5 +1,5 @@
// !DIAGNOSTICS: -FUNCTION_DECLARATION_WITH_NO_NAME
class ClassB() {
private inner class ClassC: <!SYNTAX!>super<!><!SYNTAX!>.<!>@ClassA()<!SYNTAX!><!> {
private inner class ClassC: <!SYNTAX!>super<!><!SYNTAX!>.<!>@<!OTHER_ERROR!>ClassA<!>()<!SYNTAX!><!> {
}
}
@@ -1,5 +1,5 @@
// !WITH_NEW_INFERENCE
fun bar() {
fun <T: T?> foo() {}
fun <T: <!OTHER_ERROR!>T?<!>> foo() {}
<!INAPPLICABLE_CANDIDATE!>foo<!>()
}
@@ -1,7 +1,7 @@
package kt402
fun getTypeChecker() : (Any)->Boolean {
{ a : Any -> a is T } // reports unsupported
{ a : Any -> a is <!OTHER_ERROR!>T<!> } // reports unsupported
}
fun f() : (Any) -> Boolean {
return { a : Any -> a is String }
@@ -18,7 +18,7 @@ import foo.View
//import foo.TextView
fun String.gah(view:View ?) {
if (view is TextView)
if (view is <!OTHER_ERROR!>TextView<!>)
view
else <!UNRESOLVED_REFERENCE!>TextView<!>() as foo.TextView
}
@@ -1,14 +1,14 @@
// KT-9620 AssertionError in checkBounds
interface E1<T : D<String>, D>
interface E1<T : <!TYPE_ARGUMENTS_NOT_ALLOWED!>D<String><!>, D>
interface A
interface B
interface D<X>
interface E2<T : D<A>, D<!SYNTAX!><<!><!SYNTAX!>B<!><!SYNTAX!>><!><!SYNTAX!>><!>
interface E2<T : <!TYPE_ARGUMENTS_NOT_ALLOWED!>D<A><!>, D<!SYNTAX!><<!><!SYNTAX!>B<!><!SYNTAX!>><!><!SYNTAX!>><!>
// KT-11354 AE from DescriptorResolver
open class L<E>()
class M<C> : L<C<C>>()
class M<C> : L<<!TYPE_ARGUMENTS_NOT_ALLOWED, TYPE_ARGUMENTS_NOT_ALLOWED, TYPE_ARGUMENTS_NOT_ALLOWED!>C<C><!>>()