[NI] Support @OnlyInputTypes annotation. #KT-29307 fixed
This commit is contained in:
+6
@@ -62,6 +62,12 @@ class DiagnosticReporterByTrackingStrategy(
|
||||
val reportOn = (diagnostic as NonApplicableCallForBuilderInferenceDiagnostic).kotlinCall
|
||||
trace.reportDiagnosticOnce(Errors.NON_APPLICABLE_CALL_FOR_BUILDER_INFERENCE.on(reportOn.psiKotlinCall.psiCall.callElement))
|
||||
}
|
||||
OnlyInputTypesDiagnostic::class.java -> {
|
||||
val typeVariable = (diagnostic as OnlyInputTypesDiagnostic).typeVariable as? TypeVariableFromCallableDescriptor ?: return
|
||||
psiKotlinCall.psiCall.calleeExpression?.let {
|
||||
trace.report(TYPE_INFERENCE_ONLY_INPUT_TYPES.on(it, typeVariable.originalTypeParameter))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+15
@@ -8,9 +8,14 @@ package org.jetbrains.kotlin.resolve.calls.inference.model
|
||||
import org.jetbrains.kotlin.resolve.calls.inference.trimToSize
|
||||
import org.jetbrains.kotlin.resolve.calls.model.KotlinCallDiagnostic
|
||||
import org.jetbrains.kotlin.resolve.calls.tower.isSuccess
|
||||
import org.jetbrains.kotlin.types.KotlinType
|
||||
import org.jetbrains.kotlin.types.model.KotlinTypeMarker
|
||||
import org.jetbrains.kotlin.types.model.TypeConstructorMarker
|
||||
import org.jetbrains.kotlin.types.model.TypeVariableMarker
|
||||
import org.jetbrains.kotlin.types.TypeConstructor
|
||||
import org.jetbrains.kotlin.types.UnwrappedType
|
||||
import org.jetbrains.kotlin.types.checker.NewCapturedType
|
||||
import org.jetbrains.kotlin.types.typeUtil.unCapture
|
||||
import kotlin.collections.ArrayList
|
||||
import kotlin.collections.LinkedHashMap
|
||||
|
||||
@@ -27,6 +32,16 @@ class MutableVariableWithConstraints(
|
||||
return simplifiedConstraints!!
|
||||
}
|
||||
|
||||
// see @OnlyInputTypes annotation
|
||||
val projectedInputCallTypes: Collection<UnwrappedType>
|
||||
get() =
|
||||
mutableConstraints.filter {
|
||||
val position = it.position.from
|
||||
position is ArgumentConstraintPosition || position is ReceiverConstraintPosition || position is ExpectedTypeConstraintPosition
|
||||
}.map {
|
||||
(it.type as KotlinType).unCapture().unwrap()
|
||||
}
|
||||
|
||||
private val mutableConstraints = ArrayList(constraints)
|
||||
|
||||
private var simplifiedConstraints: List<Constraint>? = null
|
||||
|
||||
+26
-2
@@ -9,12 +9,16 @@ import org.jetbrains.kotlin.resolve.calls.components.PostponedArgumentsAnalyzer
|
||||
import org.jetbrains.kotlin.resolve.calls.inference.*
|
||||
import org.jetbrains.kotlin.resolve.calls.inference.components.ConstraintInjector
|
||||
import org.jetbrains.kotlin.resolve.calls.inference.components.KotlinConstraintSystemCompleter
|
||||
import org.jetbrains.kotlin.resolve.calls.inference.components.NewTypeSubstitutor
|
||||
import org.jetbrains.kotlin.resolve.calls.inference.components.ResultTypeResolver
|
||||
import org.jetbrains.kotlin.resolve.calls.model.KotlinCallDiagnostic
|
||||
import org.jetbrains.kotlin.resolve.calls.model.OnlyInputTypesDiagnostic
|
||||
import org.jetbrains.kotlin.types.IntersectionTypeConstructor
|
||||
import org.jetbrains.kotlin.types.KotlinType
|
||||
import org.jetbrains.kotlin.types.checker.NewCapturedType
|
||||
import org.jetbrains.kotlin.types.checker.NewKotlinTypeChecker
|
||||
import org.jetbrains.kotlin.types.model.*
|
||||
import org.jetbrains.kotlin.utils.SmartList
|
||||
import org.jetbrains.kotlin.utils.addToStdlib.safeAs
|
||||
import kotlin.math.max
|
||||
|
||||
class NewConstraintSystemImpl(
|
||||
@@ -247,7 +251,8 @@ class NewConstraintSystemImpl(
|
||||
checkState(State.BUILDING, State.COMPLETION)
|
||||
|
||||
constraintInjector.addInitialEqualityConstraint(this, variable.defaultType(), resultType, FixVariableConstraintPosition(variable))
|
||||
notFixedTypeVariables.remove(variable.freshTypeConstructor())
|
||||
val variableWithConstraints = notFixedTypeVariables.remove(variable.freshTypeConstructor())
|
||||
checkOnlyInputTypesAnnotation(variableWithConstraints, resultType)
|
||||
|
||||
for (variableWithConstraint in notFixedTypeVariables.values) {
|
||||
variableWithConstraint.removeConstrains {
|
||||
@@ -258,6 +263,25 @@ class NewConstraintSystemImpl(
|
||||
storage.fixedTypeVariables[variable.freshTypeConstructor()] = resultType
|
||||
}
|
||||
|
||||
private fun checkOnlyInputTypesAnnotation(
|
||||
variableWithConstraints: MutableVariableWithConstraints?,
|
||||
resultType: KotlinTypeMarker
|
||||
) {
|
||||
if (resultType !is KotlinType) return
|
||||
if (variableWithConstraints == null || variableWithConstraints.typeVariable.safeAs<NewTypeVariable>()?.hasOnlyInputTypesAnnotation() != true ) return
|
||||
val projectedInputCallTypes = variableWithConstraints.projectedInputCallTypes
|
||||
val resultTypeIsInputType = projectedInputCallTypes.any { inputType ->
|
||||
val constructor = inputType.constructor
|
||||
if (constructor is IntersectionTypeConstructor)
|
||||
constructor.supertypes.any { NewKotlinTypeChecker.equalTypes(resultType, it) }
|
||||
else
|
||||
NewKotlinTypeChecker.equalTypes(resultType, inputType)
|
||||
}
|
||||
if (!resultTypeIsInputType) {
|
||||
addError(OnlyInputTypesDiagnostic(variableWithConstraints.typeVariable as NewTypeVariable))
|
||||
}
|
||||
}
|
||||
|
||||
// KotlinConstraintSystemCompleter.Context, PostponedArgumentsAnalyzer.Context
|
||||
override fun canBeProper(type: KotlinTypeMarker): Boolean {
|
||||
checkState(State.BUILDING, State.COMPLETION)
|
||||
|
||||
+9
-2
@@ -22,6 +22,7 @@ import org.jetbrains.kotlin.descriptors.TypeParameterDescriptor
|
||||
import org.jetbrains.kotlin.descriptors.annotations.Annotations
|
||||
import org.jetbrains.kotlin.resolve.calls.model.LambdaKotlinCallArgument
|
||||
import org.jetbrains.kotlin.resolve.descriptorUtil.builtIns
|
||||
import org.jetbrains.kotlin.resolve.descriptorUtil.hasOnlyInputTypesAnnotation
|
||||
import org.jetbrains.kotlin.types.KotlinType
|
||||
import org.jetbrains.kotlin.types.KotlinTypeFactory
|
||||
import org.jetbrains.kotlin.types.SimpleType
|
||||
@@ -53,15 +54,21 @@ sealed class NewTypeVariable(builtIns: KotlinBuiltIns, name: String) : TypeVaria
|
||||
nullable = false, memberScope = builtIns.any.unsubstitutedMemberScope
|
||||
)
|
||||
|
||||
abstract fun hasOnlyInputTypesAnnotation(): Boolean
|
||||
|
||||
override fun toString() = freshTypeConstructor.toString()
|
||||
}
|
||||
|
||||
class TypeVariableFromCallableDescriptor(
|
||||
val originalTypeParameter: TypeParameterDescriptor
|
||||
) : NewTypeVariable(originalTypeParameter.builtIns, originalTypeParameter.name.identifier)
|
||||
) : NewTypeVariable(originalTypeParameter.builtIns, originalTypeParameter.name.identifier) {
|
||||
override fun hasOnlyInputTypesAnnotation(): Boolean = originalTypeParameter.hasOnlyInputTypesAnnotation()
|
||||
}
|
||||
|
||||
class TypeVariableForLambdaReturnType(
|
||||
val lambdaArgument: LambdaKotlinCallArgument,
|
||||
builtIns: KotlinBuiltIns,
|
||||
name: String
|
||||
) : NewTypeVariable(builtIns, name)
|
||||
) : NewTypeVariable(builtIns, name) {
|
||||
override fun hasOnlyInputTypesAnnotation(): Boolean = false
|
||||
}
|
||||
|
||||
+7
@@ -20,6 +20,7 @@ import org.jetbrains.kotlin.descriptors.CallableDescriptor
|
||||
import org.jetbrains.kotlin.descriptors.CallableMemberDescriptor
|
||||
import org.jetbrains.kotlin.descriptors.ValueParameterDescriptor
|
||||
import org.jetbrains.kotlin.resolve.calls.components.CallableReferenceCandidate
|
||||
import org.jetbrains.kotlin.resolve.calls.inference.model.NewTypeVariable
|
||||
import org.jetbrains.kotlin.resolve.calls.tower.ResolutionCandidateApplicability.*
|
||||
import org.jetbrains.kotlin.types.TypeConstructor
|
||||
import org.jetbrains.kotlin.types.UnwrappedType
|
||||
@@ -195,4 +196,10 @@ class ArgumentTypeMismatchDiagnostic(
|
||||
override fun report(reporter: DiagnosticReporter) {
|
||||
reporter.onCallArgument(expressionArgument, this)
|
||||
}
|
||||
}
|
||||
|
||||
class OnlyInputTypesDiagnostic(val typeVariable: NewTypeVariable) : KotlinCallDiagnostic(INAPPLICABLE) {
|
||||
override fun report(reporter: DiagnosticReporter) {
|
||||
reporter.onCall(this)
|
||||
}
|
||||
}
|
||||
@@ -4,7 +4,7 @@ interface A
|
||||
class B : A
|
||||
fun foo1(list: List<A>, arg: B?): Boolean {
|
||||
// Type mismatch
|
||||
return arg <!OI;TYPE_INFERENCE_ONLY_INPUT_TYPES!>in<!> list // resolved to extension
|
||||
return arg <!TYPE_INFERENCE_ONLY_INPUT_TYPES!>in<!> list // resolved to extension
|
||||
}
|
||||
fun foo2(list: List<A>, arg: B?): Boolean {
|
||||
// FAKE: no cast needed
|
||||
|
||||
@@ -4,7 +4,7 @@ import java.util.*
|
||||
fun foo() {
|
||||
val al = ArrayList<String>()
|
||||
al.size
|
||||
al.contains(<!OI;CONSTANT_EXPECTED_TYPE_MISMATCH!>1<!>)
|
||||
al.<!NI;TYPE_INFERENCE_ONLY_INPUT_TYPES!>contains<!>(<!OI;CONSTANT_EXPECTED_TYPE_MISMATCH!>1<!>)
|
||||
al.contains("")
|
||||
|
||||
al.remove("")
|
||||
@@ -12,7 +12,7 @@ fun foo() {
|
||||
|
||||
val hs = HashSet<String>()
|
||||
hs.size
|
||||
hs.contains(<!OI;CONSTANT_EXPECTED_TYPE_MISMATCH!>1<!>)
|
||||
hs.<!NI;TYPE_INFERENCE_ONLY_INPUT_TYPES!>contains<!>(<!OI;CONSTANT_EXPECTED_TYPE_MISMATCH!>1<!>)
|
||||
hs.contains("")
|
||||
|
||||
hs.remove("")
|
||||
@@ -20,10 +20,10 @@ fun foo() {
|
||||
|
||||
val hm = HashMap<String, Int>()
|
||||
hm.size
|
||||
hm.containsKey(<!OI;CONSTANT_EXPECTED_TYPE_MISMATCH!>1<!>)
|
||||
hm.<!NI;TYPE_INFERENCE_ONLY_INPUT_TYPES!>containsKey<!>(<!OI;CONSTANT_EXPECTED_TYPE_MISMATCH!>1<!>)
|
||||
hm.containsKey("")
|
||||
|
||||
hm[<!OI;CONSTANT_EXPECTED_TYPE_MISMATCH!>1<!>]
|
||||
<!NI;TYPE_INFERENCE_ONLY_INPUT_TYPES!>hm[<!OI;CONSTANT_EXPECTED_TYPE_MISMATCH!>1<!>]<!>
|
||||
hm[""]
|
||||
|
||||
hm.remove("")
|
||||
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER -UNUSED_VARIABLE
|
||||
// !WITH_NEW_INFERENCE
|
||||
|
||||
open class Base()
|
||||
class CX : Base()
|
||||
class CY : Base()
|
||||
|
||||
@Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE")
|
||||
fun <@kotlin.internal.OnlyInputTypes T> foo(a: T, b: T) {}
|
||||
|
||||
@Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE")
|
||||
fun <@kotlin.internal.OnlyInputTypes T : Any> fooA(a: T, b: T) {}
|
||||
|
||||
@Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE")
|
||||
fun <@kotlin.internal.OnlyInputTypes T : Base> fooB(a: T, b: T) {}
|
||||
|
||||
|
||||
fun usage(x: CX, y: CY) {
|
||||
<!TYPE_INFERENCE_ONLY_INPUT_TYPES!>foo<!>(x, y) // expected err, got err
|
||||
<!NI;TYPE_INFERENCE_ONLY_INPUT_TYPES!>fooA<!>(x, y) // expected err, got ok
|
||||
<!NI;TYPE_INFERENCE_ONLY_INPUT_TYPES!>fooB<!>(x, y) // expected err, got ok
|
||||
}
|
||||
+27
@@ -0,0 +1,27 @@
|
||||
package
|
||||
|
||||
@kotlin.Suppress(names = {"INVISIBLE_MEMBER", "INVISIBLE_REFERENCE"}) public fun </*0*/ @kotlin.internal.OnlyInputTypes T> foo(/*0*/ a: T, /*1*/ b: T): kotlin.Unit
|
||||
@kotlin.Suppress(names = {"INVISIBLE_MEMBER", "INVISIBLE_REFERENCE"}) public fun </*0*/ @kotlin.internal.OnlyInputTypes T : kotlin.Any> fooA(/*0*/ a: T, /*1*/ b: T): kotlin.Unit
|
||||
@kotlin.Suppress(names = {"INVISIBLE_MEMBER", "INVISIBLE_REFERENCE"}) public fun </*0*/ @kotlin.internal.OnlyInputTypes T : Base> fooB(/*0*/ a: T, /*1*/ b: T): kotlin.Unit
|
||||
public fun usage(/*0*/ x: CX, /*1*/ y: CY): kotlin.Unit
|
||||
|
||||
public open class Base {
|
||||
public constructor Base()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public final class CX : Base {
|
||||
public constructor CX()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public final class CY : Base {
|
||||
public constructor CY()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
+31
@@ -0,0 +1,31 @@
|
||||
// !DIAGNOSTICS: -UNUSED_VARIABLE
|
||||
// !WITH_NEW_INFERENCE
|
||||
// ISSUE: KT-29307
|
||||
|
||||
fun test_1(map: Map<String, String>) {
|
||||
val x = <!NI;TYPE_INFERENCE_ONLY_INPUT_TYPES!>map[<!OI;CONSTANT_EXPECTED_TYPE_MISMATCH!>42<!>]<!> // OK
|
||||
}
|
||||
|
||||
open class A
|
||||
|
||||
class B : A()
|
||||
|
||||
fun test_2(map: Map<A, String>) {
|
||||
val x = <!NI;TYPE_INFERENCE_ONLY_INPUT_TYPES!>map[<!OI;CONSTANT_EXPECTED_TYPE_MISMATCH!>42<!>]<!>
|
||||
}
|
||||
|
||||
fun test_3(m: Map<*, String>) {
|
||||
val x = <!NI;TYPE_INFERENCE_ONLY_INPUT_TYPES!>m[42]<!> // should be ok
|
||||
}
|
||||
|
||||
fun test_4(m: Map<out Number, String>) {
|
||||
val x = m.<!NI;TYPE_INFERENCE_ONLY_INPUT_TYPES!>get<!>(42) // should be ok
|
||||
}
|
||||
|
||||
fun test_5(map: Map<B, Int>, a: A) {
|
||||
map.get(a)
|
||||
}
|
||||
|
||||
fun test_6(map: Map<A, Int>, b: B) {
|
||||
map.get(b)
|
||||
}
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
package
|
||||
|
||||
public fun test_1(/*0*/ map: kotlin.collections.Map<kotlin.String, kotlin.String>): kotlin.Unit
|
||||
public fun test_2(/*0*/ map: kotlin.collections.Map<A, kotlin.String>): kotlin.Unit
|
||||
public fun test_3(/*0*/ m: kotlin.collections.Map<*, kotlin.String>): kotlin.Unit
|
||||
public fun test_4(/*0*/ m: kotlin.collections.Map<out kotlin.Number, kotlin.String>): kotlin.Unit
|
||||
public fun test_5(/*0*/ map: kotlin.collections.Map<B, kotlin.Int>, /*1*/ a: A): kotlin.Unit
|
||||
public fun test_6(/*0*/ map: kotlin.collections.Map<A, kotlin.Int>, /*1*/ b: B): kotlin.Unit
|
||||
|
||||
public open class A {
|
||||
public constructor A()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public final class B : A {
|
||||
public constructor B()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
Vendored
+47
@@ -0,0 +1,47 @@
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER -UNUSED_VARIABLE
|
||||
// !WITH_NEW_INFERENCE
|
||||
|
||||
@Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE")
|
||||
public fun <@kotlin.internal.OnlyInputTypes T> Iterable<T>.contains1(element: T): Boolean = null!!
|
||||
|
||||
class In<in T>
|
||||
|
||||
class Out<out T>
|
||||
|
||||
class Inv<T>
|
||||
|
||||
fun test_1(list: List<In<Number>>, x: In<Number>, y: In<Int>, z: In<Any>) {
|
||||
list.contains1(x)
|
||||
list.contains1(y)
|
||||
list.contains1(z)
|
||||
}
|
||||
|
||||
fun test_2(list: List<In<Int>>, x: In<Int>, y: In<Number>, z: In<Any>) {
|
||||
list.contains1(x)
|
||||
list.contains1(y)
|
||||
list.contains1(z)
|
||||
}
|
||||
|
||||
fun test_3(list: List<Out<Number>>, x: Out<Number>, y: Out<Int>, z: Out<Any>) {
|
||||
list.contains1(x)
|
||||
list.contains1(y)
|
||||
list.contains1(z)
|
||||
}
|
||||
|
||||
fun test_4(list: List<Out<Int>>, x: Out<Int>, y: Out<Number>, z: Out<Any>) {
|
||||
list.contains1(x)
|
||||
list.contains1(y)
|
||||
list.contains1(z)
|
||||
}
|
||||
|
||||
fun test_5(list: List<Inv<Number>>, x: Inv<Number>, y: Inv<Int>, z: Inv<Any>) {
|
||||
list.contains1(x)
|
||||
list.<!TYPE_INFERENCE_ONLY_INPUT_TYPES!>contains1<!>(y)
|
||||
list.<!TYPE_INFERENCE_ONLY_INPUT_TYPES!>contains1<!>(z)
|
||||
}
|
||||
|
||||
fun test_6(list: List<Inv<Int>>, x: Inv<Int>, y: Inv<Number>, z: Inv<Any>) {
|
||||
list.contains1(x)
|
||||
list.<!TYPE_INFERENCE_ONLY_INPUT_TYPES!>contains1<!>(y)
|
||||
list.<!TYPE_INFERENCE_ONLY_INPUT_TYPES!>contains1<!>(z)
|
||||
}
|
||||
Vendored
+30
@@ -0,0 +1,30 @@
|
||||
package
|
||||
|
||||
public fun test_1(/*0*/ list: kotlin.collections.List<In<kotlin.Number>>, /*1*/ x: In<kotlin.Number>, /*2*/ y: In<kotlin.Int>, /*3*/ z: In<kotlin.Any>): kotlin.Unit
|
||||
public fun test_2(/*0*/ list: kotlin.collections.List<In<kotlin.Int>>, /*1*/ x: In<kotlin.Int>, /*2*/ y: In<kotlin.Number>, /*3*/ z: In<kotlin.Any>): kotlin.Unit
|
||||
public fun test_3(/*0*/ list: kotlin.collections.List<Out<kotlin.Number>>, /*1*/ x: Out<kotlin.Number>, /*2*/ y: Out<kotlin.Int>, /*3*/ z: Out<kotlin.Any>): kotlin.Unit
|
||||
public fun test_4(/*0*/ list: kotlin.collections.List<Out<kotlin.Int>>, /*1*/ x: Out<kotlin.Int>, /*2*/ y: Out<kotlin.Number>, /*3*/ z: Out<kotlin.Any>): kotlin.Unit
|
||||
public fun test_5(/*0*/ list: kotlin.collections.List<Inv<kotlin.Number>>, /*1*/ x: Inv<kotlin.Number>, /*2*/ y: Inv<kotlin.Int>, /*3*/ z: Inv<kotlin.Any>): kotlin.Unit
|
||||
public fun test_6(/*0*/ list: kotlin.collections.List<Inv<kotlin.Int>>, /*1*/ x: Inv<kotlin.Int>, /*2*/ y: Inv<kotlin.Number>, /*3*/ z: Inv<kotlin.Any>): kotlin.Unit
|
||||
@kotlin.Suppress(names = {"INVISIBLE_MEMBER", "INVISIBLE_REFERENCE"}) public fun </*0*/ @kotlin.internal.OnlyInputTypes T> kotlin.collections.Iterable<T>.contains1(/*0*/ element: T): kotlin.Boolean
|
||||
|
||||
public final class In</*0*/ in T> {
|
||||
public constructor In</*0*/ in T>()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public final class Inv</*0*/ T> {
|
||||
public constructor Inv</*0*/ T>()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public final class Out</*0*/ out T> {
|
||||
public constructor Out</*0*/ out T>()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
+2
-2
@@ -18,9 +18,9 @@ public fun <K, V> Map<K, V>.get1(key: Any?): Int = null!!
|
||||
public fun <@kotlin.internal.OnlyInputTypes K, V> Map<out K, V>.get1(key: K): V? = null!!
|
||||
|
||||
fun test(map: Map<Int, String>) {
|
||||
val a: Int = <!NI;TYPE_MISMATCH!>listOf(1).<!NI;TYPE_MISMATCH, OI;TYPE_INFERENCE_EXPECTED_TYPE_MISMATCH!>contains1("")<!><!>
|
||||
val a: Int = <!NI;TYPE_MISMATCH!>listOf(1).<!NI;TYPE_MISMATCH, OI;TYPE_INFERENCE_EXPECTED_TYPE_MISMATCH!><!NI;TYPE_INFERENCE_ONLY_INPUT_TYPES!>contains1<!>("")<!><!>
|
||||
val b: Boolean = listOf(1).contains1(1)
|
||||
|
||||
val c: String? = map.<!OI;TYPE_INFERENCE_ONLY_INPUT_TYPES!>get1<!>("")
|
||||
val c: String? = map.<!TYPE_INFERENCE_ONLY_INPUT_TYPES!>get1<!>("")
|
||||
val d: String? = map.get1(1)
|
||||
}
|
||||
+113
@@ -0,0 +1,113 @@
|
||||
// !WITH_NEW_INFERENCE
|
||||
// !DIAGNOSTICS: -UNUSED_VARIABLE -UNUSED_PARAMETER
|
||||
// Issue: KT-26698
|
||||
|
||||
@Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE")
|
||||
public fun <@kotlin.internal.OnlyInputTypes T> Iterable<T>.contains1(element: T): Boolean = null!!
|
||||
|
||||
@Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE")
|
||||
public fun <@kotlin.internal.OnlyInputTypes T> Iterable<T>.foo(element: T): T = null!!
|
||||
|
||||
class Inv<T>
|
||||
class Inv2<T, R>
|
||||
|
||||
class In<in T>
|
||||
class Out<out T>
|
||||
|
||||
// -------------------------------------------------------
|
||||
|
||||
fun test_0(x: Inv2<in Number, out Number>, list: List<Inv2<Any, Int>>) {
|
||||
list.<!NI;TYPE_INFERENCE_ONLY_INPUT_TYPES!>foo<!>(x)
|
||||
}
|
||||
|
||||
// ------------------------- Inv -------------------------
|
||||
|
||||
fun test_1(x: Inv<Number>, list: List<Inv<Number>>) {
|
||||
list.contains1(x)
|
||||
}
|
||||
|
||||
fun test_2(x: Inv<Number>, list: List<Inv<Int>>) {
|
||||
list.<!TYPE_INFERENCE_ONLY_INPUT_TYPES!>contains1<!>(x)
|
||||
}
|
||||
|
||||
fun test_3(x: Inv<Number>, list: List<Inv<Any>>) {
|
||||
list.<!TYPE_INFERENCE_ONLY_INPUT_TYPES!>contains1<!>(x)
|
||||
}
|
||||
|
||||
fun test_4(x: Inv<in Number>, list: List<Inv<Any>>) {
|
||||
list.<!NI;TYPE_INFERENCE_ONLY_INPUT_TYPES!>contains1<!>(x)
|
||||
}
|
||||
|
||||
fun test_5(x: Inv<in Number>, list: List<Inv<Number>>) {
|
||||
list.<!NI;TYPE_INFERENCE_ONLY_INPUT_TYPES!>contains1<!>(x)
|
||||
}
|
||||
|
||||
fun test_6(x: Inv<in Number>, list: List<Inv<Int>>) {
|
||||
list.<!TYPE_INFERENCE_ONLY_INPUT_TYPES!>contains1<!>(x)
|
||||
}
|
||||
|
||||
fun test_7(x: Inv<out Number>, list: List<Inv<Any>>) {
|
||||
list.<!TYPE_INFERENCE_ONLY_INPUT_TYPES!>contains1<!>(x)
|
||||
}
|
||||
|
||||
fun test_8(x: Inv<out Number>, list: List<Inv<Number>>) {
|
||||
list.contains1(x)
|
||||
}
|
||||
|
||||
fun test_9(x: Inv<out Number>, list: List<Inv<Int>>) {
|
||||
list.contains1(x)
|
||||
}
|
||||
|
||||
// ------------------------- In -------------------------
|
||||
|
||||
fun test_11(x: In<Number>, list: List<In<Number>>) {
|
||||
list.contains1(x)
|
||||
}
|
||||
|
||||
fun test_12(x: In<Number>, list: List<In<Int>>) {
|
||||
list.contains1(x)
|
||||
}
|
||||
|
||||
fun test_13(x: In<Number>, list: List<In<Any>>) {
|
||||
list.contains1(x)
|
||||
}
|
||||
|
||||
// ------------------------- Out -------------------------
|
||||
|
||||
fun test_21(x: Out<Number>, list: List<Out<Number>>) {
|
||||
list.contains1(x)
|
||||
}
|
||||
|
||||
fun test_22(x: Out<Number>, list: List<Out<Int>>) {
|
||||
list.contains1(x)
|
||||
}
|
||||
|
||||
fun test_23(x: Out<Number>, list: List<Out<Any>>) {
|
||||
list.contains1(x)
|
||||
}
|
||||
|
||||
// --------------------------------------------------------
|
||||
|
||||
fun test_31(x: Inv<Number>, list: List<Inv<in Number>>) {
|
||||
list.contains1(x)
|
||||
}
|
||||
|
||||
fun test_32(x: Inv<Number>, list: List<Inv<in Int>>) {
|
||||
list.contains1(x)
|
||||
}
|
||||
|
||||
fun test_33(x: Inv<Number>, list: List<Inv<in Any>>) {
|
||||
list.<!TYPE_INFERENCE_ONLY_INPUT_TYPES!>contains1<!>(x)
|
||||
}
|
||||
|
||||
fun test_34(x: Inv<Number>, list: List<Inv<out Number>>) {
|
||||
list.contains1(x)
|
||||
}
|
||||
|
||||
fun test_35(x: Inv<Number>, list: List<Inv<out Int>>) {
|
||||
list.<!TYPE_INFERENCE_ONLY_INPUT_TYPES!>contains1<!>(x)
|
||||
}
|
||||
|
||||
fun test_36(x: Inv<Number>, list: List<Inv<out Any>>) {
|
||||
list.contains1(x)
|
||||
}
|
||||
+54
@@ -0,0 +1,54 @@
|
||||
package
|
||||
|
||||
public fun test_0(/*0*/ x: Inv2<in kotlin.Number, out kotlin.Number>, /*1*/ list: kotlin.collections.List<Inv2<kotlin.Any, kotlin.Int>>): kotlin.Unit
|
||||
public fun test_1(/*0*/ x: Inv<kotlin.Number>, /*1*/ list: kotlin.collections.List<Inv<kotlin.Number>>): kotlin.Unit
|
||||
public fun test_11(/*0*/ x: In<kotlin.Number>, /*1*/ list: kotlin.collections.List<In<kotlin.Number>>): kotlin.Unit
|
||||
public fun test_12(/*0*/ x: In<kotlin.Number>, /*1*/ list: kotlin.collections.List<In<kotlin.Int>>): kotlin.Unit
|
||||
public fun test_13(/*0*/ x: In<kotlin.Number>, /*1*/ list: kotlin.collections.List<In<kotlin.Any>>): kotlin.Unit
|
||||
public fun test_2(/*0*/ x: Inv<kotlin.Number>, /*1*/ list: kotlin.collections.List<Inv<kotlin.Int>>): kotlin.Unit
|
||||
public fun test_21(/*0*/ x: Out<kotlin.Number>, /*1*/ list: kotlin.collections.List<Out<kotlin.Number>>): kotlin.Unit
|
||||
public fun test_22(/*0*/ x: Out<kotlin.Number>, /*1*/ list: kotlin.collections.List<Out<kotlin.Int>>): kotlin.Unit
|
||||
public fun test_23(/*0*/ x: Out<kotlin.Number>, /*1*/ list: kotlin.collections.List<Out<kotlin.Any>>): kotlin.Unit
|
||||
public fun test_3(/*0*/ x: Inv<kotlin.Number>, /*1*/ list: kotlin.collections.List<Inv<kotlin.Any>>): kotlin.Unit
|
||||
public fun test_31(/*0*/ x: Inv<kotlin.Number>, /*1*/ list: kotlin.collections.List<Inv<in kotlin.Number>>): kotlin.Unit
|
||||
public fun test_32(/*0*/ x: Inv<kotlin.Number>, /*1*/ list: kotlin.collections.List<Inv<in kotlin.Int>>): kotlin.Unit
|
||||
public fun test_33(/*0*/ x: Inv<kotlin.Number>, /*1*/ list: kotlin.collections.List<Inv<in kotlin.Any>>): kotlin.Unit
|
||||
public fun test_34(/*0*/ x: Inv<kotlin.Number>, /*1*/ list: kotlin.collections.List<Inv<out kotlin.Number>>): kotlin.Unit
|
||||
public fun test_35(/*0*/ x: Inv<kotlin.Number>, /*1*/ list: kotlin.collections.List<Inv<out kotlin.Int>>): kotlin.Unit
|
||||
public fun test_36(/*0*/ x: Inv<kotlin.Number>, /*1*/ list: kotlin.collections.List<Inv<out kotlin.Any>>): kotlin.Unit
|
||||
public fun test_4(/*0*/ x: Inv<in kotlin.Number>, /*1*/ list: kotlin.collections.List<Inv<kotlin.Any>>): kotlin.Unit
|
||||
public fun test_5(/*0*/ x: Inv<in kotlin.Number>, /*1*/ list: kotlin.collections.List<Inv<kotlin.Number>>): kotlin.Unit
|
||||
public fun test_6(/*0*/ x: Inv<in kotlin.Number>, /*1*/ list: kotlin.collections.List<Inv<kotlin.Int>>): kotlin.Unit
|
||||
public fun test_7(/*0*/ x: Inv<out kotlin.Number>, /*1*/ list: kotlin.collections.List<Inv<kotlin.Any>>): kotlin.Unit
|
||||
public fun test_8(/*0*/ x: Inv<out kotlin.Number>, /*1*/ list: kotlin.collections.List<Inv<kotlin.Number>>): kotlin.Unit
|
||||
public fun test_9(/*0*/ x: Inv<out kotlin.Number>, /*1*/ list: kotlin.collections.List<Inv<kotlin.Int>>): kotlin.Unit
|
||||
@kotlin.Suppress(names = {"INVISIBLE_MEMBER", "INVISIBLE_REFERENCE"}) public fun </*0*/ @kotlin.internal.OnlyInputTypes T> kotlin.collections.Iterable<T>.contains1(/*0*/ element: T): kotlin.Boolean
|
||||
@kotlin.Suppress(names = {"INVISIBLE_MEMBER", "INVISIBLE_REFERENCE"}) public fun </*0*/ @kotlin.internal.OnlyInputTypes T> kotlin.collections.Iterable<T>.foo(/*0*/ element: T): T
|
||||
|
||||
public final class In</*0*/ in T> {
|
||||
public constructor In</*0*/ in T>()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public final class Inv</*0*/ T> {
|
||||
public constructor Inv</*0*/ T>()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public final class Inv2</*0*/ T, /*1*/ R> {
|
||||
public constructor Inv2</*0*/ T, /*1*/ R>()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public final class Out</*0*/ out T> {
|
||||
public constructor Out</*0*/ out T>()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
+1
-1
@@ -11,7 +11,7 @@ class D
|
||||
|
||||
fun test1(a: A, b: B, c: C) {
|
||||
assertEquals1(a, b)
|
||||
<!OI;TYPE_INFERENCE_ONLY_INPUT_TYPES!>assertEquals1<!>(b, c)
|
||||
<!TYPE_INFERENCE_ONLY_INPUT_TYPES!>assertEquals1<!>(b, c)
|
||||
|
||||
assertEquals1(3, 3)
|
||||
assertEquals1(1 or 2, 2 or 1)
|
||||
|
||||
+8
-8
@@ -28,8 +28,8 @@ fun main() {
|
||||
|
||||
"" in (hm as Map<String, Int>)
|
||||
"" !in (hm as Map<String, Int>)
|
||||
1 <!OI;TYPE_INFERENCE_CONFLICTING_SUBSTITUTIONS!>in<!> (hm as Map<String, Int>)
|
||||
1 <!OI;TYPE_INFERENCE_CONFLICTING_SUBSTITUTIONS!>!in<!> (hm as Map<String, Int>)
|
||||
1 <!NI;TYPE_INFERENCE_ONLY_INPUT_TYPES, OI;TYPE_INFERENCE_CONFLICTING_SUBSTITUTIONS!>in<!> (hm as Map<String, Int>)
|
||||
1 <!NI;TYPE_INFERENCE_ONLY_INPUT_TYPES, OI;TYPE_INFERENCE_CONFLICTING_SUBSTITUTIONS!>!in<!> (hm as Map<String, Int>)
|
||||
|
||||
val a = A()
|
||||
"" <!CONCURRENT_HASH_MAP_CONTAINS_OPERATOR!>in<!> a
|
||||
@@ -44,8 +44,8 @@ fun main() {
|
||||
|
||||
"" in (a as Map<String, Int>)
|
||||
"" !in (a as Map<String, Int>)
|
||||
1 <!OI;TYPE_INFERENCE_CONFLICTING_SUBSTITUTIONS!>in<!> (a as Map<String, Int>)
|
||||
1 <!OI;TYPE_INFERENCE_CONFLICTING_SUBSTITUTIONS!>!in<!> (a as Map<String, Int>)
|
||||
1 <!NI;TYPE_INFERENCE_ONLY_INPUT_TYPES, OI;TYPE_INFERENCE_CONFLICTING_SUBSTITUTIONS!>in<!> (a as Map<String, Int>)
|
||||
1 <!NI;TYPE_INFERENCE_ONLY_INPUT_TYPES, OI;TYPE_INFERENCE_CONFLICTING_SUBSTITUTIONS!>!in<!> (a as Map<String, Int>)
|
||||
|
||||
val b = B()
|
||||
"" <!CONCURRENT_HASH_MAP_CONTAINS_OPERATOR!>in<!> b
|
||||
@@ -58,8 +58,8 @@ fun main() {
|
||||
|
||||
"" in (b as Map<String, Int>)
|
||||
"" !in (b as Map<String, Int>)
|
||||
1 <!OI;TYPE_INFERENCE_CONFLICTING_SUBSTITUTIONS!>in<!> (b as Map<String, Int>)
|
||||
1 <!OI;TYPE_INFERENCE_CONFLICTING_SUBSTITUTIONS!>!in<!> (b as Map<String, Int>)
|
||||
1 <!NI;TYPE_INFERENCE_ONLY_INPUT_TYPES, OI;TYPE_INFERENCE_CONFLICTING_SUBSTITUTIONS!>in<!> (b as Map<String, Int>)
|
||||
1 <!NI;TYPE_INFERENCE_ONLY_INPUT_TYPES, OI;TYPE_INFERENCE_CONFLICTING_SUBSTITUTIONS!>!in<!> (b as Map<String, Int>)
|
||||
|
||||
// Actually, we could've allow calls here because the owner explicitly declared as operator, but semantics is still weird
|
||||
val c = C()
|
||||
@@ -73,7 +73,7 @@ fun main() {
|
||||
|
||||
"" in (c as Map<String, Int>)
|
||||
"" !in (c as Map<String, Int>)
|
||||
1 <!OI;TYPE_INFERENCE_CONFLICTING_SUBSTITUTIONS!>in<!> (c as Map<String, Int>)
|
||||
1 <!OI;TYPE_INFERENCE_CONFLICTING_SUBSTITUTIONS!>!in<!> (c as Map<String, Int>)
|
||||
1 <!NI;TYPE_INFERENCE_ONLY_INPUT_TYPES, OI;TYPE_INFERENCE_CONFLICTING_SUBSTITUTIONS!>in<!> (c as Map<String, Int>)
|
||||
1 <!NI;TYPE_INFERENCE_ONLY_INPUT_TYPES, OI;TYPE_INFERENCE_CONFLICTING_SUBSTITUTIONS!>!in<!> (c as Map<String, Int>)
|
||||
}
|
||||
|
||||
|
||||
+8
-8
@@ -29,8 +29,8 @@ fun main() {
|
||||
|
||||
"" in (hm as Map<String, Int>)
|
||||
"" !in (hm as Map<String, Int>)
|
||||
1 <!OI;TYPE_INFERENCE_CONFLICTING_SUBSTITUTIONS!>in<!> (hm as Map<String, Int>)
|
||||
1 <!OI;TYPE_INFERENCE_CONFLICTING_SUBSTITUTIONS!>!in<!> (hm as Map<String, Int>)
|
||||
1 <!NI;TYPE_INFERENCE_ONLY_INPUT_TYPES, OI;TYPE_INFERENCE_CONFLICTING_SUBSTITUTIONS!>in<!> (hm as Map<String, Int>)
|
||||
1 <!NI;TYPE_INFERENCE_ONLY_INPUT_TYPES, OI;TYPE_INFERENCE_CONFLICTING_SUBSTITUTIONS!>!in<!> (hm as Map<String, Int>)
|
||||
|
||||
val a = A()
|
||||
"" <!CONCURRENT_HASH_MAP_CONTAINS_OPERATOR_ERROR!>in<!> a
|
||||
@@ -45,8 +45,8 @@ fun main() {
|
||||
|
||||
"" in (a as Map<String, Int>)
|
||||
"" !in (a as Map<String, Int>)
|
||||
1 <!OI;TYPE_INFERENCE_CONFLICTING_SUBSTITUTIONS!>in<!> (a as Map<String, Int>)
|
||||
1 <!OI;TYPE_INFERENCE_CONFLICTING_SUBSTITUTIONS!>!in<!> (a as Map<String, Int>)
|
||||
1 <!NI;TYPE_INFERENCE_ONLY_INPUT_TYPES, OI;TYPE_INFERENCE_CONFLICTING_SUBSTITUTIONS!>in<!> (a as Map<String, Int>)
|
||||
1 <!NI;TYPE_INFERENCE_ONLY_INPUT_TYPES, OI;TYPE_INFERENCE_CONFLICTING_SUBSTITUTIONS!>!in<!> (a as Map<String, Int>)
|
||||
|
||||
val b = B()
|
||||
"" <!CONCURRENT_HASH_MAP_CONTAINS_OPERATOR_ERROR!>in<!> b
|
||||
@@ -59,8 +59,8 @@ fun main() {
|
||||
|
||||
"" in (b as Map<String, Int>)
|
||||
"" !in (b as Map<String, Int>)
|
||||
1 <!OI;TYPE_INFERENCE_CONFLICTING_SUBSTITUTIONS!>in<!> (b as Map<String, Int>)
|
||||
1 <!OI;TYPE_INFERENCE_CONFLICTING_SUBSTITUTIONS!>!in<!> (b as Map<String, Int>)
|
||||
1 <!NI;TYPE_INFERENCE_ONLY_INPUT_TYPES, OI;TYPE_INFERENCE_CONFLICTING_SUBSTITUTIONS!>in<!> (b as Map<String, Int>)
|
||||
1 <!NI;TYPE_INFERENCE_ONLY_INPUT_TYPES, OI;TYPE_INFERENCE_CONFLICTING_SUBSTITUTIONS!>!in<!> (b as Map<String, Int>)
|
||||
|
||||
// Actually, we could've allow calls here because the owner explicitly declared as operator, but semantics is still weird
|
||||
val c = C()
|
||||
@@ -74,7 +74,7 @@ fun main() {
|
||||
|
||||
"" in (c as Map<String, Int>)
|
||||
"" !in (c as Map<String, Int>)
|
||||
1 <!OI;TYPE_INFERENCE_CONFLICTING_SUBSTITUTIONS!>in<!> (c as Map<String, Int>)
|
||||
1 <!OI;TYPE_INFERENCE_CONFLICTING_SUBSTITUTIONS!>!in<!> (c as Map<String, Int>)
|
||||
1 <!NI;TYPE_INFERENCE_ONLY_INPUT_TYPES, OI;TYPE_INFERENCE_CONFLICTING_SUBSTITUTIONS!>in<!> (c as Map<String, Int>)
|
||||
1 <!NI;TYPE_INFERENCE_ONLY_INPUT_TYPES, OI;TYPE_INFERENCE_CONFLICTING_SUBSTITUTIONS!>!in<!> (c as Map<String, Int>)
|
||||
}
|
||||
|
||||
|
||||
@@ -30,6 +30,6 @@ fun test2(): Map<Int, Int> = run {
|
||||
<!NI;TYPE_MISMATCH, NI;TYPE_MISMATCH, NI;TYPE_MISMATCH, NI;TYPE_MISMATCH, NI;TYPE_MISMATCH, NI;TYPE_MISMATCH, NI;TYPE_MISMATCH, NI;TYPE_MISMATCH!>try {
|
||||
emptyMap()
|
||||
} catch (e: ExcA) {
|
||||
<!NI;TYPE_MISMATCH, NI;TYPE_MISMATCH, OI;TYPE_INFERENCE_EXPECTED_TYPE_MISMATCH!>mapOf(<!NI;TYPE_MISMATCH, NI;TYPE_MISMATCH!>"" to ""<!>)<!>
|
||||
<!OI;TYPE_INFERENCE_EXPECTED_TYPE_MISMATCH!>mapOf("" to "")<!>
|
||||
}<!>
|
||||
}
|
||||
@@ -26,7 +26,6 @@ open class Case1<K : Number> {
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("L & kotlin.Any?"), DEBUG_INFO_SMARTCAST!>x<!>.get(0)
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("M & kotlin.Any?"), DEBUG_INFO_SMARTCAST!>x<!>.size
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("M & kotlin.Any?"), DEBUG_INFO_SMARTCAST!>x<!>.isEmpty()
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("M & kotlin.Any?"), DEBUG_INFO_SMARTCAST!>x<!>[null]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,7 +26,6 @@ open class Case1<K : Number> {
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("L & kotlin.Any?"), DEBUG_INFO_SMARTCAST!>x<!>.get(0)
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("M & kotlin.Any?"), DEBUG_INFO_SMARTCAST!>x<!>.size
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("M & kotlin.Any?"), DEBUG_INFO_SMARTCAST!>x<!>.isEmpty()
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("M & kotlin.Any?"), DEBUG_INFO_SMARTCAST!>x<!>[null]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,7 +26,6 @@ open class Case1<K : Number> {
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("L & kotlin.Any?"), DEBUG_INFO_SMARTCAST!>x<!>.get(0)
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("M & kotlin.Any?"), DEBUG_INFO_SMARTCAST!>x<!>.size
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("M & kotlin.Any?"), DEBUG_INFO_SMARTCAST!>x<!>.isEmpty()
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("M & kotlin.Any?"), DEBUG_INFO_SMARTCAST!>x<!>[null]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+20
@@ -2743,6 +2743,16 @@ public class DiagnosticsTestWithStdLibGenerated extends AbstractDiagnosticsTestW
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/inference/annotationsForResolve/internalAnnotationsOnTypes.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt26698.kt")
|
||||
public void testKt26698() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/inference/annotationsForResolve/kt26698.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt29307.kt")
|
||||
public void testKt29307() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/inference/annotationsForResolve/kt29307.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("noInferAndLowPriority.kt")
|
||||
public void testNoInferAndLowPriority() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/inference/annotationsForResolve/noInferAndLowPriority.kt");
|
||||
@@ -2758,6 +2768,11 @@ public class DiagnosticsTestWithStdLibGenerated extends AbstractDiagnosticsTestW
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/inference/annotationsForResolve/notNullAnnotation.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("onlyInputTypes.kt")
|
||||
public void testOnlyInputTypes() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/inference/annotationsForResolve/onlyInputTypes.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("onlyInputTypesAndLowPriority.kt")
|
||||
public void testOnlyInputTypesAndLowPriority() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/inference/annotationsForResolve/onlyInputTypesAndLowPriority.kt");
|
||||
@@ -2768,6 +2783,11 @@ public class DiagnosticsTestWithStdLibGenerated extends AbstractDiagnosticsTestW
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/inference/annotationsForResolve/onlyInputTypesAnnotationWithPlatformTypes.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("onlyInputTypesCaptured.kt")
|
||||
public void testOnlyInputTypesCaptured() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/inference/annotationsForResolve/onlyInputTypesCaptured.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("propagationOfNoInferAnnotation.kt")
|
||||
public void testPropagationOfNoInferAnnotation() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/inference/annotationsForResolve/propagationOfNoInferAnnotation.kt");
|
||||
|
||||
compiler/tests/org/jetbrains/kotlin/checkers/javac/DiagnosticsTestWithStdLibUsingJavacGenerated.java
Generated
+20
@@ -2743,6 +2743,16 @@ public class DiagnosticsTestWithStdLibUsingJavacGenerated extends AbstractDiagno
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/inference/annotationsForResolve/internalAnnotationsOnTypes.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt26698.kt")
|
||||
public void testKt26698() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/inference/annotationsForResolve/kt26698.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt29307.kt")
|
||||
public void testKt29307() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/inference/annotationsForResolve/kt29307.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("noInferAndLowPriority.kt")
|
||||
public void testNoInferAndLowPriority() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/inference/annotationsForResolve/noInferAndLowPriority.kt");
|
||||
@@ -2758,6 +2768,11 @@ public class DiagnosticsTestWithStdLibUsingJavacGenerated extends AbstractDiagno
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/inference/annotationsForResolve/notNullAnnotation.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("onlyInputTypes.kt")
|
||||
public void testOnlyInputTypes() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/inference/annotationsForResolve/onlyInputTypes.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("onlyInputTypesAndLowPriority.kt")
|
||||
public void testOnlyInputTypesAndLowPriority() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/inference/annotationsForResolve/onlyInputTypesAndLowPriority.kt");
|
||||
@@ -2768,6 +2783,11 @@ public class DiagnosticsTestWithStdLibUsingJavacGenerated extends AbstractDiagno
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/inference/annotationsForResolve/onlyInputTypesAnnotationWithPlatformTypes.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("onlyInputTypesCaptured.kt")
|
||||
public void testOnlyInputTypesCaptured() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/inference/annotationsForResolve/onlyInputTypesCaptured.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("propagationOfNoInferAnnotation.kt")
|
||||
public void testPropagationOfNoInferAnnotation() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/inference/annotationsForResolve/propagationOfNoInferAnnotation.kt");
|
||||
|
||||
Reference in New Issue
Block a user