[NI] Fix trace manipulations for builder inference and ::-expressions

For a class literal Type::class we are resolving Type as a constructor,
 getting all diagnostics (about missing arguments, for example) and then
 just not committing this trace with errors

 #KT-37626 Fixed
This commit is contained in:
Mikhail Zarechenskiy
2020-03-24 02:44:00 +03:00
parent 6213680604
commit 38a719cb22
13 changed files with 181 additions and 4 deletions
@@ -0,0 +1,38 @@
// !USE_EXPERIMENTAL: kotlin.RequiresOptIn
// !DIAGNOSTICS: -UNUSED_VARIABLE -UNUSED_PARAMETER -UNUSED_EXPRESSION
@file:OptIn(ExperimentalTypeInference::class)
package a.b
import kotlin.experimental.ExperimentalTypeInference
class BatchInfo1(val batchSize: Int)
class BatchInfo2<T>(val data: T)
object Obj
fun test1() {
val a: Sequence<String> = sequence {
val x = BatchInfo1::class
val y = a.b.BatchInfo1::class
val z = Obj::class
val x1 = BatchInfo1::batchSize
val y1 = a.b.BatchInfo1::class
}
}
interface Scope<T> {
fun yield(t: T) {}
}
fun <S> generate(@BuilderInference g: Scope<S>.() -> Unit): S = TODO()
val test2 = generate {
{ yield("foo") }::class
}
val test3 = generate {
({ yield("foo") })::class
}
@@ -0,0 +1,41 @@
package
package a {
package a.b {
public val test2: kotlin.String
public val test3: kotlin.String
public fun </*0*/ S> generate(/*0*/ @kotlin.BuilderInference g: a.b.Scope<S>.() -> kotlin.Unit): S
public fun test1(): kotlin.Unit
public final class BatchInfo1 {
public constructor BatchInfo1(/*0*/ batchSize: kotlin.Int)
public final val batchSize: kotlin.Int
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 BatchInfo2</*0*/ T> {
public constructor BatchInfo2</*0*/ T>(/*0*/ data: T)
public final val data: 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 object Obj {
private constructor Obj()
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 Scope</*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 open fun yield(/*0*/ t: T): kotlin.Unit
}
}
}