diff --git a/analysis/low-level-api-fir/testdata/lazyResolve/noRuntime/integerLiteralCall.kt b/analysis/low-level-api-fir/testdata/lazyResolve/noRuntime/integerLiteralCall.kt new file mode 100644 index 00000000000..d61e831a170 --- /dev/null +++ b/analysis/low-level-api-fir/testdata/lazyResolve/noRuntime/integerLiteralCall.kt @@ -0,0 +1,3 @@ +fun foo() { + 1.toInt() +} \ No newline at end of file diff --git a/analysis/low-level-api-fir/testdata/lazyResolve/noRuntime/integerLiteralCall.txt b/analysis/low-level-api-fir/testdata/lazyResolve/noRuntime/integerLiteralCall.txt new file mode 100644 index 00000000000..bec91d7d575 --- /dev/null +++ b/analysis/low-level-api-fir/testdata/lazyResolve/noRuntime/integerLiteralCall.txt @@ -0,0 +1,65 @@ +RAW_FIR: +FILE: [ResolvedTo(RAW_FIR)] integerLiteralCall.kt + public? final? [ResolvedTo(RAW_FIR)] fun foo(): R|kotlin/Unit| { LAZY_BLOCK } + +IMPORTS: +FILE: [ResolvedTo(IMPORTS)] integerLiteralCall.kt + public? final? [ResolvedTo(RAW_FIR)] fun foo(): R|kotlin/Unit| { LAZY_BLOCK } + +COMPILER_REQUIRED_ANNOTATIONS: +FILE: [ResolvedTo(IMPORTS)] integerLiteralCall.kt + public? final? [ResolvedTo(COMPILER_REQUIRED_ANNOTATIONS)] fun foo(): R|kotlin/Unit| { LAZY_BLOCK } + +COMPANION_GENERATION: +FILE: [ResolvedTo(IMPORTS)] integerLiteralCall.kt + public? final? [ResolvedTo(COMPANION_GENERATION)] fun foo(): R|kotlin/Unit| { LAZY_BLOCK } + +SUPER_TYPES: +FILE: [ResolvedTo(IMPORTS)] integerLiteralCall.kt + public? final? [ResolvedTo(SUPER_TYPES)] fun foo(): R|kotlin/Unit| { LAZY_BLOCK } + +TYPES: +FILE: [ResolvedTo(IMPORTS)] integerLiteralCall.kt + public? final? [ResolvedTo(TYPES)] fun foo(): R|kotlin/Unit| { LAZY_BLOCK } + +STATUS: +FILE: [ResolvedTo(IMPORTS)] integerLiteralCall.kt + public final [ResolvedTo(STATUS)] fun foo(): R|kotlin/Unit| { LAZY_BLOCK } + +EXPECT_ACTUAL_MATCHING: +FILE: [ResolvedTo(IMPORTS)] integerLiteralCall.kt + public final [ResolvedTo(EXPECT_ACTUAL_MATCHING)] fun foo(): R|kotlin/Unit| { LAZY_BLOCK } + +ARGUMENTS_OF_ANNOTATIONS: +FILE: [ResolvedTo(IMPORTS)] integerLiteralCall.kt + public final [ResolvedTo(ARGUMENTS_OF_ANNOTATIONS)] fun foo(): R|kotlin/Unit| { LAZY_BLOCK } + +CONTRACTS: +FILE: [ResolvedTo(IMPORTS)] integerLiteralCall.kt + public final [ResolvedTo(CONTRACTS)] fun foo(): R|kotlin/Unit| { + IntegerLiteral(1).toInt#() + } + +IMPLICIT_TYPES_BODY_RESOLVE: +FILE: [ResolvedTo(IMPORTS)] integerLiteralCall.kt + public final [ResolvedTo(IMPLICIT_TYPES_BODY_RESOLVE)] fun foo(): R|kotlin/Unit| { + IntegerLiteral(1).toInt#() + } + +ANNOTATIONS_ARGUMENTS_MAPPING: +FILE: [ResolvedTo(IMPORTS)] integerLiteralCall.kt + public final [ResolvedTo(ANNOTATIONS_ARGUMENTS_MAPPING)] fun foo(): R|kotlin/Unit| { + IntegerLiteral(1).toInt#() + } + +BODY_RESOLVE: +FILE: [ResolvedTo(IMPORTS)] integerLiteralCall.kt + public final [ResolvedTo(BODY_RESOLVE)] fun foo(): R|kotlin/Unit| { + IntegerLiteral(1).#() + } + +FILE RAW TO BODY: +FILE: [ResolvedTo(IMPORTS)] integerLiteralCall.kt + public final [ResolvedTo(BODY_RESOLVE)] fun foo(): R|kotlin/Unit| { + IntegerLiteral(1).#() + } diff --git a/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/AbstractFirLazyDeclarationResolveTest.kt b/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/AbstractFirLazyDeclarationResolveTest.kt index d693bbcc7d3..e257a57e000 100644 --- a/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/AbstractFirLazyDeclarationResolveTest.kt +++ b/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/AbstractFirLazyDeclarationResolveTest.kt @@ -19,6 +19,8 @@ import org.jetbrains.kotlin.psi.KtDeclaration import org.jetbrains.kotlin.psi.KtFile import org.jetbrains.kotlin.test.builders.TestConfigurationBuilder import org.jetbrains.kotlin.test.directives.ConfigurationDirectives +import org.jetbrains.kotlin.test.directives.ConfigurationDirectives.WITH_STDLIB +import org.jetbrains.kotlin.test.directives.JvmEnvironmentConfigurationDirectives.NO_RUNTIME import org.jetbrains.kotlin.test.directives.model.SimpleDirectivesContainer import org.jetbrains.kotlin.test.services.TestModuleStructure import org.jetbrains.kotlin.test.services.TestServices @@ -57,8 +59,16 @@ abstract class AbstractFirLazyDeclarationResolveTest : AbstractFirLazyDeclaratio override fun configureTest(builder: TestConfigurationBuilder) { super.configureTest(builder) with(builder) { - defaultDirectives { - +ConfigurationDirectives.WITH_STDLIB + forTestsNotMatching("analysis/low-level-api-fir/testdata/lazyResolve/noRuntime/*" ) { + defaultDirectives { + +WITH_STDLIB + } + } + + forTestsMatching("analysis/low-level-api-fir/testdata/lazyResolve/noRuntime/*") { + defaultDirectives { + +NO_RUNTIME + } } useDirectives(Directives) diff --git a/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/FirOutOfContentRootLazyDeclarationResolveTestGenerated.java b/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/FirOutOfContentRootLazyDeclarationResolveTestGenerated.java index 321c8f794c2..0aab20ba66a 100644 --- a/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/FirOutOfContentRootLazyDeclarationResolveTestGenerated.java +++ b/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/FirOutOfContentRootLazyDeclarationResolveTestGenerated.java @@ -708,6 +708,22 @@ public class FirOutOfContentRootLazyDeclarationResolveTestGenerated extends Abst } } + @Nested + @TestMetadata("analysis/low-level-api-fir/testdata/lazyResolve/noRuntime") + @TestDataPath("$PROJECT_ROOT") + public class NoRuntime { + @Test + public void testAllFilesPresentInNoRuntime() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("analysis/low-level-api-fir/testdata/lazyResolve/noRuntime"), Pattern.compile("^(.+)\\.kt$"), null, true); + } + + @Test + @TestMetadata("integerLiteralCall.kt") + public void testIntegerLiteralCall() throws Exception { + runTest("analysis/low-level-api-fir/testdata/lazyResolve/noRuntime/integerLiteralCall.kt"); + } + } + @Nested @TestMetadata("analysis/low-level-api-fir/testdata/lazyResolve/properties") @TestDataPath("$PROJECT_ROOT") diff --git a/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/FirSourceLazyDeclarationResolveTestGenerated.java b/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/FirSourceLazyDeclarationResolveTestGenerated.java index e77bb99032d..c6fe7b9572b 100644 --- a/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/FirSourceLazyDeclarationResolveTestGenerated.java +++ b/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/FirSourceLazyDeclarationResolveTestGenerated.java @@ -708,6 +708,22 @@ public class FirSourceLazyDeclarationResolveTestGenerated extends AbstractFirSou } } + @Nested + @TestMetadata("analysis/low-level-api-fir/testdata/lazyResolve/noRuntime") + @TestDataPath("$PROJECT_ROOT") + public class NoRuntime { + @Test + public void testAllFilesPresentInNoRuntime() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("analysis/low-level-api-fir/testdata/lazyResolve/noRuntime"), Pattern.compile("^(.+)\\.kt$"), null, true); + } + + @Test + @TestMetadata("integerLiteralCall.kt") + public void testIntegerLiteralCall() throws Exception { + runTest("analysis/low-level-api-fir/testdata/lazyResolve/noRuntime/integerLiteralCall.kt"); + } + } + @Nested @TestMetadata("analysis/low-level-api-fir/testdata/lazyResolve/properties") @TestDataPath("$PROJECT_ROOT") diff --git a/compiler/fir/providers/src/org/jetbrains/kotlin/fir/scopes/impl/FirIntegerConstantOperatorScope.kt b/compiler/fir/providers/src/org/jetbrains/kotlin/fir/scopes/impl/FirIntegerConstantOperatorScope.kt index bd103c4f722..dd6abb1ce0d 100644 --- a/compiler/fir/providers/src/org/jetbrains/kotlin/fir/scopes/impl/FirIntegerConstantOperatorScope.kt +++ b/compiler/fir/providers/src/org/jetbrains/kotlin/fir/scopes/impl/FirIntegerConstantOperatorScope.kt @@ -43,9 +43,7 @@ class FirIntegerConstantOperatorScope( scopeSession, FakeOverrideTypeCalculator.DoNothing, requiredMembersPhase = FirResolvePhase.STATUS, - ) ?: errorWithAttachment("Scope for ${baseType::class.java} not found") { - withConeTypeEntry("type", baseType) - } + ) ?: Empty } private val mappedFunctions = mutableMapOf()