Fix for SOE in VarianceChecker #KT-13401 Fixed
This commit is contained in:
+15
@@ -0,0 +1,15 @@
|
|||||||
|
// See KT-13401: SOE in VarianceChecker
|
||||||
|
interface Rec<T: Rec<T>> {
|
||||||
|
fun t(): T
|
||||||
|
}
|
||||||
|
interface Super<out U> {
|
||||||
|
fun foo(p: Rec<*>) = p.t()
|
||||||
|
}
|
||||||
|
// Related variance errors
|
||||||
|
class Owner<in T> {
|
||||||
|
inner class Inner<U : <!TYPE_VARIANCE_CONFLICT!>T<!>>(val u: U) {
|
||||||
|
fun getT() = u
|
||||||
|
}
|
||||||
|
|
||||||
|
fun foo(arg: Inner<*>) = arg.getT()
|
||||||
|
}
|
||||||
+32
@@ -0,0 +1,32 @@
|
|||||||
|
package
|
||||||
|
|
||||||
|
public final class Owner</*0*/ in T> {
|
||||||
|
public constructor Owner</*0*/ in T>()
|
||||||
|
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||||
|
public final fun foo(/*0*/ arg: Owner<T>.Inner<*>): kotlin.Any?
|
||||||
|
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||||
|
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||||
|
|
||||||
|
public final inner class Inner</*0*/ U : T> /*captured type parameters: /*1*/ in T*/ {
|
||||||
|
public constructor Inner</*0*/ U : T>(/*0*/ u: U)
|
||||||
|
public final val u: U
|
||||||
|
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||||
|
public final fun getT(): U
|
||||||
|
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||||
|
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public interface Rec</*0*/ T : Rec<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 abstract fun t(): T
|
||||||
|
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||||
|
}
|
||||||
|
|
||||||
|
public interface Super</*0*/ out U> {
|
||||||
|
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||||
|
public open fun foo(/*0*/ p: Rec<*>): Rec<*>
|
||||||
|
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||||
|
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||||
|
}
|
||||||
@@ -355,6 +355,12 @@ public class DiagnosticsTestGenerated extends AbstractDiagnosticsTest {
|
|||||||
doTest(fileName);
|
doTest(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("kt13401.kt")
|
||||||
|
public void testKt13401() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/kt13401.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("kt310.kt")
|
@TestMetadata("kt310.kt")
|
||||||
public void testKt310() throws Exception {
|
public void testKt310() throws Exception {
|
||||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/kt310.kt");
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/kt310.kt");
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ fun <D : TypeHolder<D>> D.checkTypePosition(
|
|||||||
|
|
||||||
var noError = true
|
var noError = true
|
||||||
for (argument in arguments) {
|
for (argument in arguments) {
|
||||||
if (argument == null || argument.typeParameter == null) continue
|
if (argument == null || argument.typeParameter == null || argument.projection.isStarProjection) continue
|
||||||
|
|
||||||
val projectionKind = TypeCheckingProcedure.getEffectiveProjectionKind(argument.typeParameter!!, argument.projection)!!
|
val projectionKind = TypeCheckingProcedure.getEffectiveProjectionKind(argument.typeParameter!!, argument.projection)!!
|
||||||
val newPosition = when (projectionKind) {
|
val newPosition = when (projectionKind) {
|
||||||
|
|||||||
@@ -0,0 +1,7 @@
|
|||||||
|
// See KT-13401
|
||||||
|
interface Rec<T: Rec<T>> {
|
||||||
|
fun t(): T
|
||||||
|
}
|
||||||
|
interface Super<U> {
|
||||||
|
fun foo(p: Rec<*>) = p.t()
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user