[NI] Fix diagnostic reporting for missing type parameter info

#KT-31975 fixed
This commit is contained in:
Ilya Chernikov
2019-11-22 17:18:47 +01:00
parent 7dd9ed7e38
commit b3c5362003
7 changed files with 72 additions and 4 deletions
@@ -0,0 +1,18 @@
// !LANGUAGE: +NewInference
// !DIAGNOSTICS: -UNUSED_PARAMETER
interface MemoizedFunctionToNotNull<K, V>
fun <K, V : Any> createMemoizedFunction(compute: (K) -> V): MemoizedFunctionToNotNull<K, V> = TODO()
interface A
interface TypeConstructor
class Refiner {
val memoizedFunctionLambda = <!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>createMemoizedFunction<!> { <!DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE!>it<!>.<!DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE!>foo<!>() } // error type infered, no diagnostic, BAD, backend fails
val memoizedFunctionReference = createMemoizedFunction(TypeConstructor::<!EXTENSION_IN_CLASS_REFERENCE_NOT_ALLOWED!>foo<!>) // EXTENSION_IN_CLASS_REFERENCE_IS_NOT_ALLOWED, fine
val memoizedFunctionTypes = createMemoizedFunction<TypeConstructor, Boolean> { it.foo() } // works fine
private fun TypeConstructor.foo(): Boolean = true
}
@@ -0,0 +1,32 @@
package
public fun </*0*/ K, /*1*/ V : kotlin.Any> createMemoizedFunction(/*0*/ compute: (K) -> V): MemoizedFunctionToNotNull<K, V>
public interface 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 interface MemoizedFunctionToNotNull</*0*/ K, /*1*/ V> {
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 Refiner {
public constructor Refiner()
public final val memoizedFunctionLambda: [ERROR : Type for createMemoizedFunction { it.foo() }]
public final val memoizedFunctionReference: MemoizedFunctionToNotNull<TypeConstructor, kotlin.Boolean>
public final val memoizedFunctionTypes: MemoizedFunctionToNotNull<TypeConstructor, kotlin.Boolean>
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
private final fun TypeConstructor.foo(): kotlin.Boolean
}
public interface TypeConstructor {
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
}