[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:
+1
-1
@@ -1,7 +1,7 @@
|
||||
fun foo() {
|
||||
<!LOCAL_ANNOTATION_CLASS_ERROR!>annotation class Ann<!>
|
||||
|
||||
@Anno class Local {
|
||||
@Ann class Local {
|
||||
// There should also be NESTED_CLASS_NOT_ALLOWED report here.
|
||||
<!LOCAL_ANNOTATION_CLASS_ERROR!>annotation class Nested<!>
|
||||
}
|
||||
|
||||
+1
-1
@@ -7,7 +7,7 @@ FILE: localAnnotationClass.kt
|
||||
|
||||
}
|
||||
|
||||
@R|ERROR CLASS: Symbol not found, for `Anno`|() local final class Local : R|kotlin/Any| {
|
||||
@R|Ann|() local final class Local : R|kotlin/Any| {
|
||||
public constructor(): R|Local| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
+34
@@ -0,0 +1,34 @@
|
||||
package rest
|
||||
|
||||
abstract class Foo<T> {
|
||||
abstract val x: <!TYPE_ARGUMENTS_NOT_ALLOWED, TYPE_ARGUMENTS_NOT_ALLOWED!>T<Int><!>
|
||||
|
||||
abstract fun foo(): <!TYPE_ARGUMENTS_NOT_ALLOWED!>T<String><!>
|
||||
}
|
||||
|
||||
fun <T> foo() {
|
||||
bar<<!TYPE_ARGUMENTS_NOT_ALLOWED, UPPER_BOUND_VIOLATED!>T<Int><!>>()
|
||||
bar<List<List<<!TYPE_ARGUMENTS_NOT_ALLOWED, UPPER_BOUND_VIOLATED!>T<Boolean><!>>>>()
|
||||
}
|
||||
|
||||
fun <T> bar() {}
|
||||
|
||||
object Best {
|
||||
|
||||
}
|
||||
|
||||
val a = <!TYPE_ARGUMENTS_NOT_ALLOWED!>rest<Int><!>.<!UNRESOLVED_REFERENCE!>MyClass<!><String>
|
||||
val b = Best.<!UNRESOLVED_REFERENCE!>MyClass<!><String>
|
||||
|
||||
class B<E>
|
||||
class C<F<!SYNTAX!><<!><!SYNTAX!>Boolean<!><!SYNTAX!>><!><!SYNTAX!>><!> <!SYNTAX!>:<!> <!SYNTAX!>B<!><!SYNTAX!><<!><!SYNTAX!>F<!><!SYNTAX!><<!><!SYNTAX!>Boolean<!><!SYNTAX!>><!><!SYNTAX!>><!><!SYNTAX!>(<!><!SYNTAX!>)<!>
|
||||
|
||||
fun <G> gest() {}
|
||||
|
||||
fun <T> fest() {
|
||||
val b: List<<!TYPE_ARGUMENTS_NOT_ALLOWED!>T<Double><!>>
|
||||
gest<<!TYPE_ARGUMENTS_NOT_ALLOWED, UPPER_BOUND_VIOLATED!>T<Char><!>>()
|
||||
gest<T>()
|
||||
val c: List<List<List<<!TYPE_ARGUMENTS_NOT_ALLOWED!>T<String><!>>>>
|
||||
gest<List<List<<!TYPE_ARGUMENTS_NOT_ALLOWED, UPPER_BOUND_VIOLATED!>T<Boolean><!>>>>()
|
||||
}
|
||||
+49
@@ -0,0 +1,49 @@
|
||||
FILE: typeArgumentsNotAllowed.kt
|
||||
public abstract class Foo<T> : R|kotlin/Any| {
|
||||
public constructor<T>(): R|rest/Foo<T>| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
public abstract val x: <ERROR TYPE REF: Type arguments not allowed>
|
||||
public get(): <ERROR TYPE REF: Type arguments not allowed>
|
||||
|
||||
public abstract fun foo(): <ERROR TYPE REF: Type arguments not allowed>
|
||||
|
||||
}
|
||||
public final fun <T> foo(): R|kotlin/Unit| {
|
||||
R|rest/bar|<<ERROR TYPE REF: Type arguments not allowed>>()
|
||||
R|rest/bar|<<ERROR TYPE REF: Type arguments not allowed>>()
|
||||
}
|
||||
public final fun <T> bar(): R|kotlin/Unit| {
|
||||
}
|
||||
public final object Best : R|kotlin/Any| {
|
||||
private constructor(): R|rest/Best| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
}
|
||||
public final val a: <ERROR TYPE REF: Unresolved name: MyClass> = Q|rest|.<Unresolved name: MyClass>#
|
||||
public get(): <ERROR TYPE REF: Unresolved name: MyClass>
|
||||
public final val b: <ERROR TYPE REF: Unresolved name: MyClass> = Q|rest/Best|.<Unresolved name: MyClass>#
|
||||
public get(): <ERROR TYPE REF: Unresolved name: MyClass>
|
||||
public final class B<E> : R|kotlin/Any| {
|
||||
public constructor<E>(): R|rest/B<E>| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
}
|
||||
public final class C<F> : R|kotlin/Any| {
|
||||
public constructor<F>(): R|rest/C<F>| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
}
|
||||
public final fun <G> gest(): R|kotlin/Unit| {
|
||||
}
|
||||
public final fun <T> fest(): R|kotlin/Unit| {
|
||||
lval b: <ERROR TYPE REF: Type arguments not allowed>
|
||||
R|rest/gest|<<ERROR TYPE REF: Type arguments not allowed>>()
|
||||
R|rest/gest|<R|T|>()
|
||||
lval c: <ERROR TYPE REF: Type arguments not allowed>
|
||||
R|rest/gest|<<ERROR TYPE REF: Type arguments not allowed>>()
|
||||
}
|
||||
+2
-2
@@ -14,8 +14,8 @@ fun test() {
|
||||
val b1 = B<<!UPPER_BOUND_VIOLATED!>Int<!>>()
|
||||
val b2 = B<C>()
|
||||
val b3 = B<<!UPPER_BOUND_VIOLATED!>Any?<!>>()
|
||||
val b4 = B<UnexistingType>()
|
||||
val b5 = B<<!UPPER_BOUND_VIOLATED!>B<UnexistingType><!>>()
|
||||
val b4 = B<<!OTHER_ERROR, UPPER_BOUND_VIOLATED!>UnexistingType<!>>()
|
||||
val b5 = B<<!OTHER_ERROR, UPPER_BOUND_VIOLATED!>B<UnexistingType><!>>()
|
||||
fest<<!UPPER_BOUND_VIOLATED!>Boolean<!>>()
|
||||
fest<C>()
|
||||
fest<HHH>()
|
||||
|
||||
+2
-2
@@ -22,8 +22,8 @@ FILE: upperBoundViolated.kt
|
||||
lval b1: R|B<kotlin/Int>| = R|/B.B|<R|kotlin/Int|>()
|
||||
lval b2: R|B<C>| = R|/B.B|<R|C|>()
|
||||
lval b3: R|B<kotlin/Any?>| = R|/B.B|<R|kotlin/Any?|>()
|
||||
lval b4: R|B<A>| = R|/B.B|<R|A|>()
|
||||
lval b5: R|B<B<ERROR CLASS: Symbol not found, for `UnexistingType`>>| = R|/B.B|<R|B<ERROR CLASS: Symbol not found, for `UnexistingType`>|>()
|
||||
lval b4: R|B<A>| = R|/B.B|<<ERROR TYPE REF: Symbol not found, for `UnexistingType`>>()
|
||||
lval b5: R|B<A>| = R|/B.B|<<ERROR TYPE REF: Symbol not found, for `UnexistingType`>>()
|
||||
R|/fest|<R|kotlin/Boolean|>()
|
||||
R|/fest|<R|C|>()
|
||||
R|/fest|<R|C|>()
|
||||
|
||||
Reference in New Issue
Block a user