Render stub types properly
This commit is contained in:
+6
@@ -12638,6 +12638,12 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirDiagnosti
|
|||||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/tests/inference/builderInference"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true);
|
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/tests/inference/builderInference"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("renderingStubTypes.kt")
|
||||||
|
public void testRenderingStubTypes() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/inference/builderInference/renderingStubTypes.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestMetadata("simpleLambdaInCallWithAnotherLambdaWithBuilderInference.kt")
|
@TestMetadata("simpleLambdaInCallWithAnotherLambdaWithBuilderInference.kt")
|
||||||
public void testSimpleLambdaInCallWithAnotherLambdaWithBuilderInference() throws Exception {
|
public void testSimpleLambdaInCallWithAnotherLambdaWithBuilderInference() throws Exception {
|
||||||
|
|||||||
+6
@@ -12638,6 +12638,12 @@ public class FirOldFrontendDiagnosticsWithLightTreeTestGenerated extends Abstrac
|
|||||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/tests/inference/builderInference"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true);
|
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/tests/inference/builderInference"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("renderingStubTypes.kt")
|
||||||
|
public void testRenderingStubTypes() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/inference/builderInference/renderingStubTypes.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestMetadata("simpleLambdaInCallWithAnotherLambdaWithBuilderInference.kt")
|
@TestMetadata("simpleLambdaInCallWithAnotherLambdaWithBuilderInference.kt")
|
||||||
public void testSimpleLambdaInCallWithAnotherLambdaWithBuilderInference() throws Exception {
|
public void testSimpleLambdaInCallWithAnotherLambdaWithBuilderInference() throws Exception {
|
||||||
|
|||||||
+25
@@ -0,0 +1,25 @@
|
|||||||
|
// !DIAGNOSTICS: -UNUSED_PARAMETER -DEPRECATION -EXPERIMENTAL_IS_NOT_ENABLED -UNUSED_VARIABLE
|
||||||
|
// WITH_RUNTIME
|
||||||
|
|
||||||
|
import kotlin.experimental.ExperimentalTypeInference
|
||||||
|
|
||||||
|
@UseExperimental(ExperimentalTypeInference::class)
|
||||||
|
fun <R> build(
|
||||||
|
@BuilderInference block: TestInterface<R>.() -> Unit
|
||||||
|
): R = TODO()
|
||||||
|
|
||||||
|
class Inv<K>
|
||||||
|
|
||||||
|
interface TestInterface<R> {
|
||||||
|
fun emit(r: R)
|
||||||
|
fun get(): R
|
||||||
|
fun getInv(): Inv<R>
|
||||||
|
}
|
||||||
|
|
||||||
|
fun test() {
|
||||||
|
val ret = build {
|
||||||
|
emit(1)
|
||||||
|
get()
|
||||||
|
getInv()
|
||||||
|
}
|
||||||
|
}
|
||||||
+28
@@ -0,0 +1,28 @@
|
|||||||
|
// !DIAGNOSTICS: -UNUSED_PARAMETER -DEPRECATION -EXPERIMENTAL_IS_NOT_ENABLED -UNUSED_VARIABLE
|
||||||
|
// WITH_RUNTIME
|
||||||
|
|
||||||
|
import kotlin.experimental.ExperimentalTypeInference
|
||||||
|
|
||||||
|
@UseExperimental(ExperimentalTypeInference::class)
|
||||||
|
fun <R> build(
|
||||||
|
@BuilderInference block: TestInterface<R>.() -> Unit
|
||||||
|
): R = TODO()
|
||||||
|
|
||||||
|
class Inv<K>
|
||||||
|
|
||||||
|
interface TestInterface<R> {
|
||||||
|
fun emit(r: R)
|
||||||
|
fun get(): R
|
||||||
|
fun getInv(): Inv<R>
|
||||||
|
}
|
||||||
|
|
||||||
|
fun <U> id(x: U) = x
|
||||||
|
|
||||||
|
fun test() {
|
||||||
|
val ret = build {
|
||||||
|
emit("1")
|
||||||
|
<!DEBUG_INFO_EXPRESSION_TYPE("TypeVariable(R)")!>get()<!>
|
||||||
|
<!DEBUG_INFO_EXPRESSION_TYPE("Inv<TypeVariable(R)>")!>getInv()<!>
|
||||||
|
""
|
||||||
|
}
|
||||||
|
}
|
||||||
+21
@@ -0,0 +1,21 @@
|
|||||||
|
package
|
||||||
|
|
||||||
|
@kotlin.UseExperimental(markerClass = {kotlin.experimental.ExperimentalTypeInference::class}) public fun </*0*/ R> build(/*0*/ @kotlin.BuilderInference block: TestInterface<R>.() -> kotlin.Unit): R
|
||||||
|
public fun </*0*/ U> id(/*0*/ x: U): U
|
||||||
|
public fun test(): kotlin.Unit
|
||||||
|
|
||||||
|
public final class Inv</*0*/ K> {
|
||||||
|
public constructor Inv</*0*/ K>()
|
||||||
|
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 TestInterface</*0*/ R> {
|
||||||
|
public abstract fun emit(/*0*/ r: R): kotlin.Unit
|
||||||
|
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||||
|
public abstract fun get(): R
|
||||||
|
public abstract fun getInv(): Inv<R>
|
||||||
|
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||||
|
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||||
|
}
|
||||||
Generated
+6
@@ -12644,6 +12644,12 @@ public class DiagnosticTestGenerated extends AbstractDiagnosticTest {
|
|||||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/tests/inference/builderInference"), Pattern.compile("^(.*)\\.kts?$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true);
|
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/tests/inference/builderInference"), Pattern.compile("^(.*)\\.kts?$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("renderingStubTypes.kt")
|
||||||
|
public void testRenderingStubTypes() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/inference/builderInference/renderingStubTypes.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestMetadata("simpleLambdaInCallWithAnotherLambdaWithBuilderInference.kt")
|
@TestMetadata("simpleLambdaInCallWithAnotherLambdaWithBuilderInference.kt")
|
||||||
public void testSimpleLambdaInCallWithAnotherLambdaWithBuilderInference() throws Exception {
|
public void testSimpleLambdaInCallWithAnotherLambdaWithBuilderInference() throws Exception {
|
||||||
|
|||||||
@@ -236,19 +236,21 @@ internal class DescriptorRendererImpl(
|
|||||||
private fun StringBuilder.renderDefaultType(type: KotlinType) {
|
private fun StringBuilder.renderDefaultType(type: KotlinType) {
|
||||||
this.renderAnnotations(type)
|
this.renderAnnotations(type)
|
||||||
|
|
||||||
if (type.isError) {
|
when {
|
||||||
if (type is UnresolvedType && presentableUnresolvedTypes) {
|
type.isError -> {
|
||||||
append(type.presentableName)
|
if (type is UnresolvedType && presentableUnresolvedTypes) {
|
||||||
} else {
|
|
||||||
if (type is ErrorType && !informativeErrorType) {
|
|
||||||
append(type.presentableName)
|
append(type.presentableName)
|
||||||
} else {
|
} else {
|
||||||
append(type.constructor.toString()) // Debug name of an error type is more informative
|
if (type is ErrorType && !informativeErrorType) {
|
||||||
|
append(type.presentableName)
|
||||||
|
} else {
|
||||||
|
append(type.constructor.toString()) // Debug name of an error type is more informative
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
append(renderTypeArguments(type.arguments))
|
||||||
}
|
}
|
||||||
append(renderTypeArguments(type.arguments))
|
type is StubType -> append(type.originalTypeVariable.toString())
|
||||||
} else {
|
else -> renderTypeConstructorAndArguments(type)
|
||||||
renderTypeConstructorAndArguments(type)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (type.isMarkedNullable) {
|
if (type.isMarkedNullable) {
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ class StubTypeForProvideDelegateReceiver(
|
|||||||
}
|
}
|
||||||
|
|
||||||
abstract class AbstractStubType(
|
abstract class AbstractStubType(
|
||||||
protected val originalTypeVariable: TypeConstructor,
|
val originalTypeVariable: TypeConstructor,
|
||||||
override val isMarkedNullable: Boolean,
|
override val isMarkedNullable: Boolean,
|
||||||
override val constructor: TypeConstructor,
|
override val constructor: TypeConstructor,
|
||||||
override val memberScope: MemberScope
|
override val memberScope: MemberScope
|
||||||
|
|||||||
Reference in New Issue
Block a user