[FIR] Fix invalid diagnostic fir node sites and improved invalid type parameters count diagnostic report
This commit is contained in:
+4
-4
@@ -12,7 +12,7 @@ FILE: typeArgumentsNotAllowed.kt
|
||||
}
|
||||
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>>()
|
||||
R|rest/bar|<R|kotlin/collections/List<kotlin/collections/List<ERROR CLASS: Type arguments not allowed>>|>()
|
||||
}
|
||||
public final fun <T> bar(): R|kotlin/Unit| {
|
||||
}
|
||||
@@ -41,9 +41,9 @@ FILE: typeArgumentsNotAllowed.kt
|
||||
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>
|
||||
lval b: R|kotlin/collections/List<ERROR CLASS: 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>>()
|
||||
lval c: R|kotlin/collections/List<kotlin/collections/List<kotlin/collections/List<ERROR CLASS: Type arguments not allowed>>>|
|
||||
R|rest/gest|<R|kotlin/collections/List<kotlin/collections/List<ERROR CLASS: Type arguments not allowed>>|>()
|
||||
}
|
||||
|
||||
+1
-1
@@ -23,7 +23,7 @@ FILE: upperBoundViolated.kt
|
||||
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|<<ERROR TYPE REF: Symbol not found, for `UnexistingType`>>()
|
||||
lval b5: R|B<A>| = R|/B.B|<<ERROR TYPE REF: Symbol not found, for `UnexistingType`>>()
|
||||
lval b5: R|B<B<ERROR CLASS: Symbol not found, for `UnexistingType`>>| = R|/B.B|<R|B<ERROR CLASS: Symbol not found, for `UnexistingType`>|>()
|
||||
R|/fest|<R|kotlin/Boolean|>()
|
||||
R|/fest|<R|C|>()
|
||||
R|/fest|<R|C|>()
|
||||
|
||||
+1
-1
@@ -15,7 +15,7 @@ fun test() {
|
||||
val b2 = B<C>()
|
||||
val b3 = B<<!UPPER_BOUND_VIOLATED!>Any?<!>>()
|
||||
val b4 = B<<!UNRESOLVED_REFERENCE!>UnexistingType<!>>()
|
||||
val b5 = B<<!UNRESOLVED_REFERENCE!>B<UnexistingType><!>>()
|
||||
val b5 = B<<!UPPER_BOUND_VIOLATED!>B<<!UNRESOLVED_REFERENCE!>UnexistingType<!>><!>>()
|
||||
fest<<!UPPER_BOUND_VIOLATED!>Boolean<!>>()
|
||||
fest<C>()
|
||||
fest<HHH>()
|
||||
|
||||
@@ -18,11 +18,11 @@ FILE: typeParameterVsNested.kt
|
||||
|
||||
public abstract fun foo(arg: R|test/My.T<T>|): R|kotlin/Unit|
|
||||
|
||||
public abstract val y: <ERROR TYPE REF: Type argument not defined>
|
||||
public get(): <ERROR TYPE REF: Type argument not defined>
|
||||
public abstract val y: <ERROR TYPE REF: Wrong number of type arguments>
|
||||
public get(): <ERROR TYPE REF: Wrong number of type arguments>
|
||||
|
||||
public abstract val z: <ERROR TYPE REF: Type argument not defined>
|
||||
public get(): <ERROR TYPE REF: Type argument not defined>
|
||||
public abstract val z: <ERROR TYPE REF: Wrong number of type arguments>
|
||||
public get(): <ERROR TYPE REF: Wrong number of type arguments>
|
||||
|
||||
public final class Some : <ERROR TYPE REF: Type parameter cannot be a super-type: T> {
|
||||
public constructor(): R|test/My.Some| {
|
||||
|
||||
@@ -9,9 +9,9 @@ abstract class My<T : Some> {
|
||||
|
||||
abstract fun foo(arg: T)
|
||||
|
||||
abstract val y: My.T
|
||||
abstract val y: <!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>My.T<!>
|
||||
|
||||
abstract val z: test.My.T
|
||||
abstract val z: <!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>test.My.T<!>
|
||||
|
||||
class Some : <!UNRESOLVED_REFERENCE{LT}!><!OTHER_ERROR, UNRESOLVED_REFERENCE{PSI}!>T<!>()<!>
|
||||
}
|
||||
|
||||
Vendored
+1
-1
@@ -27,5 +27,5 @@ FILE: capturedParametersOfInnerClasses.kt
|
||||
}
|
||||
public final fun <R1, R2, R3> foo(c: R|A.B.C<R3, R3, R2, R2, R1, R1>|): R|kotlin/Unit| {
|
||||
}
|
||||
public final fun <R3> foo(c: <ERROR TYPE REF: Type argument not defined>): R|kotlin/Unit| {
|
||||
public final fun <R3> foo(c: <ERROR TYPE REF: Wrong number of type arguments>): R|kotlin/Unit| {
|
||||
}
|
||||
|
||||
+1
-1
@@ -10,4 +10,4 @@ class A<T1, T2> {
|
||||
|
||||
fun <R1, R2, R3> foo(c: A<R1, R1>.B<R2, R2>.C<R3, R3>) {}
|
||||
|
||||
fun <R3> foo(c: A.B.C<R3, R3>) {}
|
||||
fun <R3> foo(c: <!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>A.B.C<R3, R3><!>) {}
|
||||
|
||||
+14
-8
@@ -114,23 +114,29 @@ class FirTypeResolverImpl(private val session: FirSession) : FirTypeResolver() {
|
||||
val isPossibleBareType = areBareTypesAllowed && typeArguments.isEmpty()
|
||||
if (typeArguments.size != symbol.fir.typeParameters.size && !isPossibleBareType) {
|
||||
@Suppress("NAME_SHADOWING")
|
||||
val substitutor = substitutor ?: ConeSubstitutor.Empty
|
||||
val n = symbol.fir.typeParameters.size - typeArguments.size
|
||||
if (n < 0) {
|
||||
typeArguments = (1..symbol.fir.typeParameters.size).map {
|
||||
ConeClassErrorType(ConeWrongNumberOfTypeArgumentsError(typeArguments.size, symbol))
|
||||
}.toTypedArray()
|
||||
if (symbol.fir.typeParameters.size < typeArguments.size) {
|
||||
return ConeClassErrorType(ConeWrongNumberOfTypeArgumentsError(symbol.fir.typeParameters.size, symbol))
|
||||
} else {
|
||||
val argumentsFromOuterClassesAndParents = symbol.fir.typeParameters.takeLast(n).map {
|
||||
val substitutor = substitutor ?: ConeSubstitutor.Empty
|
||||
val argumentsFromOuterClassesAndParents = symbol.fir.typeParameters.drop(typeArguments.size).mapNotNull {
|
||||
val type = ConeTypeParameterTypeImpl(ConeTypeParameterLookupTag(it.symbol), isNullable = false)
|
||||
// we should report ConeSimpleDiagnostic(..., WrongNumberOfTypeArguments)
|
||||
// but genericArgumentNumberMismatch.kt test fails with
|
||||
// index out of bounds exception for start offset of
|
||||
// the source
|
||||
substitutor.substituteOrNull(type)
|
||||
?: ConeClassErrorType(ConeIntermediateDiagnostic("Type argument not defined"))
|
||||
|
||||
}.toTypedArray<ConeTypeProjection>()
|
||||
typeArguments += argumentsFromOuterClassesAndParents
|
||||
|
||||
if (typeArguments.size != symbol.fir.typeParameters.size) {
|
||||
return ConeClassErrorType(
|
||||
ConeWrongNumberOfTypeArgumentsError(
|
||||
desiredCount = symbol.fir.typeParameters.size - argumentsFromOuterClassesAndParents.size,
|
||||
type = symbol
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -236,6 +236,7 @@ fun FirTypeRef.withReplacedConeType(
|
||||
this@withReplacedConeType.source
|
||||
type = newType
|
||||
annotations += this@withReplacedConeType.annotations
|
||||
delegatedTypeRef = this@withReplacedConeType.delegatedTypeRef
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -29,12 +29,10 @@ internal class FirErrorTypeRefImpl(
|
||||
|
||||
override fun <R, D> acceptChildren(visitor: FirVisitor<R, D>, data: D) {
|
||||
annotations.forEach { it.accept(visitor, data) }
|
||||
delegatedTypeRef?.accept(visitor, data)
|
||||
}
|
||||
|
||||
override fun <D> transformChildren(transformer: FirTransformer<D>, data: D): FirErrorTypeRefImpl {
|
||||
transformAnnotations(transformer, data)
|
||||
delegatedTypeRef = delegatedTypeRef?.transformSingle(transformer, data)
|
||||
return this
|
||||
}
|
||||
|
||||
|
||||
@@ -859,7 +859,7 @@ class FirRenderer(builder: StringBuilder, private val mode: RenderMode = RenderM
|
||||
}
|
||||
|
||||
override fun visitErrorTypeRef(errorTypeRef: FirErrorTypeRef) {
|
||||
visitTypeRef(errorTypeRef)
|
||||
errorTypeRef.annotations.renderAnnotations()
|
||||
print("<ERROR TYPE REF: ${errorTypeRef.diagnostic.reason}>")
|
||||
}
|
||||
|
||||
|
||||
@@ -26,14 +26,7 @@ fun FirClassifierSymbol<*>.constructType(
|
||||
ConeTypeParameterTypeImpl(this.toLookupTag(), isNullable, attributes)
|
||||
}
|
||||
is FirClassSymbol -> {
|
||||
val errorTypeRef = typeArguments.find {
|
||||
it is ConeClassErrorType
|
||||
}
|
||||
if (errorTypeRef is ConeClassErrorType) {
|
||||
ConeClassErrorType(errorTypeRef.diagnostic)
|
||||
} else {
|
||||
ConeClassLikeTypeImpl(this.toLookupTag(), typeArguments, isNullable, attributes)
|
||||
}
|
||||
ConeClassLikeTypeImpl(this.toLookupTag(), typeArguments, isNullable, attributes)
|
||||
}
|
||||
is FirTypeAliasSymbol -> {
|
||||
ConeClassLikeTypeImpl(
|
||||
|
||||
+3
@@ -172,6 +172,9 @@ object ImplementationConfigurator : AbstractFirTreeImplementationConfigurator()
|
||||
default("type", "ConeClassErrorType(diagnostic)")
|
||||
default("annotations", "mutableListOf()")
|
||||
useTypes(coneClassErrorTypeType)
|
||||
default("delegatedTypeRef") {
|
||||
needAcceptAndTransform = false
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -30,17 +30,17 @@ class MyColor(val x: <!UNRESOLVED_REFERENCE!>Color.RED<!>, y: <!UNRESOLVED_REFER
|
||||
}
|
||||
}
|
||||
|
||||
fun create(): <!UNRESOLVED_REFERENCE!>Array<Color.RED>?<!> = null
|
||||
fun create(): Array<<!UNRESOLVED_REFERENCE!>Color.RED<!>>? = null
|
||||
|
||||
interface Your<T : <!UNRESOLVED_REFERENCE!>Color.RED<!>>
|
||||
|
||||
class His : <!UNRESOLVED_REFERENCE!>Your<Color.RED><!>
|
||||
class His : Your<<!UNRESOLVED_REFERENCE!>Color.RED<!>>
|
||||
|
||||
fun <T : <!UNRESOLVED_REFERENCE!>Color.RED<!>> otherCreate(): Array<T>? = null
|
||||
|
||||
typealias RedAlias = <!UNRESOLVED_REFERENCE!>Color.RED<!>
|
||||
|
||||
typealias ArrayOfEnumEntry = <!UNRESOLVED_REFERENCE!>Array<Color.RED><!>
|
||||
typealias ArrayOfEnumEntry = Array<<!UNRESOLVED_REFERENCE!>Color.RED<!>>
|
||||
|
||||
typealias ArrayOfEnumEntryAlias = Array<RedAlias>
|
||||
|
||||
@@ -52,4 +52,4 @@ fun <T> foo() {
|
||||
<!INAPPLICABLE_CANDIDATE!>bar<!><<!UNRESOLVED_REFERENCE!>Color.RED<!>>(Color.RED)
|
||||
}
|
||||
|
||||
fun <!UNRESOLVED_REFERENCE!>Array<Color.RED><!>.foo(entries: <!UNRESOLVED_REFERENCE!>Array<Color.RED><!>): <!UNRESOLVED_REFERENCE!>Array<Color.RED><!> = null!!
|
||||
fun Array<<!UNRESOLVED_REFERENCE!>Color.RED<!>>.foo(entries: Array<<!UNRESOLVED_REFERENCE!>Color.RED<!>>): Array<<!UNRESOLVED_REFERENCE!>Color.RED<!>> = null!!
|
||||
+2
-2
@@ -3,8 +3,8 @@ package unresolved
|
||||
class Pair<A, B>(val a: A, val b: B)
|
||||
|
||||
fun testGenericArgumentsCount() {
|
||||
val p1: Pair<Int> = Pair(2, 2)
|
||||
val p2: Pair = Pair(2, 2)
|
||||
val p1: <!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>Pair<Int><!> = Pair(2, 2)
|
||||
val p2: <!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>Pair<!> = Pair(2, 2)
|
||||
}
|
||||
|
||||
fun testUnresolved() {
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
interface B<T>
|
||||
interface G<T>: B<T>
|
||||
|
||||
fun f(p: <!UNRESOLVED_REFERENCE!>B<Foo><!>): Any {
|
||||
fun f(p: B<<!UNRESOLVED_REFERENCE!>Foo<!>>): Any {
|
||||
val v = p as G
|
||||
return checkSubtype<G<*>>(v)
|
||||
}
|
||||
@@ -4,4 +4,4 @@
|
||||
interface Tr
|
||||
interface G<T>
|
||||
|
||||
fun test(tr: Tr) = <!INAPPLICABLE_CANDIDATE!>checkSubtype<!><G>(tr)
|
||||
fun test(tr: Tr) = <!INAPPLICABLE_CANDIDATE!>checkSubtype<!><<!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>G<!>>(tr)
|
||||
@@ -1,9 +0,0 @@
|
||||
// !LANGUAGE: +BareArrayClassLiteral
|
||||
|
||||
val a01 = Array::class
|
||||
val a02 = Array<Array>::class
|
||||
val a03 = Array<Any?>::class
|
||||
val a04 = Array<Array<Any?>?>::class
|
||||
val a05 = Array<IntArray?>::class
|
||||
val a06 = kotlin.Array::class
|
||||
val a07 = kotlin.Array<IntArray?>::class
|
||||
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
// !LANGUAGE: +BareArrayClassLiteral
|
||||
|
||||
val a01 = Array::class
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package p
|
||||
|
||||
public fun foo(a: Any) {
|
||||
a is Map<Int>
|
||||
a is <!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>Map<Int><!>
|
||||
a is <!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>Map<!>
|
||||
a is Map<out Any?, Any?>
|
||||
a is Map<*, *>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
public fun foo(a: Any, b: Map) {
|
||||
public fun foo(a: Any, b: <!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>Map<!>) {
|
||||
when (a) {
|
||||
is Map<Int> -> {}
|
||||
is <!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>Map<Int><!> -> {}
|
||||
is <!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>Map<!> -> {}
|
||||
is Map<out Any?, Any?> -> {}
|
||||
is Map<*, *> -> {}
|
||||
|
||||
+1
-1
@@ -55,7 +55,7 @@ object MessageManager10 : <!UNRESOLVED_REFERENCE!>Message5<Int><!>() {
|
||||
fun <T : Int> execute() {}
|
||||
}
|
||||
|
||||
class MessageManager11<A> : <!UNRESOLVED_REFERENCE!>Message5<Message5<A>><!>() {
|
||||
class MessageManager11<A> : <!UNRESOLVED_REFERENCE!>Message5<<!UNRESOLVED_REFERENCE!>Message5<A><!>><!>() {
|
||||
fun <T : <!UNRESOLVED_REFERENCE!>Message5<A><!>> execute() {}
|
||||
}
|
||||
|
||||
|
||||
@@ -23,13 +23,13 @@ fun test() {
|
||||
Foo<String>.Bar.Baz::class
|
||||
|
||||
a<Foo<String>.Bar>()
|
||||
a<Foo<String>.Bar.Baz>()
|
||||
a<<!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>Foo<String>.Bar.Baz<!>>()
|
||||
|
||||
a<Foo.Bar<Int>>()
|
||||
a<Foo.Bar<Int>.Baz>()
|
||||
a<<!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>Foo.Bar<Int>.Baz<!>>()
|
||||
}
|
||||
|
||||
fun <T: <!UNRESOLVED_REFERENCE!>Foo<String.Bar><!>> x() {}
|
||||
fun <T: Foo<<!UNRESOLVED_REFERENCE!>String.Bar<!>>> x() {}
|
||||
fun Foo<String>.Bar.ext() {}
|
||||
|
||||
fun ex1(a: <!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>Foo<String>.Bar<String><!>): <!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>Foo<String>.Bar<String><!> {
|
||||
|
||||
@@ -15,6 +15,6 @@ class Outer<E> {
|
||||
fun bare(x: Outer<*>.Inner<*, *>.Inner2Base, y: Outer<*>.Inner<*, *>.Inner3Base<Int>) {
|
||||
if (x is Outer.Inner.Inner2) return
|
||||
if (y is Outer.Inner.Inner3) return
|
||||
if (y is Outer<String>.Inner.Inner3) return
|
||||
if (y is Outer.Inner<String, Int>.Inner3<Double>) return
|
||||
if (y is <!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>Outer<String>.Inner.Inner3<!>) return
|
||||
if (y is <!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>Outer.Inner<String, Int>.Inner3<Double><!>) return
|
||||
}
|
||||
|
||||
+2
-2
@@ -10,7 +10,7 @@ private fun <E> foobar() = {
|
||||
fun a() = A<E, X, Y, Z>()
|
||||
}
|
||||
|
||||
typealias LocalAlias<W> = <!UNRESOLVED_REFERENCE!>A<E, X, Y, W><!>
|
||||
typealias LocalAlias<W> = A<<!UNRESOLVED_REFERENCE!>E<!>, <!UNRESOLVED_REFERENCE!>X<!>, <!UNRESOLVED_REFERENCE!>Y<!>, <!UNRESOLVED_REFERENCE!>W<!>>
|
||||
}
|
||||
|
||||
class Derived : LocalOuter<Double, Short>() {
|
||||
@@ -27,7 +27,7 @@ private fun noParameters() = {
|
||||
fun a() = A<Any, X, Y, Z>()
|
||||
}
|
||||
|
||||
typealias LocalAlias2<W> = <!UNRESOLVED_REFERENCE!>A<Any, X, Y, W><!>
|
||||
typealias LocalAlias2<W> = A<<!UNRESOLVED_REFERENCE!>Any<!>, <!UNRESOLVED_REFERENCE!>X<!>, <!UNRESOLVED_REFERENCE!>Y<!>, <!UNRESOLVED_REFERENCE!>W<!>>
|
||||
}
|
||||
|
||||
class Derived2 : LocalOuter2<Double, Short>() {
|
||||
|
||||
+2
-2
@@ -12,7 +12,7 @@ class Outer<T> {
|
||||
fun a() = A<T, F, E, X, Y, Z>()
|
||||
}
|
||||
|
||||
typealias LocalAlias<W> = <!UNRESOLVED_REFERENCE!>A<T, F, E, X, Y, W><!>
|
||||
typealias LocalAlias<W> = A<<!UNRESOLVED_REFERENCE!>T<!>, <!UNRESOLVED_REFERENCE!>F<!>, <!UNRESOLVED_REFERENCE!>E<!>, <!UNRESOLVED_REFERENCE!>X<!>, <!UNRESOLVED_REFERENCE!>Y<!>, <!UNRESOLVED_REFERENCE!>W<!>>
|
||||
}
|
||||
|
||||
class Derived : LocalOuter<Double, Short>() {
|
||||
@@ -29,7 +29,7 @@ class Outer<T> {
|
||||
fun a() = A<T, F, Any, X, Y, Z>()
|
||||
}
|
||||
|
||||
typealias LocalAlias2<W> = <!UNRESOLVED_REFERENCE!>A<T, F, Any, X, Y, W><!>
|
||||
typealias LocalAlias2<W> = A<<!UNRESOLVED_REFERENCE!>T<!>, <!UNRESOLVED_REFERENCE!>F<!>, <!UNRESOLVED_REFERENCE!>Any<!>, <!UNRESOLVED_REFERENCE!>X<!>, <!UNRESOLVED_REFERENCE!>Y<!>, <!UNRESOLVED_REFERENCE!>W<!>>
|
||||
}
|
||||
|
||||
class Derived2 : LocalOuter2<Double, Short>() {
|
||||
|
||||
+1
-1
@@ -17,4 +17,4 @@ class Outer<E> {
|
||||
|
||||
class E
|
||||
|
||||
fun bar(x: Inner) {}
|
||||
fun bar(x: <!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>Inner<!>) {}
|
||||
|
||||
+3
-3
@@ -15,9 +15,9 @@ class A<T> {
|
||||
val y: B<String>.C<String>? = null
|
||||
val z: B<String>.D? = null
|
||||
|
||||
val c: C<Int>? = null
|
||||
val d: D? = null
|
||||
val c: <!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>C<Int>?<!> = null
|
||||
val d: <!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>D?<!> = null
|
||||
|
||||
val innerMost: Innermost<String>? = null
|
||||
val innerMost: <!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>Innermost<String>?<!> = null
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -4,7 +4,7 @@
|
||||
|
||||
class Outer<T> {
|
||||
inner class Inner
|
||||
fun foo(x: Outer<String>.Inner, y: Outer.Inner, z: Inner) {
|
||||
fun foo(x: Outer<String>.Inner, y: <!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>Outer.Inner<!>, z: Inner) {
|
||||
var inner = Inner()
|
||||
x.checkType { <!INAPPLICABLE_CANDIDATE!>_<!><Inner>() }
|
||||
x.checkType { _<Outer<String>.Inner>() }
|
||||
|
||||
+1
-1
@@ -42,7 +42,7 @@ fun errorTypeWithArguments(): <!UNRESOLVED_REFERENCE!>Q<A>.W<B, C, D>.R.M<!> = n
|
||||
|
||||
fun error1(): Outer<A>.Inner<B>.Inner3<C, D> = null!!
|
||||
fun error2(): <!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>Outer<A>.Inner<B, C, D>.Inner2<!> = null!!
|
||||
fun error3(): Outer.Inner<A, B>.Inner3<C> = null!!
|
||||
fun error3(): <!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>Outer.Inner<A, B>.Inner3<C><!> = null!!
|
||||
|
||||
fun error4(): <!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>Outer<A>.Nested<B>.Inner4<C><!> = null!!
|
||||
fun error5(): <!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>Outer<A>.Obj.Nested2<B>.Inner5<C><!> = null!!
|
||||
|
||||
+10
-10
@@ -1,19 +1,19 @@
|
||||
class A
|
||||
interface I0<T : A<Int>>
|
||||
interface I1<T> where T : A<Int>
|
||||
interface I2<T : A<Int>> where T : A<Int>
|
||||
interface I0<T : <!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>A<Int><!>>
|
||||
interface I1<T> where T : <!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>A<Int><!>
|
||||
interface I2<T : <!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>A<Int><!>> where T : <!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>A<Int><!>
|
||||
|
||||
fun <E : A<Int>> foo0() {}
|
||||
fun <E> foo1() where E : A<Int> {}
|
||||
fun <E : A<Int>> foo2() where E : A<Int> {}
|
||||
fun <E : <!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>A<Int><!>> foo0() {}
|
||||
fun <E> foo1() where E : <!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>A<Int><!> {}
|
||||
fun <E : <!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>A<Int><!>> foo2() where E : <!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>A<Int><!> {}
|
||||
|
||||
val <E : A<Int>> E.p1: Int
|
||||
val <E : <!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>A<Int><!>> E.p1: Int
|
||||
get() = 1
|
||||
val <E> E.p2: Int where E : A<Int>
|
||||
val <E> E.p2: Int where E : <!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>A<Int><!>
|
||||
get() = 1
|
||||
val <E : A<Int>> E.p3: Int where E : A<Int>
|
||||
val <E : <!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>A<Int><!>> E.p3: Int where E : <!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>A<Int><!>
|
||||
get() = 1
|
||||
|
||||
// See KT-8200
|
||||
interface X
|
||||
public class EnumAttribute<T : X<T>>(val klass: Class<T>) where T : Enum<T>
|
||||
public class EnumAttribute<T : <!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>X<T><!>>(val klass: Class<T>) where T : Enum<T>
|
||||
|
||||
+1
-1
@@ -19,7 +19,7 @@ fun test1() {
|
||||
}
|
||||
}
|
||||
|
||||
fun test2(l: <!UNRESOLVED_REFERENCE!>List<AA><!>) {
|
||||
fun test2(l: List<<!UNRESOLVED_REFERENCE!>AA<!>>) {
|
||||
l.<!UNRESOLVED_REFERENCE!>map<!> {
|
||||
<!UNRESOLVED_REFERENCE!>it<!>!!
|
||||
}
|
||||
|
||||
+5
-5
@@ -8,14 +8,14 @@ fun <T> consume(x: Foo<out T>, y: Foo<out T>) {}
|
||||
fun <T> materialize() = null as T
|
||||
|
||||
fun test() {
|
||||
<!INAPPLICABLE_CANDIDATE!>consume<!>(
|
||||
materialize<<!UNRESOLVED_REFERENCE!>Foo<Bar<ErrorType>><!>>(),
|
||||
materialize<<!UNRESOLVED_REFERENCE!>Foo<Bar<ErrorType>><!>>()
|
||||
consume(
|
||||
materialize<Foo<Bar<<!UNRESOLVED_REFERENCE!>ErrorType<!>>>>(),
|
||||
materialize<Foo<Bar<<!UNRESOLVED_REFERENCE!>ErrorType<!>>>>()
|
||||
)
|
||||
|
||||
<!INAPPLICABLE_CANDIDATE!>consume<!>(
|
||||
materialize<<!UNRESOLVED_REFERENCE!>Foo<Bar<ErrorType>><!>>(),
|
||||
materialize<<!UNRESOLVED_REFERENCE!>Foo<ErrorType><!>>()
|
||||
materialize<Foo<Bar<<!UNRESOLVED_REFERENCE!>ErrorType<!>>>>(),
|
||||
materialize<Foo<<!UNRESOLVED_REFERENCE!>ErrorType<!>>>()
|
||||
)
|
||||
|
||||
}
|
||||
|
||||
@@ -3,11 +3,11 @@ interface P<U, Y>
|
||||
class A<T> {
|
||||
class B {
|
||||
fun test() {
|
||||
class C<W>() : <!UNRESOLVED_REFERENCE!>P<W, T><!> {
|
||||
companion object : <!UNRESOLVED_REFERENCE!>P<W, T><!> {
|
||||
class C<W>() : P<W, <!UNRESOLVED_REFERENCE!>T<!>> {
|
||||
companion object : P<W, <!UNRESOLVED_REFERENCE!>T<!>> {
|
||||
}
|
||||
|
||||
inner class D : <!UNRESOLVED_REFERENCE!>P<W, T><!>
|
||||
inner class D : P<W, <!UNRESOLVED_REFERENCE!>T<!>>
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+2
-2
@@ -6,7 +6,7 @@ package p
|
||||
|
||||
public class A<X, Y>
|
||||
public class M1 {
|
||||
public val a: A<Int> = A<Int, Int>()
|
||||
public val a: <!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>A<Int><!> = A<Int, Int>()
|
||||
}
|
||||
|
||||
// MODULE: m2
|
||||
@@ -16,7 +16,7 @@ package p
|
||||
|
||||
public class A<X, Y>
|
||||
|
||||
public fun foo(a: A<Int>) {
|
||||
public fun foo(a: <!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>A<Int><!>) {
|
||||
}
|
||||
|
||||
// MODULE: m3(m1, m2)
|
||||
|
||||
Vendored
+2
-2
@@ -3,5 +3,5 @@ interface G<T> {
|
||||
val bar: Int
|
||||
}
|
||||
|
||||
fun G.foo() {}
|
||||
val G.bar: Int get() = 42
|
||||
fun <!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>G<!>.foo() {}
|
||||
val <!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>G<!>.bar: Int get() = 42
|
||||
+1
-1
@@ -1,3 +1,3 @@
|
||||
class B {}
|
||||
|
||||
val b : B<*> = 1
|
||||
val b : <!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>B<*><!> = 1
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
class Class1<T : <!UNRESOLVED_REFERENCE!>Class2<Class1<X>><!>>
|
||||
class Class1<T : Class2<Class1<<!UNRESOLVED_REFERENCE!>X<!>>>>
|
||||
|
||||
class Class2<T : <!UNRESOLVED_REFERENCE!>Class1<Class2<X>><!>>
|
||||
class Class2<T : Class1<Class2<<!UNRESOLVED_REFERENCE!>X<!>>>>
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
interface I<F, G, H>
|
||||
|
||||
class A(impl: Interface) : <!UNRESOLVED_REFERENCE!>Nested<!>(), <!UNRESOLVED_REFERENCE!>Interface<!> by impl, <!UNRESOLVED_REFERENCE!>Inner<!>, <!UNRESOLVED_REFERENCE!>I<Nested, Interface, Inner><!> {
|
||||
class A(impl: Interface) : <!UNRESOLVED_REFERENCE!>Nested<!>(), <!UNRESOLVED_REFERENCE!>Interface<!> by impl, <!UNRESOLVED_REFERENCE!>Inner<!>, I<<!UNRESOLVED_REFERENCE!>Nested<!>, <!UNRESOLVED_REFERENCE!>Interface<!>, <!UNRESOLVED_REFERENCE!>Inner<!>> {
|
||||
|
||||
class Nested
|
||||
|
||||
|
||||
+1
-1
@@ -3,7 +3,7 @@ interface I<F, G>
|
||||
val aImpl: A.Interface
|
||||
get() = null!!
|
||||
|
||||
object A : <!UNRESOLVED_REFERENCE!>Nested<!>(), <!UNRESOLVED_REFERENCE!>Interface<!> by aImpl, <!UNRESOLVED_REFERENCE!>I<Nested, Interface><!> {
|
||||
object A : <!UNRESOLVED_REFERENCE!>Nested<!>(), <!UNRESOLVED_REFERENCE!>Interface<!> by aImpl, I<<!UNRESOLVED_REFERENCE!>Nested<!>, <!UNRESOLVED_REFERENCE!>Interface<!>> {
|
||||
|
||||
class Nested
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
//KT-304: Resolve supertype reference to class anyway
|
||||
|
||||
open class Foo() : Bar() {
|
||||
open class Foo() : <!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>Bar<!>() {
|
||||
}
|
||||
|
||||
open class Bar<T>() {
|
||||
|
||||
@@ -50,7 +50,7 @@ class CG : G<Int> {
|
||||
fun test() {
|
||||
super<G>.foo() // OK
|
||||
super<G<Int>>.foo() // Warning
|
||||
super<G<E>>.<!UNRESOLVED_REFERENCE!>foo<!>() // Error
|
||||
super<G<E>>.foo() // Error
|
||||
super<G<String>>.foo() // Error
|
||||
}
|
||||
}
|
||||
|
||||
+4
-4
@@ -17,13 +17,13 @@ class Outer<TO> {
|
||||
|
||||
fun <TF> foo() {
|
||||
class Local<TL> {
|
||||
typealias LTF = <!UNRESOLVED_REFERENCE!>List<TF><!>
|
||||
typealias LTL = <!UNRESOLVED_REFERENCE!>List<TL><!>
|
||||
typealias LTF = <!UNRESOLVED_REFERENCE!>List<<!UNRESOLVED_REFERENCE!>TF<!>><!>
|
||||
typealias LTL = <!UNRESOLVED_REFERENCE!>List<<!UNRESOLVED_REFERENCE!>TL<!>><!>
|
||||
}
|
||||
|
||||
fun <TLF> localfun() =
|
||||
object {
|
||||
typealias LTF = <!UNRESOLVED_REFERENCE!>List<TF><!>
|
||||
typealias LTLF = <!UNRESOLVED_REFERENCE!>List<TLF><!>
|
||||
typealias LTF = List<<!UNRESOLVED_REFERENCE!>TF<!>>
|
||||
typealias LTLF = List<<!UNRESOLVED_REFERENCE!>TLF<!>>
|
||||
}
|
||||
}
|
||||
|
||||
+5
-5
@@ -38,9 +38,9 @@ val testNested2: <!UNRESOLVED_REFERENCE!>KT.Nested<!> = KT.<!UNRESOLVED_REFERENC
|
||||
val testNested3: <!UNRESOLVED_REFERENCE!>IT.Nested<!> = IT.<!UNRESOLVED_REFERENCE!>Nested<!>()
|
||||
val testInner1: <!UNRESOLVED_REFERENCE!>JT.Inner<!> = JT.<!UNRESOLVED_REFERENCE!>Inner<!>()
|
||||
val testInner2: <!UNRESOLVED_REFERENCE!>KT.Inner<!> = KT.<!UNRESOLVED_REFERENCE!>Inner<!>()
|
||||
fun testNestedAsTypeArgument1(x: <!UNRESOLVED_REFERENCE!>List<JT.Nested><!>) {}
|
||||
fun testNestedAsTypeArgument2(x: <!UNRESOLVED_REFERENCE!>List<KT.Nested><!>) {}
|
||||
fun testNestedAsTypeArgument3(x: <!UNRESOLVED_REFERENCE!>List<IT.Nested><!>) {}
|
||||
fun testInnerAsTypeArgument1(x: <!UNRESOLVED_REFERENCE!>List<JT.Inner><!>) {}
|
||||
fun testInnerAsTypeArgument2(x: <!UNRESOLVED_REFERENCE!>List<KT.Inner><!>) {}
|
||||
fun testNestedAsTypeArgument1(x: List<<!UNRESOLVED_REFERENCE!>JT.Nested<!>>) {}
|
||||
fun testNestedAsTypeArgument2(x: List<<!UNRESOLVED_REFERENCE!>KT.Nested<!>>) {}
|
||||
fun testNestedAsTypeArgument3(x: List<<!UNRESOLVED_REFERENCE!>IT.Nested<!>>) {}
|
||||
fun testInnerAsTypeArgument1(x: List<<!UNRESOLVED_REFERENCE!>JT.Inner<!>>) {}
|
||||
fun testInnerAsTypeArgument2(x: List<<!UNRESOLVED_REFERENCE!>KT.Inner<!>>) {}
|
||||
|
||||
|
||||
+2
-2
@@ -2,6 +2,6 @@
|
||||
|
||||
fun outer() {
|
||||
typealias Test1 = <!UNRESOLVED_REFERENCE!>Test1<!>
|
||||
typealias Test2 = <!UNRESOLVED_REFERENCE!>List<Test2><!>
|
||||
typealias Test3<T> = <!UNRESOLVED_REFERENCE!>List<Test3<T>><!>
|
||||
typealias Test2 = List<<!UNRESOLVED_REFERENCE!>Test2<!>>
|
||||
typealias Test3<T> = List<<!UNRESOLVED_REFERENCE!>Test3<<!UNRESOLVED_REFERENCE!>T<!>><!>>
|
||||
}
|
||||
@@ -41,10 +41,10 @@ interface Test<in I, out O, P> {
|
||||
fun neOk11(i: Inv<in I>)
|
||||
fun neOk12(i: Inv<out O>)
|
||||
|
||||
fun neOk30(i: Pair<O, >)
|
||||
fun neOk31(i: Pair<O, Inv>)
|
||||
fun neOk32(i: Inv)
|
||||
fun neOk30(i: <!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>Pair<O, ><!>)
|
||||
fun neOk31(i: Pair<O, <!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>Inv<!>>)
|
||||
fun neOk32(i: <!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>Inv<!>)
|
||||
fun neOk33(i: Inv<<!SYNTAX!><!>>)
|
||||
fun neOk34(i: <!UNRESOLVED_REFERENCE!>Inv<C><!>)
|
||||
fun neOk34(i: Inv<<!UNRESOLVED_REFERENCE!>C<!>>)
|
||||
fun neOk35(i: <!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>Inv<P, P><!>)
|
||||
}
|
||||
|
||||
@@ -38,10 +38,10 @@ interface Test<in I, out O, P> {
|
||||
var neOk22: Inv<out O>
|
||||
var neOk23: Inv<out I>
|
||||
|
||||
var neOk30: Pair<I, >
|
||||
var neOk31: Pair<I, Inv>
|
||||
var neOk32: Inv
|
||||
var neOk30: <!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>Pair<I, ><!>
|
||||
var neOk31: Pair<I, <!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>Inv<!>>
|
||||
var neOk32: <!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>Inv<!>
|
||||
var neOk33: Inv<<!SYNTAX!><!>>
|
||||
var neOk34: <!UNRESOLVED_REFERENCE!>Inv<C><!>
|
||||
var neOk34: Inv<<!UNRESOLVED_REFERENCE!>C<!>>
|
||||
var neOk35: <!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>Inv<P, P><!>
|
||||
}
|
||||
|
||||
@@ -33,10 +33,10 @@ interface Test<in I, out O, P> {
|
||||
fun neOk10(): Inv<in O>
|
||||
fun neOk11(): Inv<out I>
|
||||
|
||||
fun neOk30(): Pair<I, >
|
||||
fun neOk31(): Pair<I, Inv>
|
||||
fun neOk32(): Inv
|
||||
fun neOk30(): <!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>Pair<I, ><!>
|
||||
fun neOk31(): Pair<I, <!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>Inv<!>>
|
||||
fun neOk32(): <!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>Inv<!>
|
||||
fun neOk33(): Inv<<!SYNTAX!><!>>
|
||||
fun neOk34(): <!UNRESOLVED_REFERENCE!>Inv<C><!>
|
||||
fun neOk34(): Inv<<!UNRESOLVED_REFERENCE!>C<!>>
|
||||
fun neOk35(): <!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>Inv<P, P><!>
|
||||
}
|
||||
|
||||
+1
-1
@@ -10,6 +10,6 @@ package kotlin.sequences
|
||||
import p.*
|
||||
|
||||
interface I {
|
||||
val v1: FilteringSequence
|
||||
val v1: <!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>FilteringSequence<!>
|
||||
val <!EXPOSED_PROPERTY_TYPE!>v2<!>: IndexingSequence<String>
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
data class A(val x: <!UNRESOLVED_REFERENCE!>Set<CLassNotFound><!> = setOf()) {
|
||||
fun with(x: <!UNRESOLVED_REFERENCE!>Set<CLassNotFound>?<!> = null) {
|
||||
data class A(val x: Set<<!UNRESOLVED_REFERENCE!>CLassNotFound<!>> = setOf()) {
|
||||
fun with(x: Set<<!UNRESOLVED_REFERENCE!>CLassNotFound<!>>? = null) {
|
||||
A(x ?: this.x)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user