FIR: improve inference of implicit type arguments in casts
Type parameters do not necessarily match one-to-one, or preserve order.
This commit is contained in:
+6
@@ -37112,6 +37112,12 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT
|
|||||||
runTest("compiler/testData/codegen/box/when/implicitExhaustiveAndReturn.kt");
|
runTest("compiler/testData/codegen/box/when/implicitExhaustiveAndReturn.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("inferredTypeParameters.kt")
|
||||||
|
public void testInferredTypeParameters() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/when/inferredTypeParameters.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestMetadata("integralWhenWithNoInlinedConstants.kt")
|
@TestMetadata("integralWhenWithNoInlinedConstants.kt")
|
||||||
public void testIntegralWhenWithNoInlinedConstants() throws Exception {
|
public void testIntegralWhenWithNoInlinedConstants() throws Exception {
|
||||||
|
|||||||
+1
-1
@@ -126,7 +126,7 @@ object FirErrors {
|
|||||||
val PROJECTION_ON_NON_CLASS_TYPE_ARGUMENT by error0<FirSourceElement, PsiElement>()
|
val PROJECTION_ON_NON_CLASS_TYPE_ARGUMENT by error0<FirSourceElement, PsiElement>()
|
||||||
val UPPER_BOUND_VIOLATED by error2<FirSourceElement, PsiElement, FirTypeParameterSymbol, ConeKotlinType>()
|
val UPPER_BOUND_VIOLATED by error2<FirSourceElement, PsiElement, FirTypeParameterSymbol, ConeKotlinType>()
|
||||||
val TYPE_ARGUMENTS_NOT_ALLOWED by error0<FirSourceElement, PsiElement>()
|
val TYPE_ARGUMENTS_NOT_ALLOWED by error0<FirSourceElement, PsiElement>()
|
||||||
val WRONG_NUMBER_OF_TYPE_ARGUMENTS by error2<FirSourceElement, PsiElement, Int, FirRegularClassSymbol>()
|
val WRONG_NUMBER_OF_TYPE_ARGUMENTS by error2<FirSourceElement, PsiElement, Int, FirClassLikeSymbol<*>>()
|
||||||
val NO_TYPE_FOR_TYPE_PARAMETER by error0<FirSourceElement, PsiElement>()
|
val NO_TYPE_FOR_TYPE_PARAMETER by error0<FirSourceElement, PsiElement>()
|
||||||
val TYPE_PARAMETERS_IN_OBJECT by error0<FirSourceElement, PsiElement>()
|
val TYPE_PARAMETERS_IN_OBJECT by error0<FirSourceElement, PsiElement>()
|
||||||
val ILLEGAL_PROJECTION_USAGE by error0<FirSourceElement, PsiElement>()
|
val ILLEGAL_PROJECTION_USAGE by error0<FirSourceElement, PsiElement>()
|
||||||
|
|||||||
+1
-1
@@ -74,7 +74,7 @@ class ConeIllegalAnnotationError(val name: Name) : ConeDiagnostic() {
|
|||||||
override val reason: String get() = "Not a legal annotation: $name"
|
override val reason: String get() = "Not a legal annotation: $name"
|
||||||
}
|
}
|
||||||
|
|
||||||
class ConeWrongNumberOfTypeArgumentsError(val desiredCount: Int, val type: FirRegularClassSymbol) : ConeDiagnostic() {
|
class ConeWrongNumberOfTypeArgumentsError(val desiredCount: Int, val type: FirClassLikeSymbol<*>) : ConeDiagnostic() {
|
||||||
override val reason: String get() = "Wrong number of type arguments"
|
override val reason: String get() = "Wrong number of type arguments"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+44
-21
@@ -450,30 +450,53 @@ open class FirExpressionsResolveTransformer(transformer: FirBodyResolveTransform
|
|||||||
override fun <T> shouldRunCompletion(call: T): Boolean where T : FirStatement, T : FirResolvable = false
|
override fun <T> shouldRunCompletion(call: T): Boolean where T : FirStatement, T : FirResolvable = false
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun FirTypeRef.withTypeArgumentsForBareType(argument: FirExpression): FirTypeRef {
|
private fun ConeClassLikeType.inheritTypeArguments(
|
||||||
// TODO: Everything should also work for case of checked-type itself is a type alias
|
base: FirClassLikeDeclaration<*>,
|
||||||
val type = coneTypeSafe<ConeKotlinType>()
|
arguments: Array<out ConeTypeProjection>
|
||||||
if (type !is ConeClassLikeType || type.typeArguments.isNotEmpty()) {
|
): Array<out ConeTypeProjection>? {
|
||||||
return this
|
val firClass = lookupTag.toSymbol(session)?.fir ?: return null
|
||||||
|
if (firClass !is FirTypeParameterRefsOwner || firClass.typeParameters.isEmpty()) return arrayOf()
|
||||||
|
return when (firClass) {
|
||||||
|
base -> arguments
|
||||||
|
is FirTypeAlias -> firClass.inheritTypeArguments(firClass.expandedTypeRef, base, arguments)
|
||||||
|
// TODO: if many supertypes, check consistency
|
||||||
|
is FirClass<*> -> firClass.superTypeRefs.mapNotNull { firClass.inheritTypeArguments(it, base, arguments) }.firstOrNull()
|
||||||
|
else -> null
|
||||||
}
|
}
|
||||||
val baseTypeArguments =
|
}
|
||||||
argument.typeRef.coneTypeSafe<ConeKotlinType>()?.fullyExpandedType(session)?.typeArguments
|
|
||||||
|
|
||||||
return if (baseTypeArguments?.isEmpty() != false) {
|
private fun FirTypeParameterRefsOwner.inheritTypeArguments(
|
||||||
this
|
typeRef: FirTypeRef,
|
||||||
} else {
|
base: FirClassLikeDeclaration<*>,
|
||||||
val typeParameters = (type.lookupTag.toSymbol(session)?.fir as? FirTypeParameterRefsOwner)?.typeParameters.orEmpty()
|
arguments: Array<out ConeTypeProjection>
|
||||||
if (typeParameters.isEmpty()) {
|
): Array<out ConeTypeProjection>? {
|
||||||
this
|
val type = typeRef.coneTypeSafe<ConeClassLikeType>() ?: return null
|
||||||
} else {
|
val indexMapping = typeParameters.map { parameter ->
|
||||||
withReplacedConeType(
|
// TODO: if many, check consistency of the result
|
||||||
type.withArguments(
|
type.typeArguments.indexOfFirst { it is ConeTypeParameterType && it.lookupTag.typeParameterSymbol == parameter.symbol }
|
||||||
if (baseTypeArguments.size > typeParameters.size) baseTypeArguments.take(typeParameters.size).toTypedArray()
|
|
||||||
else baseTypeArguments
|
|
||||||
)
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
if (indexMapping.any { it == -1 }) return null
|
||||||
|
|
||||||
|
val typeArguments = type.inheritTypeArguments(base, arguments) ?: return null
|
||||||
|
return Array(typeParameters.size) { typeArguments[indexMapping[it]] }
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun FirTypeRef.withTypeArgumentsForBareType(argument: FirExpression): FirTypeRef {
|
||||||
|
val type = coneTypeSafe<ConeClassLikeType>() ?: return this
|
||||||
|
if (type.typeArguments.isNotEmpty()) return this
|
||||||
|
|
||||||
|
val firClass = type.lookupTag.toSymbol(session)?.fir ?: return this
|
||||||
|
if (firClass !is FirTypeParameterRefsOwner || firClass.typeParameters.isEmpty()) return this
|
||||||
|
|
||||||
|
val baseType = argument.typeRef.coneTypeSafe<ConeClassLikeType>()?.fullyExpandedType(session) ?: return this
|
||||||
|
val baseFirClass = baseType.lookupTag.toSymbol(session)?.fir ?: return this
|
||||||
|
|
||||||
|
val newArguments = type.inheritTypeArguments(baseFirClass, baseType.typeArguments)
|
||||||
|
?: return buildErrorTypeRef {
|
||||||
|
source = this@withTypeArgumentsForBareType.source
|
||||||
|
diagnostic = ConeWrongNumberOfTypeArgumentsError(firClass.typeParameters.size, firClass.symbol)
|
||||||
|
}
|
||||||
|
return if (newArguments.isEmpty()) this else withReplacedConeType(type.withArguments(newArguments))
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun transformTypeOperatorCall(
|
override fun transformTypeOperatorCall(
|
||||||
|
|||||||
@@ -0,0 +1,19 @@
|
|||||||
|
sealed class C<out T, out U>
|
||||||
|
class A<out T>(val x: T) : C<T, Nothing>()
|
||||||
|
class B<out U>(val x: U) : C<Nothing, U>()
|
||||||
|
|
||||||
|
fun bar(x: String): C<Int, String> = B(x)
|
||||||
|
fun baz(x: Any) = "fail: $x"
|
||||||
|
fun baz(x: String) = x
|
||||||
|
|
||||||
|
typealias Z<U> = B<U>
|
||||||
|
|
||||||
|
fun box(): String =
|
||||||
|
when (val x = bar("O")) {
|
||||||
|
is A -> "fail??"
|
||||||
|
is B -> baz(x.x)
|
||||||
|
} + when (val y = bar("K")) {
|
||||||
|
is A -> "fail??"
|
||||||
|
is Z -> baz(y.x)
|
||||||
|
else -> "..."
|
||||||
|
}
|
||||||
@@ -4,7 +4,7 @@ interface Tr
|
|||||||
interface G<T>
|
interface G<T>
|
||||||
|
|
||||||
fun test(tr: Tr) {
|
fun test(tr: Tr) {
|
||||||
val v = tr as G?
|
val v = tr as <!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>G?<!>
|
||||||
// If v is not nullable, there will be a warning on this line:
|
// If v is not nullable, there will be a warning on this line:
|
||||||
checkSubtype<G<*>>(v!!)
|
<!INAPPLICABLE_CANDIDATE!>checkSubtype<!><G<*>>(v!!)
|
||||||
}
|
}
|
||||||
@@ -1,18 +0,0 @@
|
|||||||
// !CHECK_TYPE
|
|
||||||
|
|
||||||
interface Either<out A, out B>
|
|
||||||
interface Left<out A>: Either<A, Nothing>
|
|
||||||
interface Right<out B>: Either<Nothing, B>
|
|
||||||
|
|
||||||
class C1(val v1: Int)
|
|
||||||
class C2(val v2: Int)
|
|
||||||
|
|
||||||
fun _as_left(e: Either<C1, C2>): Any {
|
|
||||||
val v = e as Left
|
|
||||||
return checkSubtype<Left<C1>>(v)
|
|
||||||
}
|
|
||||||
|
|
||||||
fun _as_right(e: Either<C1, C2>): Any {
|
|
||||||
val v = e as Right
|
|
||||||
return <!INAPPLICABLE_CANDIDATE!>checkSubtype<!><Right<C2>>(v)
|
|
||||||
}
|
|
||||||
@@ -1,3 +1,4 @@
|
|||||||
|
// FIR_IDENTICAL
|
||||||
// !CHECK_TYPE
|
// !CHECK_TYPE
|
||||||
|
|
||||||
interface Either<out A, out B>
|
interface Either<out A, out B>
|
||||||
|
|||||||
@@ -1,25 +0,0 @@
|
|||||||
// !DIAGNOSTICS: -DEBUG_INFO_SMARTCAST
|
|
||||||
interface Either<out A, out B>
|
|
||||||
interface Left<out A>: Either<A, Nothing> {
|
|
||||||
val value: A
|
|
||||||
}
|
|
||||||
interface Right<out B>: Either<Nothing, B> {
|
|
||||||
val value: B
|
|
||||||
}
|
|
||||||
|
|
||||||
class C1(val v1: Int)
|
|
||||||
class C2(val v2: Int)
|
|
||||||
|
|
||||||
fun _is_l(e: Either<C1, C2>): Any {
|
|
||||||
if (e is Left) {
|
|
||||||
return e.value.v1
|
|
||||||
}
|
|
||||||
return e
|
|
||||||
}
|
|
||||||
|
|
||||||
fun _is_r(e: Either<C1, C2>): Any {
|
|
||||||
if (e is Right) {
|
|
||||||
return e.value.<!UNRESOLVED_REFERENCE!>v2<!>
|
|
||||||
}
|
|
||||||
return e
|
|
||||||
}
|
|
||||||
@@ -1,3 +1,4 @@
|
|||||||
|
// FIR_IDENTICAL
|
||||||
// !DIAGNOSTICS: -DEBUG_INFO_SMARTCAST
|
// !DIAGNOSTICS: -DEBUG_INFO_SMARTCAST
|
||||||
interface Either<out A, out B>
|
interface Either<out A, out B>
|
||||||
interface Left<out A>: Either<A, Nothing> {
|
interface Left<out A>: Either<A, Nothing> {
|
||||||
|
|||||||
@@ -1,25 +0,0 @@
|
|||||||
// !DIAGNOSTICS: -DEBUG_INFO_SMARTCAST
|
|
||||||
interface Either<out A, out B>
|
|
||||||
interface Left<out A>: Either<A, Nothing> {
|
|
||||||
val value: A
|
|
||||||
}
|
|
||||||
interface Right<out B>: Either<Nothing, B> {
|
|
||||||
val value: B
|
|
||||||
}
|
|
||||||
|
|
||||||
class C1(val v1: Int)
|
|
||||||
class C2(val v2: Int)
|
|
||||||
|
|
||||||
fun _is_l(e: Either<C1, C2>): Any {
|
|
||||||
if (e !is Left) {
|
|
||||||
return e
|
|
||||||
}
|
|
||||||
return e.value.v1
|
|
||||||
}
|
|
||||||
|
|
||||||
fun _is_r(e: Either<C1, C2>): Any {
|
|
||||||
if (e !is Right) {
|
|
||||||
return e
|
|
||||||
}
|
|
||||||
return e.value.<!UNRESOLVED_REFERENCE!>v2<!>
|
|
||||||
}
|
|
||||||
@@ -1,3 +1,4 @@
|
|||||||
|
// FIR_IDENTICAL
|
||||||
// !DIAGNOSTICS: -DEBUG_INFO_SMARTCAST
|
// !DIAGNOSTICS: -DEBUG_INFO_SMARTCAST
|
||||||
interface Either<out A, out B>
|
interface Either<out A, out B>
|
||||||
interface Left<out A>: Either<A, Nothing> {
|
interface Left<out A>: Either<A, Nothing> {
|
||||||
|
|||||||
@@ -1,18 +0,0 @@
|
|||||||
// !CHECK_TYPE
|
|
||||||
|
|
||||||
interface Either<out A, out B>
|
|
||||||
interface Left<out A>: Either<A, Nothing>
|
|
||||||
interface Right<out B>: Either<Nothing, B>
|
|
||||||
|
|
||||||
class C1(val v1: Int)
|
|
||||||
class C2(val v2: Int)
|
|
||||||
|
|
||||||
fun _as_left(e: Either<C1, C2>): Any? {
|
|
||||||
val v = e as? Left
|
|
||||||
return checkSubtype<Left<C1>?>(v)
|
|
||||||
}
|
|
||||||
|
|
||||||
fun _as_right(e: Either<C1, C2>): Any? {
|
|
||||||
val v = e as? Right
|
|
||||||
return <!INAPPLICABLE_CANDIDATE!>checkSubtype<!><Right<C2>?>(v)
|
|
||||||
}
|
|
||||||
@@ -1,3 +1,4 @@
|
|||||||
|
// FIR_IDENTICAL
|
||||||
// !CHECK_TYPE
|
// !CHECK_TYPE
|
||||||
|
|
||||||
interface Either<out A, out B>
|
interface Either<out A, out B>
|
||||||
|
|||||||
@@ -1,19 +0,0 @@
|
|||||||
// !DIAGNOSTICS: -DEBUG_INFO_SMARTCAST
|
|
||||||
interface Either<out A, out B>
|
|
||||||
interface Left<out A>: Either<A, Nothing> {
|
|
||||||
val value: A
|
|
||||||
}
|
|
||||||
interface Right<out B>: Either<Nothing, B> {
|
|
||||||
val value: B
|
|
||||||
}
|
|
||||||
|
|
||||||
class C1(val v1: Int)
|
|
||||||
class C2(val v2: Int)
|
|
||||||
|
|
||||||
fun _when(e: Either<C1, C2>): Any {
|
|
||||||
return when (e) {
|
|
||||||
is Left -> e.value.v1
|
|
||||||
is Right -> e.value.<!UNRESOLVED_REFERENCE!>v2<!>
|
|
||||||
else -> e
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,3 +1,4 @@
|
|||||||
|
// FIR_IDENTICAL
|
||||||
// !DIAGNOSTICS: -DEBUG_INFO_SMARTCAST
|
// !DIAGNOSTICS: -DEBUG_INFO_SMARTCAST
|
||||||
interface Either<out A, out B>
|
interface Either<out A, out B>
|
||||||
interface Left<out A>: Either<A, Nothing> {
|
interface Left<out A>: Either<A, Nothing> {
|
||||||
|
|||||||
@@ -4,6 +4,6 @@ interface Tr
|
|||||||
interface G<T>
|
interface G<T>
|
||||||
|
|
||||||
fun test(tr: Tr?) {
|
fun test(tr: Tr?) {
|
||||||
val v = tr as G
|
val v = tr as <!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>G<!>
|
||||||
checkSubtype<G<*>>(v)
|
<!INAPPLICABLE_CANDIDATE!>checkSubtype<!><G<*>>(v)
|
||||||
}
|
}
|
||||||
+2
-2
@@ -4,6 +4,6 @@ interface Tr
|
|||||||
interface G<T>
|
interface G<T>
|
||||||
|
|
||||||
fun test(tr: Tr?) {
|
fun test(tr: Tr?) {
|
||||||
val v = tr as G?
|
val v = tr as <!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>G?<!>
|
||||||
checkSubtype<G<*>>(v!!)
|
<!INAPPLICABLE_CANDIDATE!>checkSubtype<!><G<*>>(v!!)
|
||||||
}
|
}
|
||||||
@@ -4,6 +4,6 @@ interface Tr
|
|||||||
interface G<T>
|
interface G<T>
|
||||||
|
|
||||||
fun test(tr: Tr) {
|
fun test(tr: Tr) {
|
||||||
val v = tr as G
|
val v = tr as <!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>G<!>
|
||||||
checkSubtype<G<*>>(v)
|
<!INAPPLICABLE_CANDIDATE!>checkSubtype<!><G<*>>(v)
|
||||||
}
|
}
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
interface Tr
|
interface Tr
|
||||||
interface G<T>
|
interface G<T>
|
||||||
|
|
||||||
fun test(tr: Tr) = tr is G
|
fun test(tr: Tr) = tr is <!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>G<!>
|
||||||
@@ -2,13 +2,13 @@ package p
|
|||||||
|
|
||||||
public fun foo(a: Any) {
|
public fun foo(a: Any) {
|
||||||
a is Map<Int>
|
a is Map<Int>
|
||||||
a is Map
|
a is <!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>Map<!>
|
||||||
a is Map<out Any?, Any?>
|
a is Map<out Any?, Any?>
|
||||||
a is Map<*, *>
|
a is Map<*, *>
|
||||||
a is Map<<!SYNTAX!><!>>
|
a is Map<<!SYNTAX!><!>>
|
||||||
a is List<Map>
|
a is List<Map>
|
||||||
a is List
|
a is <!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>List<!>
|
||||||
a is Int
|
a is Int
|
||||||
|
|
||||||
(a as Map) is Int
|
(a as <!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>Map<!>) is Int
|
||||||
}
|
}
|
||||||
@@ -1,12 +1,12 @@
|
|||||||
public fun foo(a: Any, b: Map) {
|
public fun foo(a: Any, b: Map) {
|
||||||
when (a) {
|
when (a) {
|
||||||
is Map<Int> -> {}
|
is Map<Int> -> {}
|
||||||
is Map -> {}
|
is <!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>Map<!> -> {}
|
||||||
is Map<out Any?, Any?> -> {}
|
is Map<out Any?, Any?> -> {}
|
||||||
is Map<*, *> -> {}
|
is Map<*, *> -> {}
|
||||||
is Map<<!SYNTAX!><!>> -> {}
|
is Map<<!SYNTAX!><!>> -> {}
|
||||||
is List<Map> -> {}
|
is List<Map> -> {}
|
||||||
is List -> {}
|
is <!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>List<!> -> {}
|
||||||
is Int -> {}
|
is Int -> {}
|
||||||
else -> {}
|
else -> {}
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -8,7 +8,7 @@ class DerivedOuter<G> : SuperOuter<G>() {
|
|||||||
|
|
||||||
fun bare(x: SuperOuter<*>.SuperInner<*>, y: Any?) {
|
fun bare(x: SuperOuter<*>.SuperInner<*>, y: Any?) {
|
||||||
if (x is SuperOuter.SuperInner) return
|
if (x is SuperOuter.SuperInner) return
|
||||||
if (y is SuperOuter.SuperInner) {
|
if (y is <!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>SuperOuter.SuperInner<!>) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -12,7 +12,7 @@ class Outer<E> {
|
|||||||
x.prop.checkType { _<E>() }
|
x.prop.checkType { _<E>() }
|
||||||
}
|
}
|
||||||
|
|
||||||
if (y is Inner) return
|
if (y is <!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>Inner<!>) return
|
||||||
|
|
||||||
if (z is Inner) {
|
if (z is Inner) {
|
||||||
z.prop.checkType { _<Any?>() }
|
z.prop.checkType { _<Any?>() }
|
||||||
@@ -26,7 +26,7 @@ class Outer<E> {
|
|||||||
|
|
||||||
fun bar(x: InnerBase<String>, y: Any?, z: Outer<*>.InnerBase<String>) {
|
fun bar(x: InnerBase<String>, y: Any?, z: Outer<*>.InnerBase<String>) {
|
||||||
x as Inner
|
x as Inner
|
||||||
y as Inner
|
y as <!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>Inner<!>
|
||||||
z as Inner
|
z as Inner
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,8 +14,8 @@ fun testNL1(x: Collection<Int>?): Boolean = x is NL
|
|||||||
fun testNL2(x: Collection<Int>?): List<Int>? = x as NL
|
fun testNL2(x: Collection<Int>?): List<Int>? = x as NL
|
||||||
fun testNL3(x: Collection<Int>?): List<Int>? = x as NL?
|
fun testNL3(x: Collection<Int>?): List<Int>? = x as NL?
|
||||||
|
|
||||||
fun testLStar(x: Collection<Int>): List<Int> = x as LStar
|
fun testLStar(x: Collection<Int>): List<Int> = x as <!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>LStar<!>
|
||||||
fun testMyList(x: Collection<Int>): List<Int> = x as MyList
|
fun testMyList(x: Collection<Int>): List<Int> = x as <!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>MyList<!>
|
||||||
|
|
||||||
typealias MMTT<T> = MutableMap<T, T>
|
typealias MMTT<T> = MutableMap<T, T>
|
||||||
typealias Dictionary<T> = MutableMap<String, T>
|
typealias Dictionary<T> = MutableMap<String, T>
|
||||||
@@ -24,8 +24,8 @@ typealias ReadableList<T> = MutableList<out T>
|
|||||||
|
|
||||||
fun testWrong1(x: Map<Any, Any>) = x is MMTT
|
fun testWrong1(x: Map<Any, Any>) = x is MMTT
|
||||||
fun testWrong2(x: Map<Any, Any>) = x is Dictionary
|
fun testWrong2(x: Map<Any, Any>) = x is Dictionary
|
||||||
fun testWrong3(x: Map<Any, Any>) = x is WriteableMap
|
fun testWrong3(x: Map<Any, Any>) = x is <!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>WriteableMap<!>
|
||||||
fun testWrong4(x: List<Any>) = x is ReadableList
|
fun testWrong4(x: List<Any>) = x is <!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>ReadableList<!>
|
||||||
|
|
||||||
fun <T> testLocal(x: Any) {
|
fun <T> testLocal(x: Any) {
|
||||||
class C
|
class C
|
||||||
|
|||||||
+6
@@ -37312,6 +37312,12 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
|
|||||||
runTest("compiler/testData/codegen/box/when/implicitExhaustiveAndReturn.kt");
|
runTest("compiler/testData/codegen/box/when/implicitExhaustiveAndReturn.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("inferredTypeParameters.kt")
|
||||||
|
public void testInferredTypeParameters() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/when/inferredTypeParameters.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestMetadata("integralWhenWithNoInlinedConstants.kt")
|
@TestMetadata("integralWhenWithNoInlinedConstants.kt")
|
||||||
public void testIntegralWhenWithNoInlinedConstants() throws Exception {
|
public void testIntegralWhenWithNoInlinedConstants() throws Exception {
|
||||||
|
|||||||
+6
@@ -37112,6 +37112,12 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
|
|||||||
runTest("compiler/testData/codegen/box/when/implicitExhaustiveAndReturn.kt");
|
runTest("compiler/testData/codegen/box/when/implicitExhaustiveAndReturn.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("inferredTypeParameters.kt")
|
||||||
|
public void testInferredTypeParameters() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/when/inferredTypeParameters.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestMetadata("integralWhenWithNoInlinedConstants.kt")
|
@TestMetadata("integralWhenWithNoInlinedConstants.kt")
|
||||||
public void testIntegralWhenWithNoInlinedConstants() throws Exception {
|
public void testIntegralWhenWithNoInlinedConstants() throws Exception {
|
||||||
|
|||||||
+5
@@ -30617,6 +30617,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
|
|||||||
runTest("compiler/testData/codegen/box/when/implicitExhaustiveAndReturn.kt");
|
runTest("compiler/testData/codegen/box/when/implicitExhaustiveAndReturn.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("inferredTypeParameters.kt")
|
||||||
|
public void testInferredTypeParameters() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/when/inferredTypeParameters.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("integralWhenWithNoInlinedConstants.kt")
|
@TestMetadata("integralWhenWithNoInlinedConstants.kt")
|
||||||
public void testIntegralWhenWithNoInlinedConstants() throws Exception {
|
public void testIntegralWhenWithNoInlinedConstants() throws Exception {
|
||||||
runTest("compiler/testData/codegen/box/when/integralWhenWithNoInlinedConstants.kt");
|
runTest("compiler/testData/codegen/box/when/integralWhenWithNoInlinedConstants.kt");
|
||||||
|
|||||||
js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java
Generated
+5
@@ -26438,6 +26438,11 @@ public class IrJsCodegenBoxES6TestGenerated extends AbstractIrJsCodegenBoxES6Tes
|
|||||||
runTest("compiler/testData/codegen/box/when/implicitExhaustiveAndReturn.kt");
|
runTest("compiler/testData/codegen/box/when/implicitExhaustiveAndReturn.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("inferredTypeParameters.kt")
|
||||||
|
public void testInferredTypeParameters() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/when/inferredTypeParameters.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("integralWhenWithNoInlinedConstants.kt")
|
@TestMetadata("integralWhenWithNoInlinedConstants.kt")
|
||||||
public void testIntegralWhenWithNoInlinedConstants() throws Exception {
|
public void testIntegralWhenWithNoInlinedConstants() throws Exception {
|
||||||
runTest("compiler/testData/codegen/box/when/integralWhenWithNoInlinedConstants.kt");
|
runTest("compiler/testData/codegen/box/when/integralWhenWithNoInlinedConstants.kt");
|
||||||
|
|||||||
Generated
+5
@@ -26438,6 +26438,11 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest {
|
|||||||
runTest("compiler/testData/codegen/box/when/implicitExhaustiveAndReturn.kt");
|
runTest("compiler/testData/codegen/box/when/implicitExhaustiveAndReturn.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("inferredTypeParameters.kt")
|
||||||
|
public void testInferredTypeParameters() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/when/inferredTypeParameters.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("integralWhenWithNoInlinedConstants.kt")
|
@TestMetadata("integralWhenWithNoInlinedConstants.kt")
|
||||||
public void testIntegralWhenWithNoInlinedConstants() throws Exception {
|
public void testIntegralWhenWithNoInlinedConstants() throws Exception {
|
||||||
runTest("compiler/testData/codegen/box/when/integralWhenWithNoInlinedConstants.kt");
|
runTest("compiler/testData/codegen/box/when/integralWhenWithNoInlinedConstants.kt");
|
||||||
|
|||||||
Generated
+5
@@ -26403,6 +26403,11 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest {
|
|||||||
runTest("compiler/testData/codegen/box/when/implicitExhaustiveAndReturn.kt");
|
runTest("compiler/testData/codegen/box/when/implicitExhaustiveAndReturn.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("inferredTypeParameters.kt")
|
||||||
|
public void testInferredTypeParameters() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/when/inferredTypeParameters.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("integralWhenWithNoInlinedConstants.kt")
|
@TestMetadata("integralWhenWithNoInlinedConstants.kt")
|
||||||
public void testIntegralWhenWithNoInlinedConstants() throws Exception {
|
public void testIntegralWhenWithNoInlinedConstants() throws Exception {
|
||||||
runTest("compiler/testData/codegen/box/when/integralWhenWithNoInlinedConstants.kt");
|
runTest("compiler/testData/codegen/box/when/integralWhenWithNoInlinedConstants.kt");
|
||||||
|
|||||||
js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/wasm/semantics/IrCodegenBoxWasmTestGenerated.java
Generated
+5
@@ -14599,6 +14599,11 @@ public class IrCodegenBoxWasmTestGenerated extends AbstractIrCodegenBoxWasmTest
|
|||||||
runTest("compiler/testData/codegen/box/when/implicitExhaustiveAndReturn.kt");
|
runTest("compiler/testData/codegen/box/when/implicitExhaustiveAndReturn.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("inferredTypeParameters.kt")
|
||||||
|
public void testInferredTypeParameters() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/when/inferredTypeParameters.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("kt2457.kt")
|
@TestMetadata("kt2457.kt")
|
||||||
public void testKt2457() throws Exception {
|
public void testKt2457() throws Exception {
|
||||||
runTest("compiler/testData/codegen/box/when/kt2457.kt");
|
runTest("compiler/testData/codegen/box/when/kt2457.kt");
|
||||||
|
|||||||
Reference in New Issue
Block a user