Add a pair of new tests for FIR local classes / objects
This commit is contained in:
@@ -0,0 +1,28 @@
|
|||||||
|
open class Bar {
|
||||||
|
fun foo() {}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun test() {
|
||||||
|
open class BaseLocal : Bar() {
|
||||||
|
fun baz() {}
|
||||||
|
}
|
||||||
|
|
||||||
|
val base = BaseLocal()
|
||||||
|
base.baz()
|
||||||
|
base.foo()
|
||||||
|
|
||||||
|
val anonymous = object : Bar() {
|
||||||
|
fun baz() {}
|
||||||
|
}
|
||||||
|
anonymous.baz()
|
||||||
|
anonymous.foo()
|
||||||
|
|
||||||
|
class DerivedLocal : BaseLocal() {
|
||||||
|
fun gau() {}
|
||||||
|
}
|
||||||
|
|
||||||
|
val derived = DerivedLocal()
|
||||||
|
derived.gau()
|
||||||
|
derived.baz()
|
||||||
|
derived.foo()
|
||||||
|
}
|
||||||
@@ -0,0 +1,51 @@
|
|||||||
|
FILE: localScopes.kt
|
||||||
|
public open class Bar : R|kotlin/Any| {
|
||||||
|
public constructor(): R|Bar| {
|
||||||
|
super<R|kotlin/Any|>()
|
||||||
|
}
|
||||||
|
|
||||||
|
public final fun foo(): R|kotlin/Unit| {
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
public final fun test(): R|kotlin/Unit| {
|
||||||
|
local open class BaseLocal : R|Bar| {
|
||||||
|
public constructor(): R|BaseLocal| {
|
||||||
|
super<R|Bar|>()
|
||||||
|
}
|
||||||
|
|
||||||
|
public final fun baz(): R|kotlin/Unit| {
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
lval base: R|BaseLocal| = R|/BaseLocal.BaseLocal|()
|
||||||
|
R|<local>/base|.R|/BaseLocal.baz|()
|
||||||
|
R|<local>/base|.R|/Bar.foo|()
|
||||||
|
lval anonymous: R|anonymous| = object : R|Bar| {
|
||||||
|
private constructor(): R|Bar| {
|
||||||
|
super<R|Bar|>()
|
||||||
|
}
|
||||||
|
|
||||||
|
public final fun baz(): R|kotlin/Unit| {
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
R|<local>/anonymous|.R|/baz|()
|
||||||
|
R|<local>/anonymous|.R|/Bar.foo|()
|
||||||
|
local final class DerivedLocal : R|class error: Symbol not found, for `BaseLocal`| {
|
||||||
|
public constructor(): R|DerivedLocal| {
|
||||||
|
super<R|class error: Symbol not found, for `BaseLocal`|>()
|
||||||
|
}
|
||||||
|
|
||||||
|
public final fun gau(): R|kotlin/Unit| {
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
lval derived: R|DerivedLocal| = R|/DerivedLocal.DerivedLocal|()
|
||||||
|
R|<local>/derived|.R|/DerivedLocal.gau|()
|
||||||
|
R|<local>/derived|.<Unresolved name: baz>#()
|
||||||
|
R|<local>/derived|.<Unresolved name: foo>#()
|
||||||
|
}
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
interface Foo {
|
||||||
|
fun bar(): Int
|
||||||
|
}
|
||||||
|
|
||||||
|
val x by lazy {
|
||||||
|
val foo = object : Foo {
|
||||||
|
override fun bar(): Int = 42
|
||||||
|
}
|
||||||
|
foo.bar()
|
||||||
|
}
|
||||||
+5
@@ -341,6 +341,11 @@ public class FirResolveTestCaseGenerated extends AbstractFirResolveTestCase {
|
|||||||
runTest("compiler/fir/resolve/testData/resolve/expresssions/localImplicitBodies.kt");
|
runTest("compiler/fir/resolve/testData/resolve/expresssions/localImplicitBodies.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("localScopes.kt")
|
||||||
|
public void testLocalScopes() throws Exception {
|
||||||
|
runTest("compiler/fir/resolve/testData/resolve/expresssions/localScopes.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("memberExtension.kt")
|
@TestMetadata("memberExtension.kt")
|
||||||
public void testMemberExtension() throws Exception {
|
public void testMemberExtension() throws Exception {
|
||||||
runTest("compiler/fir/resolve/testData/resolve/expresssions/memberExtension.kt");
|
runTest("compiler/fir/resolve/testData/resolve/expresssions/memberExtension.kt");
|
||||||
|
|||||||
Generated
+5
@@ -28,6 +28,11 @@ public class FirResolveTestCaseWithStdlibGenerated extends AbstractFirResolveTes
|
|||||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/fir/resolve/testData/resolve/stdlib"), Pattern.compile("^([^.]+)\\.kt$"), true, "contracts");
|
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/fir/resolve/testData/resolve/stdlib"), Pattern.compile("^([^.]+)\\.kt$"), true, "contracts");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("anonymousInDelegate.kt")
|
||||||
|
public void testAnonymousInDelegate() throws Exception {
|
||||||
|
runTest("compiler/fir/resolve/testData/resolve/stdlib/anonymousInDelegate.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("arrayFirstOrNull.kt")
|
@TestMetadata("arrayFirstOrNull.kt")
|
||||||
public void testArrayFirstOrNull() throws Exception {
|
public void testArrayFirstOrNull() throws Exception {
|
||||||
runTest("compiler/fir/resolve/testData/resolve/stdlib/arrayFirstOrNull.kt");
|
runTest("compiler/fir/resolve/testData/resolve/stdlib/arrayFirstOrNull.kt");
|
||||||
|
|||||||
Reference in New Issue
Block a user