765cad8448
Consider the following code:
```
fun test(a: List<String>) {
a.first()
}
```
The dispatch receiver type of `first` in this case is `List<T>` before
this change. After this change, it's `List<String>`.
In addition, this change also replace the dispatch receiver type with
the more specific type if available. For example, consider the following
```
class MyList: ArrayList<String>()
fun test(a: MyList) {
a.get(0)
}
```
The dispatch receiver type of `get` is `MyList`, instead of
`ArrayList<String>`. That is, a fake override is created in this case.
63 lines
2.7 KiB
Plaintext
Vendored
63 lines
2.7 KiB
Plaintext
Vendored
FILE: valueOfOrNull.kt
|
|
public final enum class SomeEnum : R|kotlin/Enum<SomeEnum>| {
|
|
private constructor(): R|SomeEnum| {
|
|
super<R|kotlin/Enum<SomeEnum>|>()
|
|
}
|
|
|
|
public final static enum entry ENTRY: R|SomeEnum|
|
|
public final static fun values(): R|kotlin/Array<SomeEnum>| {
|
|
}
|
|
|
|
public final static fun valueOf(value: R|kotlin/String|): R|SomeEnum| {
|
|
}
|
|
|
|
}
|
|
public final fun foo(s: R|kotlin/String?|): R|kotlin/Unit| {
|
|
lval result: R|SomeEnum| = R|<local>/s|?.{ $subj$.R|kotlin/let|<R|kotlin/String|, R|SomeEnum?|>(<L> = let@fun <anonymous>(it: R|kotlin/String|): R|SomeEnum?| <inline=Inline, kind=EXACTLY_ONCE> {
|
|
^ R|/valueOfOrNull|<R|SomeEnum|>(R|<local>/it|)
|
|
}
|
|
) } ?: Q|SomeEnum|.R|/SomeEnum.ENTRY|
|
|
lval result2: R|SomeEnum| = R|<local>/s|?.{ $subj$.R|kotlin/let|<R|kotlin/String|, R|SomeEnum?|>(<L> = let@fun <anonymous>(it: R|kotlin/String|): R|SomeEnum?| <inline=Inline, kind=EXACTLY_ONCE> {
|
|
^ R|/valueOfOrNull|<R|SomeEnum|>(R|<local>/it|)
|
|
}
|
|
) } ?: Q|SomeEnum|.R|/SomeEnum.ENTRY|
|
|
lval result3: R|SomeEnum?| = when () {
|
|
==(R|<local>/s|, Null(null)) -> {
|
|
Q|SomeEnum|.R|/SomeEnum.ENTRY|
|
|
}
|
|
else -> {
|
|
R|/valueOfOrNull|<R|SomeEnum|>(R|<local>/s|)
|
|
}
|
|
}
|
|
|
|
lval result4: R|SomeEnum?| = when () {
|
|
==(R|<local>/s|, Null(null)) -> {
|
|
Q|SomeEnum|.R|/SomeEnum.ENTRY|
|
|
}
|
|
else -> {
|
|
R|<local>/s|.R|kotlin/let|<R|kotlin/String|, R|SomeEnum?|>(<L> = let@fun <anonymous>(it: R|kotlin/String|): R|SomeEnum?| <inline=Inline, kind=EXACTLY_ONCE> {
|
|
^ R|/valueOfOrNull|<R|SomeEnum|>(R|<local>/it|)
|
|
}
|
|
)
|
|
}
|
|
}
|
|
|
|
}
|
|
public final inline fun <reified E : R|kotlin/Enum<E>|> valueOfOrNull(value: R|kotlin/String|): R|E?| {
|
|
{
|
|
lval <iterator>: R|kotlin/collections/Iterator<E>| = R|kotlin/enumValues|<R|E|>().R|SubstitutionOverride<kotlin/Array.iterator: R|kotlin/collections/Iterator<E>|>|()
|
|
while(R|<local>/<iterator>|.R|SubstitutionOverride<kotlin/collections/Iterator.hasNext: R|kotlin/Boolean|>|()) {
|
|
lval enumValue: R|E| = R|<local>/<iterator>|.R|SubstitutionOverride<kotlin/collections/Iterator.next: R|E|>|()
|
|
when () {
|
|
==(R|<local>/enumValue|.R|SubstitutionOverride<kotlin/Enum.name: R|kotlin/String|>|, R|<local>/value|) -> {
|
|
^valueOfOrNull R|<local>/enumValue|
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
^valueOfOrNull Null(null)
|
|
}
|