Place inference from getters under the language feature

This commit is contained in:
Mikhail Zarechenskiy
2016-12-19 20:16:56 +03:00
parent c6a812b11c
commit 35e732a97f
5 changed files with 119 additions and 1 deletions
@@ -0,0 +1,69 @@
// !LANGUAGE: -ShortSyntaxForPropertyGetters
// blockBodyGetter.kt
<!UNSUPPORTED_FEATURE!>val x get() {
return 1
}<!>
// cantBeInferred.kt
<!UNSUPPORTED_FEATURE!>val x1 get() = <!TYPE_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>foo<!>()<!>
<!UNSUPPORTED_FEATURE!>val y1 get() = <!TYPE_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>bar<!>()<!>
fun <E> foo(): E = null!!
fun <E> bar(): List<E> = null!!
// explicitGetterType.kt
<!UNSUPPORTED_FEATURE!>val x2 get(): String = foo()<!>
<!UNSUPPORTED_FEATURE!>val y2 get(): List<Int> = bar()<!>
<!UNSUPPORTED_FEATURE!>val z2 get(): List<Int> {
return bar()
}<!>
<!MUST_BE_INITIALIZED!>val u<!> get(): String = field
// members.kt
class A {
<!UNSUPPORTED_FEATURE!>val x get() = 1<!>
<!UNSUPPORTED_FEATURE!>val y get() = id(1)<!>
<!UNSUPPORTED_FEATURE!>val y2 get() = id(id(2))<!>
<!UNSUPPORTED_FEATURE!>val z get() = l("")<!>
<!UNSUPPORTED_FEATURE!>val z2 get() = l(id(l("")))<!>
<!UNSUPPORTED_FEATURE!>val <T> T.u get() = id(this)<!>
}
fun <E> id(x: E) = x
fun <E> l(<!UNUSED_PARAMETER!>x<!>: E): List<E> = null!!
// vars
<!UNSUPPORTED_FEATURE!>var x3
get() = 1
set(q) {
}<!>
// recursive
<!UNSUPPORTED_FEATURE!>val x4 get() = <!TYPECHECKER_HAS_RUN_INTO_RECURSIVE_PROBLEM!>x4<!><!>
// null as nothing
<!UNSUPPORTED_FEATURE!>val x5 get() = null<!>
<!UNSUPPORTED_FEATURE!>val <!IMPLICIT_NOTHING_PROPERTY_TYPE!>y5<!> get() = null!!<!>
// objectExpression.kt
object Outer {
<!UNSUPPORTED_FEATURE!>private var x
get() = object : CharSequence {
override val length: Int
get() = 0
override fun get(index: Int): Char {
return ' '
}
override fun subSequence(startIndex: Int, endIndex: Int) = ""
fun bar() {
}
}
set(q) {
x = q
}<!>
}
@@ -0,0 +1,38 @@
package
public val u: kotlin.String
public val x: [ERROR : No type, no body]
public val x1: [ERROR : Error function type]
public val x2: kotlin.String
public var x3: kotlin.Int
public val x4: [ERROR : Error function type]
public val x5: kotlin.Nothing?
public val y1: [ERROR : Error function type]
public val y2: kotlin.collections.List<kotlin.Int>
public val y5: kotlin.Nothing
public val z2: kotlin.collections.List<kotlin.Int>
public fun </*0*/ E> bar(): kotlin.collections.List<E>
public fun </*0*/ E> foo(): E
public fun </*0*/ E> id(/*0*/ x: E): E
public fun </*0*/ E> l(/*0*/ x: E): kotlin.collections.List<E>
public final class A {
public constructor A()
public final val x: kotlin.Int
public final val y: kotlin.Int
public final val y2: kotlin.Int
public final val z: kotlin.collections.List<kotlin.String>
public final val z2: kotlin.collections.List<kotlin.collections.List<kotlin.String>>
public final val </*0*/ T> T.u: 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 Outer {
private constructor Outer()
private final var x: Outer.<get-x>.<no name provided>
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
}