[FIR] Add empty member scope for type variables

This commit is contained in:
Dmitriy Novozhilov
2020-02-28 15:43:37 +03:00
parent 985311d9f0
commit e3f1f18ca3
7 changed files with 71 additions and 1 deletions
@@ -64,7 +64,7 @@ fun ConeKotlinType.scope(useSiteSession: FirSession, scopeSession: ScopeSession)
FirIntegerLiteralTypeScope(useSiteSession)
} as FirScope
}
else -> error("Failed type $this")
else -> null
}
}
@@ -0,0 +1,8 @@
inline fun <L> runLogged(action: () -> L): L {
return action()
}
operator fun <V> V.getValue(receiver: Any?, p: Any): V =
runLogged { this }
val testK by runLogged { "K" }
@@ -0,0 +1,17 @@
FILE: extensionGenericGetValue.kt
public final inline fun <L> runLogged(action: R|() -> L|): R|L| {
^runLogged R|<local>/action|.R|FakeOverride<kotlin/Function0.invoke: R|L|>|()
}
public final operator fun <V> R|V|.getValue(receiver: R|kotlin/Any?|, p: R|kotlin/Any|): R|V| {
^getValue R|/runLogged|<R|V|>(<L> = runLogged@fun <anonymous>(): R|V| <kind=UNKNOWN> {
^ this@R|/getValue|
}
)
}
public final val testK: R|kotlin/String|by R|/runLogged|<R|kotlin/String|>(<L> = runLogged@fun <anonymous>(): R|kotlin/String| <kind=UNKNOWN> {
^ String(K)
}
)
public get(): R|kotlin/String| {
^ D|/testK|.R|/getValue|<R|kotlin/String|>(Null(null), ::R|/testK|)
}
@@ -0,0 +1,8 @@
inline fun <L> runLogged(action: () -> L): L {
return action()
}
operator fun String.getValue(receiver: Any?, p: Any): String =
runLogged { this }
val testK by runLogged { "K" }
@@ -0,0 +1,17 @@
FILE: extensionGetValueWithTypeVariableAsReceiver.kt
public final inline fun <L> runLogged(action: R|() -> L|): R|L| {
^runLogged R|<local>/action|.R|FakeOverride<kotlin/Function0.invoke: R|L|>|()
}
public final operator fun R|kotlin/String|.getValue(receiver: R|kotlin/Any?|, p: R|kotlin/Any|): R|kotlin/String| {
^getValue R|/runLogged|<R|kotlin/String|>(<L> = runLogged@fun <anonymous>(): R|kotlin/String| <kind=UNKNOWN> {
^ this@R|/getValue|
}
)
}
public final val testK: R|kotlin/String|by R|/runLogged|<R|kotlin/String|>(<L> = runLogged@fun <anonymous>(): R|kotlin/String| <kind=UNKNOWN> {
^ String(K)
}
)
public get(): R|kotlin/String| {
^ D|/testK|.R|/getValue|(Null(null), ::R|/testK|)
}
@@ -594,6 +594,16 @@ public class FirDiagnosticsTestGenerated extends AbstractFirDiagnosticsTest {
runTest("compiler/fir/resolve/testData/resolve/delegates/delegateWithLambda.kt");
}
@TestMetadata("extensionGenericGetValue.kt")
public void testExtensionGenericGetValue() throws Exception {
runTest("compiler/fir/resolve/testData/resolve/delegates/extensionGenericGetValue.kt");
}
@TestMetadata("extensionGetValueWithTypeVariableAsReceiver.kt")
public void testExtensionGetValueWithTypeVariableAsReceiver() throws Exception {
runTest("compiler/fir/resolve/testData/resolve/delegates/extensionGetValueWithTypeVariableAsReceiver.kt");
}
@TestMetadata("provideDelegate.kt")
public void testProvideDelegate() throws Exception {
runTest("compiler/fir/resolve/testData/resolve/delegates/provideDelegate.kt");
@@ -594,6 +594,16 @@ public class FirDiagnosticsWithLightTreeTestGenerated extends AbstractFirDiagnos
runTest("compiler/fir/resolve/testData/resolve/delegates/delegateWithLambda.kt");
}
@TestMetadata("extensionGenericGetValue.kt")
public void testExtensionGenericGetValue() throws Exception {
runTest("compiler/fir/resolve/testData/resolve/delegates/extensionGenericGetValue.kt");
}
@TestMetadata("extensionGetValueWithTypeVariableAsReceiver.kt")
public void testExtensionGetValueWithTypeVariableAsReceiver() throws Exception {
runTest("compiler/fir/resolve/testData/resolve/delegates/extensionGetValueWithTypeVariableAsReceiver.kt");
}
@TestMetadata("provideDelegate.kt")
public void testProvideDelegate() throws Exception {
runTest("compiler/fir/resolve/testData/resolve/delegates/provideDelegate.kt");