[NI] Relax requirement for stub types in builder-inference

For functions with implicit return type annotations will be replaced
 anyway in order to initialize return type, so this restriction in
 `StubType` was too strong

 #KT-30656 Fixed
This commit is contained in:
Mikhail Zarechenskiy
2019-03-28 02:45:57 +03:00
parent b10d19dc78
commit d6db1a1b35
3 changed files with 4 additions and 6 deletions
@@ -28,10 +28,10 @@ val test2 = generate {
val test3 = <!OI;TYPE_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>generate<!> {
yield(3)
yieldBarReturnType(3)
<!NI;NON_APPLICABLE_CALL_FOR_BUILDER_INFERENCE!>yieldBarReturnType(3)<!>
}
val test4 = <!OI;TYPE_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>generate<!> {
yield(3)
barReturnType()
<!NI;NON_APPLICABLE_CALL_FOR_BUILDER_INFERENCE!>barReturnType()<!>
}
@@ -4,7 +4,7 @@ public val test1: kotlin.collections.List<kotlin.Int>
public val test2: kotlin.collections.List<kotlin.Int>
public val test3: kotlin.collections.List<kotlin.Int>
public val test4: kotlin.collections.List<kotlin.Int>
public fun </*0*/ S> generate(/*0*/ g: suspend GenericController<S>.() -> kotlin.Unit): kotlin.collections.List<S>
public fun </*0*/ S> generate(/*0*/ @kotlin.BuilderInference g: suspend GenericController<S>.() -> kotlin.Unit): kotlin.collections.List<S>
public final class GenericController</*0*/ T> {
public constructor GenericController</*0*/ T>()
@@ -24,9 +24,7 @@ class StubType(
override val annotations: Annotations
get() = Annotations.EMPTY
override fun replaceAnnotations(newAnnotations: Annotations): SimpleType {
error("Shouldn't be called on non-fixed type")
}
override fun replaceAnnotations(newAnnotations: Annotations): SimpleType = this
override fun makeNullableAsSpecified(newNullability: Boolean): SimpleType {
return if (newNullability == isMarkedNullable)