[FIR] Report errors about type arguments on resolved qualifiers

^KT-56186 Fixed
^KT-56187 Fixed
^KT-59553
This commit is contained in:
Dmitriy Novozhilov
2023-06-08 13:50:16 +03:00
committed by Space Team
parent 1b24b95cde
commit 6c7eb0167c
20 changed files with 730 additions and 27 deletions
@@ -3322,6 +3322,12 @@ public class DiagnosticCompilerTestFE10TestdataTestGenerated extends AbstractDia
runTest("compiler/testData/diagnostics/tests/callableReference/genericCallWithReferenceAgainstVarargAndKFunction.kt");
}
@Test
@TestMetadata("genericTypealiasInLhs.kt")
public void testGenericTypealiasInLhs() throws Exception {
runTest("compiler/testData/diagnostics/tests/callableReference/genericTypealiasInLhs.kt");
}
@Test
@TestMetadata("kt15439_completeCall.kt")
public void testKt15439_completeCall() throws Exception {
@@ -4039,6 +4045,12 @@ public class DiagnosticCompilerTestFE10TestdataTestGenerated extends AbstractDia
runTest("compiler/testData/diagnostics/tests/callableReference/generic/argumentExpectedType.kt");
}
@Test
@TestMetadata("boundViolated.kt")
public void testBoundViolated() throws Exception {
runTest("compiler/testData/diagnostics/tests/callableReference/generic/boundViolated.kt");
}
@Test
@TestMetadata("dependOnArgumentType.kt")
public void testDependOnArgumentType() throws Exception {
@@ -4069,6 +4081,12 @@ public class DiagnosticCompilerTestFE10TestdataTestGenerated extends AbstractDia
runTest("compiler/testData/diagnostics/tests/callableReference/generic/genericFunctionsWithNullableTypes.kt");
}
@Test
@TestMetadata("incorrectNumberOfTypeArguments.kt")
public void testIncorrectNumberOfTypeArguments() throws Exception {
runTest("compiler/testData/diagnostics/tests/callableReference/generic/incorrectNumberOfTypeArguments.kt");
}
@Test
@TestMetadata("kt10968.kt")
public void testKt10968() throws Exception {
@@ -5374,6 +5392,12 @@ public class DiagnosticCompilerTestFE10TestdataTestGenerated extends AbstractDia
runTest("compiler/testData/diagnostics/tests/classLiteral/nonClassesOnLHS.kt");
}
@Test
@TestMetadata("parameterizedTypeAlias.kt")
public void testParameterizedTypeAlias() throws Exception {
runTest("compiler/testData/diagnostics/tests/classLiteral/parameterizedTypeAlias.kt");
}
@Test
@TestMetadata("qualifiedClassLiteral.kt")
public void testQualifiedClassLiteral() throws Exception {
@@ -3322,6 +3322,12 @@ public class LLFirPreresolvedReversedDiagnosticCompilerFE10TestDataTestGenerated
runTest("compiler/testData/diagnostics/tests/callableReference/genericCallWithReferenceAgainstVarargAndKFunction.kt");
}
@Test
@TestMetadata("genericTypealiasInLhs.kt")
public void testGenericTypealiasInLhs() throws Exception {
runTest("compiler/testData/diagnostics/tests/callableReference/genericTypealiasInLhs.kt");
}
@Test
@TestMetadata("kt15439_completeCall.kt")
public void testKt15439_completeCall() throws Exception {
@@ -4039,6 +4045,12 @@ public class LLFirPreresolvedReversedDiagnosticCompilerFE10TestDataTestGenerated
runTest("compiler/testData/diagnostics/tests/callableReference/generic/argumentExpectedType.kt");
}
@Test
@TestMetadata("boundViolated.kt")
public void testBoundViolated() throws Exception {
runTest("compiler/testData/diagnostics/tests/callableReference/generic/boundViolated.kt");
}
@Test
@TestMetadata("dependOnArgumentType.kt")
public void testDependOnArgumentType() throws Exception {
@@ -4069,6 +4081,12 @@ public class LLFirPreresolvedReversedDiagnosticCompilerFE10TestDataTestGenerated
runTest("compiler/testData/diagnostics/tests/callableReference/generic/genericFunctionsWithNullableTypes.kt");
}
@Test
@TestMetadata("incorrectNumberOfTypeArguments.kt")
public void testIncorrectNumberOfTypeArguments() throws Exception {
runTest("compiler/testData/diagnostics/tests/callableReference/generic/incorrectNumberOfTypeArguments.kt");
}
@Test
@TestMetadata("kt10968.kt")
public void testKt10968() throws Exception {
@@ -5374,6 +5392,12 @@ public class LLFirPreresolvedReversedDiagnosticCompilerFE10TestDataTestGenerated
runTest("compiler/testData/diagnostics/tests/classLiteral/nonClassesOnLHS.kt");
}
@Test
@TestMetadata("parameterizedTypeAlias.kt")
public void testParameterizedTypeAlias() throws Exception {
runTest("compiler/testData/diagnostics/tests/classLiteral/parameterizedTypeAlias.kt");
}
@Test
@TestMetadata("qualifiedClassLiteral.kt")
public void testQualifiedClassLiteral() throws Exception {
@@ -3322,6 +3322,12 @@ public class FirLightTreeOldFrontendDiagnosticsTestGenerated extends AbstractFir
runTest("compiler/testData/diagnostics/tests/callableReference/genericCallWithReferenceAgainstVarargAndKFunction.kt");
}
@Test
@TestMetadata("genericTypealiasInLhs.kt")
public void testGenericTypealiasInLhs() throws Exception {
runTest("compiler/testData/diagnostics/tests/callableReference/genericTypealiasInLhs.kt");
}
@Test
@TestMetadata("kt15439_completeCall.kt")
public void testKt15439_completeCall() throws Exception {
@@ -4039,6 +4045,12 @@ public class FirLightTreeOldFrontendDiagnosticsTestGenerated extends AbstractFir
runTest("compiler/testData/diagnostics/tests/callableReference/generic/argumentExpectedType.kt");
}
@Test
@TestMetadata("boundViolated.kt")
public void testBoundViolated() throws Exception {
runTest("compiler/testData/diagnostics/tests/callableReference/generic/boundViolated.kt");
}
@Test
@TestMetadata("dependOnArgumentType.kt")
public void testDependOnArgumentType() throws Exception {
@@ -4069,6 +4081,12 @@ public class FirLightTreeOldFrontendDiagnosticsTestGenerated extends AbstractFir
runTest("compiler/testData/diagnostics/tests/callableReference/generic/genericFunctionsWithNullableTypes.kt");
}
@Test
@TestMetadata("incorrectNumberOfTypeArguments.kt")
public void testIncorrectNumberOfTypeArguments() throws Exception {
runTest("compiler/testData/diagnostics/tests/callableReference/generic/incorrectNumberOfTypeArguments.kt");
}
@Test
@TestMetadata("kt10968.kt")
public void testKt10968() throws Exception {
@@ -5374,6 +5392,12 @@ public class FirLightTreeOldFrontendDiagnosticsTestGenerated extends AbstractFir
runTest("compiler/testData/diagnostics/tests/classLiteral/nonClassesOnLHS.kt");
}
@Test
@TestMetadata("parameterizedTypeAlias.kt")
public void testParameterizedTypeAlias() throws Exception {
runTest("compiler/testData/diagnostics/tests/classLiteral/parameterizedTypeAlias.kt");
}
@Test
@TestMetadata("qualifiedClassLiteral.kt")
public void testQualifiedClassLiteral() throws Exception {
@@ -3328,6 +3328,12 @@ public class FirPsiOldFrontendDiagnosticsTestGenerated extends AbstractFirPsiDia
runTest("compiler/testData/diagnostics/tests/callableReference/genericCallWithReferenceAgainstVarargAndKFunction.kt");
}
@Test
@TestMetadata("genericTypealiasInLhs.kt")
public void testGenericTypealiasInLhs() throws Exception {
runTest("compiler/testData/diagnostics/tests/callableReference/genericTypealiasInLhs.kt");
}
@Test
@TestMetadata("kt15439_completeCall.kt")
public void testKt15439_completeCall() throws Exception {
@@ -4045,6 +4051,12 @@ public class FirPsiOldFrontendDiagnosticsTestGenerated extends AbstractFirPsiDia
runTest("compiler/testData/diagnostics/tests/callableReference/generic/argumentExpectedType.kt");
}
@Test
@TestMetadata("boundViolated.kt")
public void testBoundViolated() throws Exception {
runTest("compiler/testData/diagnostics/tests/callableReference/generic/boundViolated.kt");
}
@Test
@TestMetadata("dependOnArgumentType.kt")
public void testDependOnArgumentType() throws Exception {
@@ -4075,6 +4087,12 @@ public class FirPsiOldFrontendDiagnosticsTestGenerated extends AbstractFirPsiDia
runTest("compiler/testData/diagnostics/tests/callableReference/generic/genericFunctionsWithNullableTypes.kt");
}
@Test
@TestMetadata("incorrectNumberOfTypeArguments.kt")
public void testIncorrectNumberOfTypeArguments() throws Exception {
runTest("compiler/testData/diagnostics/tests/callableReference/generic/incorrectNumberOfTypeArguments.kt");
}
@Test
@TestMetadata("kt10968.kt")
public void testKt10968() throws Exception {
@@ -5380,6 +5398,12 @@ public class FirPsiOldFrontendDiagnosticsTestGenerated extends AbstractFirPsiDia
runTest("compiler/testData/diagnostics/tests/classLiteral/nonClassesOnLHS.kt");
}
@Test
@TestMetadata("parameterizedTypeAlias.kt")
public void testParameterizedTypeAlias() throws Exception {
runTest("compiler/testData/diagnostics/tests/classLiteral/parameterizedTypeAlias.kt");
}
@Test
@TestMetadata("qualifiedClassLiteral.kt")
public void testQualifiedClassLiteral() throws Exception {
@@ -168,4 +168,9 @@ object CommonExpressionCheckers : ExpressionCheckers() {
get() = setOf(
FirReceiverAccessBeforeSuperCallChecker,
)
override val callableReferenceAccessCheckers: Set<FirCallableReferenceAccessChecker>
get() = setOf(
FirTypeArgumentsOfQualifierOfCallableReferenceChecker,
)
}
@@ -14,6 +14,7 @@ import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors
import org.jetbrains.kotlin.fir.resolve.fullyExpandedType
import org.jetbrains.kotlin.fir.resolve.substitution.AbstractConeSubstitutor
import org.jetbrains.kotlin.fir.resolve.substitution.ConeSubstitutor
import org.jetbrains.kotlin.fir.resolve.substitution.substitutorByMap
import org.jetbrains.kotlin.fir.resolve.toSymbol
import org.jetbrains.kotlin.fir.resolve.withCombinedAttributesFrom
import org.jetbrains.kotlin.fir.symbols.impl.FirRegularClassSymbol
@@ -72,10 +73,20 @@ private fun checkUpperBoundViolated(
)
}
private class FE10LikeConeSubstitutor(
/**
* This substitutor replaces type projections with type of this projection
* Star projections are replaced with Any?
*/
internal class FE10LikeConeSubstitutor(
private val substitution: Map<FirTypeParameterSymbol, ConeTypeProjection>,
useSiteSession: FirSession
) : AbstractConeSubstitutor(useSiteSession.typeContext) {
constructor(
typeParameters: List<FirTypeParameterSymbol>,
typeArguments: List<ConeTypeProjection>,
useSiteSession: FirSession
) : this(typeParameters.zip(typeArguments).toMap(), useSiteSession)
override fun substituteType(type: ConeKotlinType): ConeKotlinType? {
if (type !is ConeTypeParameterType) return null
val projection = substitution[type.lookupTag.symbol] ?: return null
@@ -134,7 +145,26 @@ private class OriginalProjectionTypeAttribute(val data: ConeTypeProjection) : Co
get() = OriginalProjectionTypeAttribute::class
}
private val ConeAttributes.originalProjection: OriginalProjectionTypeAttribute? by ConeAttributes.attributeAccessor<OriginalProjectionTypeAttribute>()
private val ConeAttributes.originalProjection: OriginalProjectionTypeAttribute? by ConeAttributes.attributeAccessor()
fun List<FirTypeProjection>.toTypeArgumentsWithSourceInfo(): List<ConeTypeProjection> {
return map { firTypeProjection ->
firTypeProjection.toConeTypeProjection().withSource(
FirTypeRefSource((firTypeProjection as? FirTypeProjectionWithVariance)?.typeRef, firTypeProjection.source)
)
}
}
fun createSubstitutorForUpperBoundViolationCheck(
typeParameters: List<FirTypeParameterSymbol>,
typeArguments: List<ConeTypeProjection>,
session: FirSession
): ConeSubstitutor {
return substitutorByMap(
typeParameters.withIndex().associate { Pair(it.value, typeArguments[it.index] as ConeKotlinType) },
session,
)
}
fun checkUpperBoundViolated(
context: CheckerContext,
@@ -216,7 +246,7 @@ private class SourceAttribute(private val data: FirTypeRefSource) : ConeAttribut
get() = SourceAttribute::class
}
private val ConeAttributes.sourceAttribute: SourceAttribute? by ConeAttributes.attributeAccessor<SourceAttribute>()
private val ConeAttributes.sourceAttribute: SourceAttribute? by ConeAttributes.attributeAccessor()
fun ConeTypeProjection.withSource(source: FirTypeRefSource?): ConeTypeProjection {
return when {
@@ -0,0 +1,58 @@
/*
* Copyright 2010-2023 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlin.fir.analysis.checkers.expression
import org.jetbrains.kotlin.diagnostics.DiagnosticReporter
import org.jetbrains.kotlin.diagnostics.reportOn
import org.jetbrains.kotlin.fir.analysis.checkers.FE10LikeConeSubstitutor
import org.jetbrains.kotlin.fir.analysis.checkers.checkUpperBoundViolated
import org.jetbrains.kotlin.fir.analysis.checkers.context.CheckerContext
import org.jetbrains.kotlin.fir.analysis.checkers.toRegularClassSymbol
import org.jetbrains.kotlin.fir.analysis.checkers.toTypeArgumentsWithSourceInfo
import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors
import org.jetbrains.kotlin.fir.expressions.FirCallableReferenceAccess
import org.jetbrains.kotlin.fir.expressions.FirResolvedQualifier
import org.jetbrains.kotlin.fir.resolve.fullyExpandedType
import org.jetbrains.kotlin.fir.symbols.impl.FirTypeAliasSymbol
import org.jetbrains.kotlin.fir.types.constructType
object FirTypeArgumentsOfQualifierOfCallableReferenceChecker : FirCallableReferenceAccessChecker() {
override fun check(expression: FirCallableReferenceAccess, context: CheckerContext, reporter: DiagnosticReporter) {
val lhs = expression.explicitReceiver as? FirResolvedQualifier ?: return
val correspondingDeclaration = lhs.symbol ?: return
var typeArgumentsWithSourceInfo = lhs.typeArguments.toTypeArgumentsWithSourceInfo()
var typeParameterSymbols = correspondingDeclaration.typeParameterSymbols
if (typeParameterSymbols.size != typeArgumentsWithSourceInfo.size) {
reporter.reportOn(
lhs.source,
FirErrors.WRONG_NUMBER_OF_TYPE_ARGUMENTS,
correspondingDeclaration.typeParameterSymbols.size,
correspondingDeclaration,
context
)
return
}
if (correspondingDeclaration is FirTypeAliasSymbol) {
val qualifierType = correspondingDeclaration.constructType(typeArgumentsWithSourceInfo.toTypedArray(), isNullable = false)
val expandedLhsType = qualifierType.fullyExpandedType(context.session)
typeArgumentsWithSourceInfo = expandedLhsType.typeArguments.toList()
val expandedClassSymbol = correspondingDeclaration.resolvedExpandedTypeRef.toRegularClassSymbol(context.session) ?: return
typeParameterSymbols = expandedClassSymbol.typeParameterSymbols
}
val substitutor = FE10LikeConeSubstitutor(typeParameterSymbols, typeArgumentsWithSourceInfo, context.session)
checkUpperBoundViolated(
context,
reporter,
typeParameterSymbols,
typeArgumentsWithSourceInfo,
substitutor,
)
}
}
@@ -10,14 +10,15 @@ import org.jetbrains.kotlin.fir.analysis.checkers.FirTypeRefSource
import org.jetbrains.kotlin.fir.analysis.checkers.checkUpperBoundViolated
import org.jetbrains.kotlin.fir.analysis.checkers.context.CheckerContext
import org.jetbrains.kotlin.fir.analysis.checkers.withSource
import org.jetbrains.kotlin.fir.analysis.checkers.createSubstitutorForUpperBoundViolationCheck
import org.jetbrains.kotlin.fir.analysis.checkers.toTypeArgumentsWithSourceInfo
import org.jetbrains.kotlin.fir.expressions.FirQualifiedAccessExpression
import org.jetbrains.kotlin.fir.references.toResolvedCallableSymbol
import org.jetbrains.kotlin.fir.references.FirResolvedErrorReference
import org.jetbrains.kotlin.fir.references.FirResolvedNamedReference
import org.jetbrains.kotlin.fir.references.toResolvedCallableSymbol
import org.jetbrains.kotlin.fir.resolve.diagnostics.ConeInapplicableWrongReceiver
import org.jetbrains.kotlin.fir.resolve.fullyExpandedType
import org.jetbrains.kotlin.fir.resolve.isTypeAliasedConstructor
import org.jetbrains.kotlin.fir.resolve.substitution.substitutorByMap
import org.jetbrains.kotlin.fir.symbols.impl.FirConstructorSymbol
import org.jetbrains.kotlin.fir.symbols.impl.FirRegularClassSymbol
import org.jetbrains.kotlin.fir.symbols.impl.FirTypeParameterSymbol
@@ -54,11 +55,7 @@ object FirUpperBoundViolatedExpressionChecker : FirQualifiedAccessExpressionChec
typeParameters = (constructedType.toSymbol(context.session) as? FirRegularClassSymbol)?.typeParameterSymbols ?: return
} else {
typeArguments = expression.typeArguments.map { firTypeProjection ->
firTypeProjection.toConeTypeProjection().withSource(
FirTypeRefSource((firTypeProjection as? FirTypeProjectionWithVariance)?.typeRef, firTypeProjection.source)
)
}
typeArguments = expression.typeArguments.toTypeArgumentsWithSourceInfo()
typeParameters = calleeSymbol?.typeParameterSymbols ?: return
}
@@ -70,8 +67,9 @@ object FirUpperBoundViolatedExpressionChecker : FirQualifiedAccessExpressionChec
if (typeArguments.size != typeParameters.size) return
val substitutor = substitutorByMap(
typeParameters.withIndex().associate { Pair(it.value, typeArguments[it.index] as ConeKotlinType) },
val substitutor = createSubstitutorForUpperBoundViolationCheck(
typeParameters,
typeArguments,
context.session,
)
@@ -1,14 +0,0 @@
/*
* KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE)
*
* SPEC VERSION: 0.1-220
* PRIMARY LINKS: expressions, call-and-property-access-expressions, callable-references -> paragraph 3 -> sentence 1
*/
fun f1() = Map::hashCode
fun f2() = Map.Entry::hashCode
class Outer<T> {
inner class Inner
}
fun f3() = Outer.Inner::hashCode
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
/*
* KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE)
*
@@ -0,0 +1,13 @@
// FIR_IDENTICAL
// WITH_STDLIB
// ISSUE: KT-56187
class Foo<T : Number> {
val value: String = "OK"
val genericValue: T = null!!
}
fun main() {
val a = Foo<<!UPPER_BOUND_VIOLATED!>String<!>>::value
val b = Foo<<!UPPER_BOUND_VIOLATED!>String<!>>::genericValue
}
@@ -0,0 +1,14 @@
// WITH_STDLIB
// ISSUE: KT-56186
class Foo<I, J : Number, K> {
val value: String = "OK"
val genericValue: Triple<I, J, K> = TODO()
}
fun test_1() {
val a = <!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>Foo<!>::value
val b = <!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>Foo<String><!>::value
val c = <!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>Foo<!>::genericValue
val d = <!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>Foo<String><!>::genericValue
}
@@ -0,0 +1,14 @@
// WITH_STDLIB
// ISSUE: KT-56186
class Foo<I, J : Number, K> {
val value: String = "OK"
val genericValue: Triple<I, J, K> = TODO()
}
fun test_1() {
val a = <!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>Foo<!>::value
val b = Foo<!WRONG_NUMBER_OF_TYPE_ARGUMENTS!><String><!>::<!OVERLOAD_RESOLUTION_AMBIGUITY!>value<!>
val c = <!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>Foo<!>::genericValue
val d = Foo<!WRONG_NUMBER_OF_TYPE_ARGUMENTS!><String><!>::<!OVERLOAD_RESOLUTION_AMBIGUITY!>genericValue<!>
}
@@ -0,0 +1,170 @@
class Some { fun foo() {} }
typealias SomeAlias = Some
typealias SomeUnusedAlias<T> = Some
fun test_1() {
Some::foo
<!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>Some<Int><!>::foo
SomeAlias::foo
<!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>SomeAlias<Int><!>::foo
<!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>SomeUnusedAlias<!>::foo
SomeUnusedAlias<Int>::foo
SomeUnusedAlias<out Int>::foo
SomeUnusedAlias<in Int>::foo
SomeUnusedAlias<*>::foo
<!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>SomeUnusedAlias<Int, Int><!>::foo
}
// ----------------------------------------------------------------
class Inv<T : CharSequence> { fun foo() {} }
typealias InvAlias<T> = Inv<T>
typealias InvUnusedCorrectAlias<T> = Inv<String>
typealias InvUnusedIncorrectAlias<T> = Inv<<!UPPER_BOUND_VIOLATED!>Int<!>>
typealias InvSpecificAlias = Inv<String>
fun test_2() {
Inv<String>::foo
Inv<<!UPPER_BOUND_VIOLATED!>Int<!>>::foo
Inv<*>::foo
Inv<<!UPPER_BOUND_VIOLATED!>out Int<!>>::foo
Inv<out String>::foo
<!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>Inv<!>::foo
<!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>Inv<String, String><!>::foo
InvAlias<String>::foo
InvAlias<<!UPPER_BOUND_VIOLATED!>Int<!>>::foo
InvAlias<*>::foo
InvAlias<<!UPPER_BOUND_VIOLATED!>out Int<!>>::foo
InvAlias<out String>::foo
<!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>InvAlias<!>::foo
<!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>InvAlias<String, String><!>::foo
InvUnusedCorrectAlias<String>::foo
InvUnusedCorrectAlias<Int>::foo
InvUnusedCorrectAlias<*>::foo
InvUnusedCorrectAlias<out Int>::foo
InvUnusedCorrectAlias<out String>::foo
<!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>InvUnusedCorrectAlias<!>::foo
<!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>InvUnusedCorrectAlias<String, String><!>::foo
InvUnusedIncorrectAlias<String>::foo
InvUnusedIncorrectAlias<Int>::foo
InvUnusedIncorrectAlias<*>::foo
InvUnusedIncorrectAlias<out Int>::foo
InvUnusedIncorrectAlias<out String>::foo
<!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>InvUnusedIncorrectAlias<!>::foo
<!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>InvUnusedIncorrectAlias<String, String><!>::foo
InvSpecificAlias::foo
<!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>InvSpecificAlias<String, String><!>::foo
}
// ----------------------------------------------------------------
class BoundedPair<T : CharSequence, Q> { fun foo() {} }
typealias BoundedPairAlias<T, Q> = BoundedPair<T, Q>
typealias BoundedPairInverted<Q, T> = BoundedPair<T, Q>
typealias BoundedPairFirstFixedAlias<Q> = BoundedPair<String, Q>
typealias BoundedPairSecondFixedAlias<T> = BoundedPair<T, Int>
typealias BoundedPairFirstUnusedAlias<T, Q> = BoundedPair<String, Q>
typealias BoundedPairSecondUnusedAlias<T, Q> = BoundedPair<T, Int>
typealias BoundedPairBothAlias<T, Q> = BoundedPair<String, Int>
typealias BoundedPairSpecificAlias<T, Q> = BoundedPair<String, Int>
fun test_3() {
BoundedPair<String, Int>::foo
BoundedPair<<!UPPER_BOUND_VIOLATED!>Int<!>, Int>::foo
BoundedPair<*, *>::foo
BoundedPair<out String, out Int>::foo
BoundedPair<<!UPPER_BOUND_VIOLATED!>out Int<!>, out Int>::foo
BoundedPair<in String, in Int>::foo
BoundedPair<<!UPPER_BOUND_VIOLATED!>in Int<!>, in Int>::foo
<!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>BoundedPair<!>::foo
<!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>BoundedPair<Int, Int, Int><!>::foo
BoundedPairAlias<String, Int>::foo
BoundedPairAlias<<!UPPER_BOUND_VIOLATED!>Int<!>, Int>::foo
BoundedPairAlias<*, *>::foo
BoundedPairAlias<out String, out Int>::foo
BoundedPairAlias<<!UPPER_BOUND_VIOLATED!>out Int<!>, out Int>::foo
BoundedPairAlias<in String, in Int>::foo
BoundedPairAlias<<!UPPER_BOUND_VIOLATED!>in Int<!>, in Int>::foo
<!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>BoundedPairAlias<!>::foo
<!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>BoundedPairAlias<Int, Int, Int><!>::foo
BoundedPairInverted<String, <!UPPER_BOUND_VIOLATED!>Int<!>>::foo
BoundedPairInverted<Int, <!UPPER_BOUND_VIOLATED!>Int<!>>::foo
BoundedPairInverted<*, *>::foo
BoundedPairInverted<out String, <!UPPER_BOUND_VIOLATED!>out Int<!>>::foo
BoundedPairInverted<out Int, <!UPPER_BOUND_VIOLATED!>out Int<!>>::foo
BoundedPairInverted<in String, <!UPPER_BOUND_VIOLATED!>in Int<!>>::foo
BoundedPairInverted<in Int, <!UPPER_BOUND_VIOLATED!>in Int<!>>::foo
<!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>BoundedPairInverted<!>::foo
<!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>BoundedPairInverted<Int, Int, Int><!>::foo
BoundedPairFirstFixedAlias<Int>::foo
BoundedPairFirstFixedAlias<Int>::foo
BoundedPairFirstFixedAlias<*>::foo
BoundedPairFirstFixedAlias<out String>::foo
BoundedPairFirstFixedAlias<out Int>::foo
BoundedPairFirstFixedAlias<in String>::foo
BoundedPairFirstFixedAlias<in Int>::foo
<!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>BoundedPairFirstFixedAlias<!>::foo
<!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>BoundedPairFirstFixedAlias<Int, Int><!>::foo
BoundedPairSecondFixedAlias<<!UPPER_BOUND_VIOLATED!>Int<!>>::foo
BoundedPairSecondFixedAlias<<!UPPER_BOUND_VIOLATED!>Int<!>>::foo
BoundedPairSecondFixedAlias<*>::foo
BoundedPairSecondFixedAlias<out String>::foo
BoundedPairSecondFixedAlias<<!UPPER_BOUND_VIOLATED!>out Int<!>>::foo
BoundedPairSecondFixedAlias<in String>::foo
BoundedPairSecondFixedAlias<<!UPPER_BOUND_VIOLATED!>in Int<!>>::foo
<!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>BoundedPairSecondFixedAlias<!>::foo
<!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>BoundedPairSecondFixedAlias<Int, Int><!>::foo
BoundedPairFirstUnusedAlias<String, Int>::foo
BoundedPairFirstUnusedAlias<Int, Int>::foo
BoundedPairFirstUnusedAlias<*, *>::foo
BoundedPairFirstUnusedAlias<out String, out Int>::foo
BoundedPairFirstUnusedAlias<out Int, out Int>::foo
BoundedPairFirstUnusedAlias<in String, in Int>::foo
BoundedPairFirstUnusedAlias<in Int, in Int>::foo
<!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>BoundedPairFirstUnusedAlias<!>::foo
<!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>BoundedPairFirstUnusedAlias<Int, Int, Int><!>::foo
BoundedPairSecondUnusedAlias<String, Int>::foo
BoundedPairSecondUnusedAlias<<!UPPER_BOUND_VIOLATED!>Int<!>, Int>::foo
BoundedPairSecondUnusedAlias<*, *>::foo
BoundedPairSecondUnusedAlias<out String, out Int>::foo
BoundedPairSecondUnusedAlias<<!UPPER_BOUND_VIOLATED!>out Int<!>, out Int>::foo
BoundedPairSecondUnusedAlias<in String, in Int>::foo
BoundedPairSecondUnusedAlias<<!UPPER_BOUND_VIOLATED!>in Int<!>, in Int>::foo
<!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>BoundedPairSecondUnusedAlias<!>::foo
<!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>BoundedPairSecondUnusedAlias<Int, Int, Int><!>::foo
BoundedPairBothAlias<String, Int>::foo
BoundedPairBothAlias<Int, Int>::foo
BoundedPairBothAlias<*, *>::foo
BoundedPairBothAlias<out String, out Int>::foo
BoundedPairBothAlias<out Int, out Int>::foo
BoundedPairBothAlias<in String, in Int>::foo
BoundedPairBothAlias<in Int, in Int>::foo
<!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>BoundedPairBothAlias<!>::foo
<!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>BoundedPairBothAlias<Int, Int, Int><!>::foo
BoundedPairSpecificAlias<String, Int>::foo
BoundedPairSpecificAlias<Int, Int>::foo
BoundedPairSpecificAlias<*, *>::foo
BoundedPairSpecificAlias<out String, out Int>::foo
BoundedPairSpecificAlias<out Int, out Int>::foo
BoundedPairSpecificAlias<in String, in Int>::foo
BoundedPairSpecificAlias<in Int, in Int>::foo
<!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>BoundedPairSpecificAlias<!>::foo
<!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>BoundedPairSpecificAlias<Int, Int, Int><!>::foo
}
@@ -0,0 +1,170 @@
class Some { fun foo() {} }
typealias SomeAlias = Some
typealias SomeUnusedAlias<T> = Some
fun test_1() {
Some::foo
Some<!WRONG_NUMBER_OF_TYPE_ARGUMENTS!><Int><!>::<!OVERLOAD_RESOLUTION_AMBIGUITY!>foo<!>
SomeAlias::foo
SomeAlias<!WRONG_NUMBER_OF_TYPE_ARGUMENTS!><Int><!>::<!OVERLOAD_RESOLUTION_AMBIGUITY!>foo<!>
<!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>SomeUnusedAlias<!>::<!OVERLOAD_RESOLUTION_AMBIGUITY!>foo<!>
SomeUnusedAlias<Int>::foo
SomeUnusedAlias<out Int>::foo
SomeUnusedAlias<in Int>::foo
SomeUnusedAlias<*>::foo
SomeUnusedAlias<!WRONG_NUMBER_OF_TYPE_ARGUMENTS!><Int, Int><!>::<!OVERLOAD_RESOLUTION_AMBIGUITY!>foo<!>
}
// ----------------------------------------------------------------
class Inv<T : CharSequence> { fun foo() {} }
typealias InvAlias<T> = Inv<T>
typealias InvUnusedCorrectAlias<T> = Inv<String>
typealias InvUnusedIncorrectAlias<T> = Inv<<!UPPER_BOUND_VIOLATED!>Int<!>>
typealias InvSpecificAlias = Inv<String>
fun test_2() {
Inv<String>::foo
Inv<<!UPPER_BOUND_VIOLATED!>Int<!>>::foo
Inv<*>::foo
Inv<out <!UPPER_BOUND_VIOLATED!>Int<!>>::foo
Inv<out String>::foo
<!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>Inv<!>::foo
Inv<!WRONG_NUMBER_OF_TYPE_ARGUMENTS!><String, String><!>::<!OVERLOAD_RESOLUTION_AMBIGUITY!>foo<!>
InvAlias<String>::foo
InvAlias<<!UPPER_BOUND_VIOLATED!>Int<!>>::foo
InvAlias<*>::foo
InvAlias<out <!UPPER_BOUND_VIOLATED!>Int<!>>::foo
InvAlias<out String>::foo
<!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>InvAlias<!>::foo
InvAlias<!WRONG_NUMBER_OF_TYPE_ARGUMENTS!><String, String><!>::<!OVERLOAD_RESOLUTION_AMBIGUITY!>foo<!>
InvUnusedCorrectAlias<String>::foo
InvUnusedCorrectAlias<Int>::foo
InvUnusedCorrectAlias<*>::foo
InvUnusedCorrectAlias<out Int>::foo
InvUnusedCorrectAlias<out String>::foo
<!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>InvUnusedCorrectAlias<!>::<!OVERLOAD_RESOLUTION_AMBIGUITY!>foo<!>
InvUnusedCorrectAlias<!WRONG_NUMBER_OF_TYPE_ARGUMENTS!><String, String><!>::<!OVERLOAD_RESOLUTION_AMBIGUITY!>foo<!>
InvUnusedIncorrectAlias<String>::foo
InvUnusedIncorrectAlias<Int>::foo
InvUnusedIncorrectAlias<*>::foo
InvUnusedIncorrectAlias<out Int>::foo
InvUnusedIncorrectAlias<out String>::foo
<!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>InvUnusedIncorrectAlias<!>::<!OVERLOAD_RESOLUTION_AMBIGUITY!>foo<!>
InvUnusedIncorrectAlias<!WRONG_NUMBER_OF_TYPE_ARGUMENTS!><String, String><!>::<!OVERLOAD_RESOLUTION_AMBIGUITY!>foo<!>
InvSpecificAlias::foo
InvSpecificAlias<!WRONG_NUMBER_OF_TYPE_ARGUMENTS!><String, String><!>::<!OVERLOAD_RESOLUTION_AMBIGUITY!>foo<!>
}
// ----------------------------------------------------------------
class BoundedPair<T : CharSequence, Q> { fun foo() {} }
typealias BoundedPairAlias<T, Q> = BoundedPair<T, Q>
typealias BoundedPairInverted<Q, T> = BoundedPair<T, Q>
typealias BoundedPairFirstFixedAlias<Q> = BoundedPair<String, Q>
typealias BoundedPairSecondFixedAlias<T> = BoundedPair<T, Int>
typealias BoundedPairFirstUnusedAlias<T, Q> = BoundedPair<String, Q>
typealias BoundedPairSecondUnusedAlias<T, Q> = BoundedPair<T, Int>
typealias BoundedPairBothAlias<T, Q> = BoundedPair<String, Int>
typealias BoundedPairSpecificAlias<T, Q> = BoundedPair<String, Int>
fun test_3() {
BoundedPair<String, Int>::foo
BoundedPair<<!UPPER_BOUND_VIOLATED!>Int<!>, Int>::foo
BoundedPair<*, *>::foo
BoundedPair<out String, out Int>::foo
BoundedPair<out <!UPPER_BOUND_VIOLATED!>Int<!>, out Int>::foo
BoundedPair<in String, in Int>::foo
BoundedPair<in <!UPPER_BOUND_VIOLATED!>Int<!>, in Int>::foo
<!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>BoundedPair<!>::foo
BoundedPair<!WRONG_NUMBER_OF_TYPE_ARGUMENTS!><Int, Int, Int><!>::<!OVERLOAD_RESOLUTION_AMBIGUITY!>foo<!>
BoundedPairAlias<String, Int>::foo
BoundedPairAlias<<!UPPER_BOUND_VIOLATED!>Int<!>, Int>::foo
BoundedPairAlias<*, *>::foo
BoundedPairAlias<out String, out Int>::foo
BoundedPairAlias<out <!UPPER_BOUND_VIOLATED!>Int<!>, out Int>::foo
BoundedPairAlias<in String, in Int>::foo
BoundedPairAlias<in <!UPPER_BOUND_VIOLATED!>Int<!>, in Int>::foo
<!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>BoundedPairAlias<!>::foo
BoundedPairAlias<!WRONG_NUMBER_OF_TYPE_ARGUMENTS!><Int, Int, Int><!>::<!OVERLOAD_RESOLUTION_AMBIGUITY!>foo<!>
BoundedPairInverted<String, <!UPPER_BOUND_VIOLATED!>Int<!>>::foo
BoundedPairInverted<Int, <!UPPER_BOUND_VIOLATED!>Int<!>>::foo
BoundedPairInverted<*, *>::foo
BoundedPairInverted<out String, out <!UPPER_BOUND_VIOLATED!>Int<!>>::foo
BoundedPairInverted<out Int, out <!UPPER_BOUND_VIOLATED!>Int<!>>::foo
BoundedPairInverted<in String, in <!UPPER_BOUND_VIOLATED!>Int<!>>::foo
BoundedPairInverted<in Int, in <!UPPER_BOUND_VIOLATED!>Int<!>>::foo
<!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>BoundedPairInverted<!>::foo
BoundedPairInverted<!WRONG_NUMBER_OF_TYPE_ARGUMENTS!><Int, Int, Int><!>::<!OVERLOAD_RESOLUTION_AMBIGUITY!>foo<!>
BoundedPairFirstFixedAlias<Int>::foo
BoundedPairFirstFixedAlias<Int>::foo
BoundedPairFirstFixedAlias<*>::foo
BoundedPairFirstFixedAlias<out String>::foo
BoundedPairFirstFixedAlias<out Int>::foo
BoundedPairFirstFixedAlias<in String>::foo
BoundedPairFirstFixedAlias<in Int>::foo
<!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>BoundedPairFirstFixedAlias<!>::<!OVERLOAD_RESOLUTION_AMBIGUITY!>foo<!>
BoundedPairFirstFixedAlias<!WRONG_NUMBER_OF_TYPE_ARGUMENTS!><Int, Int><!>::<!OVERLOAD_RESOLUTION_AMBIGUITY!>foo<!>
BoundedPairSecondFixedAlias<<!UPPER_BOUND_VIOLATED!>Int<!>>::foo
BoundedPairSecondFixedAlias<<!UPPER_BOUND_VIOLATED!>Int<!>>::foo
BoundedPairSecondFixedAlias<*>::foo
BoundedPairSecondFixedAlias<out String>::foo
BoundedPairSecondFixedAlias<out <!UPPER_BOUND_VIOLATED!>Int<!>>::foo
BoundedPairSecondFixedAlias<in String>::foo
BoundedPairSecondFixedAlias<in <!UPPER_BOUND_VIOLATED!>Int<!>>::foo
<!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>BoundedPairSecondFixedAlias<!>::<!OVERLOAD_RESOLUTION_AMBIGUITY!>foo<!>
BoundedPairSecondFixedAlias<!WRONG_NUMBER_OF_TYPE_ARGUMENTS!><Int, Int><!>::<!OVERLOAD_RESOLUTION_AMBIGUITY!>foo<!>
BoundedPairFirstUnusedAlias<String, Int>::foo
BoundedPairFirstUnusedAlias<Int, Int>::foo
BoundedPairFirstUnusedAlias<*, *>::foo
BoundedPairFirstUnusedAlias<out String, out Int>::foo
BoundedPairFirstUnusedAlias<out Int, out Int>::foo
BoundedPairFirstUnusedAlias<in String, in Int>::foo
BoundedPairFirstUnusedAlias<in Int, in Int>::foo
<!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>BoundedPairFirstUnusedAlias<!>::<!OVERLOAD_RESOLUTION_AMBIGUITY!>foo<!>
BoundedPairFirstUnusedAlias<!WRONG_NUMBER_OF_TYPE_ARGUMENTS!><Int, Int, Int><!>::<!OVERLOAD_RESOLUTION_AMBIGUITY!>foo<!>
BoundedPairSecondUnusedAlias<String, Int>::foo
BoundedPairSecondUnusedAlias<<!UPPER_BOUND_VIOLATED!>Int<!>, Int>::foo
BoundedPairSecondUnusedAlias<*, *>::foo
BoundedPairSecondUnusedAlias<out String, out Int>::foo
BoundedPairSecondUnusedAlias<out <!UPPER_BOUND_VIOLATED!>Int<!>, out Int>::foo
BoundedPairSecondUnusedAlias<in String, in Int>::foo
BoundedPairSecondUnusedAlias<in <!UPPER_BOUND_VIOLATED!>Int<!>, in Int>::foo
<!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>BoundedPairSecondUnusedAlias<!>::<!OVERLOAD_RESOLUTION_AMBIGUITY!>foo<!>
BoundedPairSecondUnusedAlias<!WRONG_NUMBER_OF_TYPE_ARGUMENTS!><Int, Int, Int><!>::<!OVERLOAD_RESOLUTION_AMBIGUITY!>foo<!>
BoundedPairBothAlias<String, Int>::foo
BoundedPairBothAlias<Int, Int>::foo
BoundedPairBothAlias<*, *>::foo
BoundedPairBothAlias<out String, out Int>::foo
BoundedPairBothAlias<out Int, out Int>::foo
BoundedPairBothAlias<in String, in Int>::foo
BoundedPairBothAlias<in Int, in Int>::foo
<!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>BoundedPairBothAlias<!>::<!OVERLOAD_RESOLUTION_AMBIGUITY!>foo<!>
BoundedPairBothAlias<!WRONG_NUMBER_OF_TYPE_ARGUMENTS!><Int, Int, Int><!>::<!OVERLOAD_RESOLUTION_AMBIGUITY!>foo<!>
BoundedPairSpecificAlias<String, Int>::foo
BoundedPairSpecificAlias<Int, Int>::foo
BoundedPairSpecificAlias<*, *>::foo
BoundedPairSpecificAlias<out String, out Int>::foo
BoundedPairSpecificAlias<out Int, out Int>::foo
BoundedPairSpecificAlias<in String, in Int>::foo
BoundedPairSpecificAlias<in Int, in Int>::foo
<!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>BoundedPairSpecificAlias<!>::<!OVERLOAD_RESOLUTION_AMBIGUITY!>foo<!>
BoundedPairSpecificAlias<!WRONG_NUMBER_OF_TYPE_ARGUMENTS!><Int, Int, Int><!>::<!OVERLOAD_RESOLUTION_AMBIGUITY!>foo<!>
}
@@ -1,3 +1,4 @@
// WITH_STDLIB
// !DIAGNOSTICS: -UNUSED_VARIABLE
class A
@@ -17,4 +18,4 @@ inline fun <reified T : Any> bar() {
val t3 = <!NULLABLE_TYPE_IN_CLASS_LITERAL_LHS!>T?::class<!>
}
val m = Map<String>::class
val m = <!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>Map<String><!>::class
@@ -1,3 +1,4 @@
// WITH_STDLIB
// !DIAGNOSTICS: -UNUSED_VARIABLE
class A
@@ -0,0 +1,61 @@
class Inv<T>
class Some
class MyPair<A, B>
typealias InvAlias<T> = Inv<T>
typealias InvUnused<T> = Inv<Int>
typealias SomeAlias<T> = Some
typealias PairAliasSingle<T> = MyPair<T, T>
typealias PairAliasUsual<A, B> = MyPair<A, B>
typealias PairAliasReversed<A, B> = MyPair<B, A>
typealias PairAliasTwoWithUnused<A, B> = MyPair<A, A>
typealias PairAliasSpecific = MyPair<Int, Int>
typealias SimpleArrayAlias<T> = Array<T>
typealias SpecificArrayAlias = Array<Int>
typealias UnusedArrayAlias<T> = Array<Int>
fun test() {
Inv::class
<!CLASS_LITERAL_LHS_NOT_A_CLASS!>Inv<String>::class<!>
InvAlias::class
<!CLASS_LITERAL_LHS_NOT_A_CLASS!>InvAlias<String>::class<!>
InvUnused::class
<!CLASS_LITERAL_LHS_NOT_A_CLASS!>InvUnused<String>::class<!>
Some::class
SomeAlias::class
<!CLASS_LITERAL_LHS_NOT_A_CLASS!>SomeAlias<String>::class<!>
MyPair::class
<!CLASS_LITERAL_LHS_NOT_A_CLASS!>MyPair<Int, Int>::class<!>
PairAliasSingle::class
<!CLASS_LITERAL_LHS_NOT_A_CLASS!>PairAliasSingle<Int>::class<!>
PairAliasReversed::class
<!CLASS_LITERAL_LHS_NOT_A_CLASS!>PairAliasReversed<Int, Int>::class<!>
PairAliasUsual::class
<!CLASS_LITERAL_LHS_NOT_A_CLASS!>PairAliasUsual<Int, Int>::class<!>
PairAliasSpecific::class
PairAliasTwoWithUnused::class
<!CLASS_LITERAL_LHS_NOT_A_CLASS!>PairAliasTwoWithUnused<Int, Int>::class<!>
Array::class
Array<Int>::class
<!CLASS_LITERAL_LHS_NOT_A_CLASS!>Array<*>::class<!>
SimpleArrayAlias::class
<!CLASS_LITERAL_LHS_NOT_A_CLASS!>SimpleArrayAlias<Int>::class<!>
<!CLASS_LITERAL_LHS_NOT_A_CLASS!>SimpleArrayAlias<*>::class<!>
SpecificArrayAlias::class
UnusedArrayAlias::class
<!CLASS_LITERAL_LHS_NOT_A_CLASS!>UnusedArrayAlias<Int>::class<!>
<!CLASS_LITERAL_LHS_NOT_A_CLASS!>UnusedArrayAlias<*>::class<!>
}
@@ -0,0 +1,61 @@
class Inv<T>
class Some
class MyPair<A, B>
typealias InvAlias<T> = Inv<T>
typealias InvUnused<T> = Inv<Int>
typealias SomeAlias<T> = Some
typealias PairAliasSingle<T> = MyPair<T, T>
typealias PairAliasUsual<A, B> = MyPair<A, B>
typealias PairAliasReversed<A, B> = MyPair<B, A>
typealias PairAliasTwoWithUnused<A, B> = MyPair<A, A>
typealias PairAliasSpecific = MyPair<Int, Int>
typealias SimpleArrayAlias<T> = Array<T>
typealias SpecificArrayAlias = Array<Int>
typealias UnusedArrayAlias<T> = Array<Int>
fun test() {
Inv::class
<!CLASS_LITERAL_LHS_NOT_A_CLASS!>Inv<String>::class<!>
InvAlias::class
<!CLASS_LITERAL_LHS_NOT_A_CLASS!>InvAlias<String>::class<!>
<!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>InvUnused<!>::class
<!CLASS_LITERAL_LHS_NOT_A_CLASS!>InvUnused<String>::class<!>
Some::class
<!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>SomeAlias<!>::class
SomeAlias<String>::class
MyPair::class
<!CLASS_LITERAL_LHS_NOT_A_CLASS!>MyPair<Int, Int>::class<!>
<!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>PairAliasSingle<!>::class
<!CLASS_LITERAL_LHS_NOT_A_CLASS!>PairAliasSingle<Int>::class<!>
PairAliasReversed::class
<!CLASS_LITERAL_LHS_NOT_A_CLASS!>PairAliasReversed<Int, Int>::class<!>
PairAliasUsual::class
<!CLASS_LITERAL_LHS_NOT_A_CLASS!>PairAliasUsual<Int, Int>::class<!>
<!CLASS_LITERAL_LHS_NOT_A_CLASS!>PairAliasSpecific::class<!>
<!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>PairAliasTwoWithUnused<!>::class
<!CLASS_LITERAL_LHS_NOT_A_CLASS!>PairAliasTwoWithUnused<Int, Int>::class<!>
Array::class
Array<Int>::class
<!CLASS_LITERAL_LHS_NOT_A_CLASS!>Array<*>::class<!>
SimpleArrayAlias::class
SimpleArrayAlias<Int>::class
<!CLASS_LITERAL_LHS_NOT_A_CLASS!>SimpleArrayAlias<*>::class<!>
SpecificArrayAlias::class
<!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>UnusedArrayAlias<!>::class
UnusedArrayAlias<Int>::class
UnusedArrayAlias<*>::class
}
@@ -3328,6 +3328,12 @@ public class DiagnosticTestGenerated extends AbstractDiagnosticTest {
runTest("compiler/testData/diagnostics/tests/callableReference/genericCallWithReferenceAgainstVarargAndKFunction.kt");
}
@Test
@TestMetadata("genericTypealiasInLhs.kt")
public void testGenericTypealiasInLhs() throws Exception {
runTest("compiler/testData/diagnostics/tests/callableReference/genericTypealiasInLhs.kt");
}
@Test
@TestMetadata("kt15439_completeCall.kt")
public void testKt15439_completeCall() throws Exception {
@@ -4045,6 +4051,12 @@ public class DiagnosticTestGenerated extends AbstractDiagnosticTest {
runTest("compiler/testData/diagnostics/tests/callableReference/generic/argumentExpectedType.kt");
}
@Test
@TestMetadata("boundViolated.kt")
public void testBoundViolated() throws Exception {
runTest("compiler/testData/diagnostics/tests/callableReference/generic/boundViolated.kt");
}
@Test
@TestMetadata("dependOnArgumentType.kt")
public void testDependOnArgumentType() throws Exception {
@@ -4075,6 +4087,12 @@ public class DiagnosticTestGenerated extends AbstractDiagnosticTest {
runTest("compiler/testData/diagnostics/tests/callableReference/generic/genericFunctionsWithNullableTypes.kt");
}
@Test
@TestMetadata("incorrectNumberOfTypeArguments.kt")
public void testIncorrectNumberOfTypeArguments() throws Exception {
runTest("compiler/testData/diagnostics/tests/callableReference/generic/incorrectNumberOfTypeArguments.kt");
}
@Test
@TestMetadata("kt10968.kt")
public void testKt10968() throws Exception {
@@ -5380,6 +5398,12 @@ public class DiagnosticTestGenerated extends AbstractDiagnosticTest {
runTest("compiler/testData/diagnostics/tests/classLiteral/nonClassesOnLHS.kt");
}
@Test
@TestMetadata("parameterizedTypeAlias.kt")
public void testParameterizedTypeAlias() throws Exception {
runTest("compiler/testData/diagnostics/tests/classLiteral/parameterizedTypeAlias.kt");
}
@Test
@TestMetadata("qualifiedClassLiteral.kt")
public void testQualifiedClassLiteral() throws Exception {