From 9fb920874c2b4d1c07d95d921894933670d82069 Mon Sep 17 00:00:00 2001 From: Stanislav Ruban Date: Thu, 25 Jan 2024 21:23:27 +0200 Subject: [PATCH] [tests] Add additional test data for KT-64222 --- ...CompilerTestFE10TestdataTestGenerated.java | 28 +++++ ...sticCompilerFE10TestDataTestGenerated.java | 28 +++++ ...eeOldFrontendDiagnosticsTestGenerated.java | 28 +++++ ...siOldFrontendDiagnosticsTestGenerated.java | 28 +++++ ...peAsTypeVariableSourceInClassifiers.fir.kt | 48 ++++++++ ...ertypeAsTypeVariableSourceInClassifiers.kt | 48 ++++++++ ...typeAsTypeVariableSourceInFunctions.fir.kt | 60 ++++++++++ ...upertypeAsTypeVariableSourceInFunctions.kt | 60 ++++++++++ ...ypeAsTypeVariableSourceInProperties.fir.kt | 110 ++++++++++++++++++ ...pertypeAsTypeVariableSourceInProperties.kt | 110 ++++++++++++++++++ .../test/runners/DiagnosticTestGenerated.java | 28 +++++ 11 files changed, 576 insertions(+) create mode 100644 compiler/testData/diagnostics/tests/builderInference/additional/BuildeeSupertypeAsTypeVariableSourceInClassifiers.fir.kt create mode 100644 compiler/testData/diagnostics/tests/builderInference/additional/BuildeeSupertypeAsTypeVariableSourceInClassifiers.kt create mode 100644 compiler/testData/diagnostics/tests/builderInference/additional/BuildeeSupertypeAsTypeVariableSourceInFunctions.fir.kt create mode 100644 compiler/testData/diagnostics/tests/builderInference/additional/BuildeeSupertypeAsTypeVariableSourceInFunctions.kt create mode 100644 compiler/testData/diagnostics/tests/builderInference/additional/BuildeeSupertypeAsTypeVariableSourceInProperties.fir.kt create mode 100644 compiler/testData/diagnostics/tests/builderInference/additional/BuildeeSupertypeAsTypeVariableSourceInProperties.kt diff --git a/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/DiagnosticCompilerTestFE10TestdataTestGenerated.java b/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/DiagnosticCompilerTestFE10TestdataTestGenerated.java index 6ade9fd9abe..a2614de59c2 100644 --- a/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/DiagnosticCompilerTestFE10TestdataTestGenerated.java +++ b/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/DiagnosticCompilerTestFE10TestdataTestGenerated.java @@ -3862,6 +3862,34 @@ public class DiagnosticCompilerTestFE10TestdataTestGenerated extends AbstractDia runTest("compiler/testData/diagnostics/tests/builderInference/overloadResolutionByLambdaReturnType.kt"); } + @Nested + @TestMetadata("compiler/testData/diagnostics/tests/builderInference/additional") + @TestDataPath("$PROJECT_ROOT") + public class Additional { + @Test + public void testAllFilesPresentInAdditional() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/tests/builderInference/additional"), Pattern.compile("^(.+)\\.(kt|kts)$"), Pattern.compile("^(.+)\\.(reversed|fir|ll)\\.kts?$"), true); + } + + @Test + @TestMetadata("BuildeeSupertypeAsTypeVariableSourceInClassifiers.kt") + public void testBuildeeSupertypeAsTypeVariableSourceInClassifiers() throws Exception { + runTest("compiler/testData/diagnostics/tests/builderInference/additional/BuildeeSupertypeAsTypeVariableSourceInClassifiers.kt"); + } + + @Test + @TestMetadata("BuildeeSupertypeAsTypeVariableSourceInFunctions.kt") + public void testBuildeeSupertypeAsTypeVariableSourceInFunctions() throws Exception { + runTest("compiler/testData/diagnostics/tests/builderInference/additional/BuildeeSupertypeAsTypeVariableSourceInFunctions.kt"); + } + + @Test + @TestMetadata("BuildeeSupertypeAsTypeVariableSourceInProperties.kt") + public void testBuildeeSupertypeAsTypeVariableSourceInProperties() throws Exception { + runTest("compiler/testData/diagnostics/tests/builderInference/additional/BuildeeSupertypeAsTypeVariableSourceInProperties.kt"); + } + } + @Nested @TestMetadata("compiler/testData/diagnostics/tests/builderInference/issues") @TestDataPath("$PROJECT_ROOT") diff --git a/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/LLFirPreresolvedReversedDiagnosticCompilerFE10TestDataTestGenerated.java b/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/LLFirPreresolvedReversedDiagnosticCompilerFE10TestDataTestGenerated.java index f3225c68465..ab6409a4f29 100644 --- a/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/LLFirPreresolvedReversedDiagnosticCompilerFE10TestDataTestGenerated.java +++ b/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/LLFirPreresolvedReversedDiagnosticCompilerFE10TestDataTestGenerated.java @@ -3862,6 +3862,34 @@ public class LLFirPreresolvedReversedDiagnosticCompilerFE10TestDataTestGenerated runTest("compiler/testData/diagnostics/tests/builderInference/overloadResolutionByLambdaReturnType.kt"); } + @Nested + @TestMetadata("compiler/testData/diagnostics/tests/builderInference/additional") + @TestDataPath("$PROJECT_ROOT") + public class Additional { + @Test + public void testAllFilesPresentInAdditional() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/tests/builderInference/additional"), Pattern.compile("^(.+)\\.(kt|kts)$"), Pattern.compile("^(.+)\\.(reversed|fir|ll)\\.kts?$"), true); + } + + @Test + @TestMetadata("BuildeeSupertypeAsTypeVariableSourceInClassifiers.kt") + public void testBuildeeSupertypeAsTypeVariableSourceInClassifiers() throws Exception { + runTest("compiler/testData/diagnostics/tests/builderInference/additional/BuildeeSupertypeAsTypeVariableSourceInClassifiers.kt"); + } + + @Test + @TestMetadata("BuildeeSupertypeAsTypeVariableSourceInFunctions.kt") + public void testBuildeeSupertypeAsTypeVariableSourceInFunctions() throws Exception { + runTest("compiler/testData/diagnostics/tests/builderInference/additional/BuildeeSupertypeAsTypeVariableSourceInFunctions.kt"); + } + + @Test + @TestMetadata("BuildeeSupertypeAsTypeVariableSourceInProperties.kt") + public void testBuildeeSupertypeAsTypeVariableSourceInProperties() throws Exception { + runTest("compiler/testData/diagnostics/tests/builderInference/additional/BuildeeSupertypeAsTypeVariableSourceInProperties.kt"); + } + } + @Nested @TestMetadata("compiler/testData/diagnostics/tests/builderInference/issues") @TestDataPath("$PROJECT_ROOT") diff --git a/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirLightTreeOldFrontendDiagnosticsTestGenerated.java b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirLightTreeOldFrontendDiagnosticsTestGenerated.java index 2048fe239d1..e0d76916cee 100644 --- a/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirLightTreeOldFrontendDiagnosticsTestGenerated.java +++ b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirLightTreeOldFrontendDiagnosticsTestGenerated.java @@ -3856,6 +3856,34 @@ public class FirLightTreeOldFrontendDiagnosticsTestGenerated extends AbstractFir runTest("compiler/testData/diagnostics/tests/builderInference/overloadResolutionByLambdaReturnType.kt"); } + @Nested + @TestMetadata("compiler/testData/diagnostics/tests/builderInference/additional") + @TestDataPath("$PROJECT_ROOT") + public class Additional { + @Test + public void testAllFilesPresentInAdditional() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/tests/builderInference/additional"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.(reversed|fir|ll)\\.kts?$"), true, "multiplatform"); + } + + @Test + @TestMetadata("BuildeeSupertypeAsTypeVariableSourceInClassifiers.kt") + public void testBuildeeSupertypeAsTypeVariableSourceInClassifiers() throws Exception { + runTest("compiler/testData/diagnostics/tests/builderInference/additional/BuildeeSupertypeAsTypeVariableSourceInClassifiers.kt"); + } + + @Test + @TestMetadata("BuildeeSupertypeAsTypeVariableSourceInFunctions.kt") + public void testBuildeeSupertypeAsTypeVariableSourceInFunctions() throws Exception { + runTest("compiler/testData/diagnostics/tests/builderInference/additional/BuildeeSupertypeAsTypeVariableSourceInFunctions.kt"); + } + + @Test + @TestMetadata("BuildeeSupertypeAsTypeVariableSourceInProperties.kt") + public void testBuildeeSupertypeAsTypeVariableSourceInProperties() throws Exception { + runTest("compiler/testData/diagnostics/tests/builderInference/additional/BuildeeSupertypeAsTypeVariableSourceInProperties.kt"); + } + } + @Nested @TestMetadata("compiler/testData/diagnostics/tests/builderInference/issues") @TestDataPath("$PROJECT_ROOT") diff --git a/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirPsiOldFrontendDiagnosticsTestGenerated.java b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirPsiOldFrontendDiagnosticsTestGenerated.java index 291eebf9745..660f5704e6e 100644 --- a/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirPsiOldFrontendDiagnosticsTestGenerated.java +++ b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirPsiOldFrontendDiagnosticsTestGenerated.java @@ -3862,6 +3862,34 @@ public class FirPsiOldFrontendDiagnosticsTestGenerated extends AbstractFirPsiDia runTest("compiler/testData/diagnostics/tests/builderInference/overloadResolutionByLambdaReturnType.kt"); } + @Nested + @TestMetadata("compiler/testData/diagnostics/tests/builderInference/additional") + @TestDataPath("$PROJECT_ROOT") + public class Additional { + @Test + public void testAllFilesPresentInAdditional() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/tests/builderInference/additional"), Pattern.compile("^(.*)\\.kts?$"), Pattern.compile("^(.+)\\.(reversed|fir|ll)\\.kts?$"), true, "multiplatform"); + } + + @Test + @TestMetadata("BuildeeSupertypeAsTypeVariableSourceInClassifiers.kt") + public void testBuildeeSupertypeAsTypeVariableSourceInClassifiers() throws Exception { + runTest("compiler/testData/diagnostics/tests/builderInference/additional/BuildeeSupertypeAsTypeVariableSourceInClassifiers.kt"); + } + + @Test + @TestMetadata("BuildeeSupertypeAsTypeVariableSourceInFunctions.kt") + public void testBuildeeSupertypeAsTypeVariableSourceInFunctions() throws Exception { + runTest("compiler/testData/diagnostics/tests/builderInference/additional/BuildeeSupertypeAsTypeVariableSourceInFunctions.kt"); + } + + @Test + @TestMetadata("BuildeeSupertypeAsTypeVariableSourceInProperties.kt") + public void testBuildeeSupertypeAsTypeVariableSourceInProperties() throws Exception { + runTest("compiler/testData/diagnostics/tests/builderInference/additional/BuildeeSupertypeAsTypeVariableSourceInProperties.kt"); + } + } + @Nested @TestMetadata("compiler/testData/diagnostics/tests/builderInference/issues") @TestDataPath("$PROJECT_ROOT") diff --git a/compiler/testData/diagnostics/tests/builderInference/additional/BuildeeSupertypeAsTypeVariableSourceInClassifiers.fir.kt b/compiler/testData/diagnostics/tests/builderInference/additional/BuildeeSupertypeAsTypeVariableSourceInClassifiers.fir.kt new file mode 100644 index 00000000000..016f784d753 --- /dev/null +++ b/compiler/testData/diagnostics/tests/builderInference/additional/BuildeeSupertypeAsTypeVariableSourceInClassifiers.fir.kt @@ -0,0 +1,48 @@ +fun test() { + // a primary constructor call + build { + KlassA(this) + } + + // a secondary constructor call + build { + KlassB(this) + } + + // delegation to a super-constructor from a primary constructor + build { + class KlassC constructor(): BaseKlassC(this@build) + } + + // delegation to a super-constructor from a secondary constructor + build { + class KlassD: BaseKlassD { + constructor() : super(this@build) + } + } + + // inheritance via delegation + build { + class KlassE: BaseBuildee by this@build + } + +} + +interface BaseBuildee +class DerivedBuildee: BaseBuildee + +fun build(instructions: DerivedBuildee.() -> Unit): DerivedBuildee { + return DerivedBuildee().apply(instructions) +} + +class TargetType + +class KlassA constructor(base: BaseBuildee) + +class KlassB { + constructor(base: BaseBuildee) +} + +open class BaseKlassC(base: BaseBuildee) + +open class BaseKlassD(base: BaseBuildee) diff --git a/compiler/testData/diagnostics/tests/builderInference/additional/BuildeeSupertypeAsTypeVariableSourceInClassifiers.kt b/compiler/testData/diagnostics/tests/builderInference/additional/BuildeeSupertypeAsTypeVariableSourceInClassifiers.kt new file mode 100644 index 00000000000..76fcebf0e59 --- /dev/null +++ b/compiler/testData/diagnostics/tests/builderInference/additional/BuildeeSupertypeAsTypeVariableSourceInClassifiers.kt @@ -0,0 +1,48 @@ +fun test() { + // a primary constructor call + build { + KlassA(this) + } + + // a secondary constructor call + build { + KlassB(this) + } + + // delegation to a super-constructor from a primary constructor + build { + class KlassC constructor(): BaseKlassC(this@build) + } + + // delegation to a super-constructor from a secondary constructor + build { + class KlassD: BaseKlassD { + constructor() : super(this@build) + } + } + + // inheritance via delegation + build { + class KlassE: BaseBuildee by this@build + } + +} + +interface BaseBuildee +class DerivedBuildee: BaseBuildee + +fun build(instructions: DerivedBuildee.() -> Unit): DerivedBuildee { + return DerivedBuildee().apply(instructions) +} + +class TargetType + +class KlassA constructor(base: BaseBuildee) + +class KlassB { + constructor(base: BaseBuildee) +} + +open class BaseKlassC(base: BaseBuildee) + +open class BaseKlassD(base: BaseBuildee) diff --git a/compiler/testData/diagnostics/tests/builderInference/additional/BuildeeSupertypeAsTypeVariableSourceInFunctions.fir.kt b/compiler/testData/diagnostics/tests/builderInference/additional/BuildeeSupertypeAsTypeVariableSourceInFunctions.fir.kt new file mode 100644 index 00000000000..b0387920be3 --- /dev/null +++ b/compiler/testData/diagnostics/tests/builderInference/additional/BuildeeSupertypeAsTypeVariableSourceInFunctions.fir.kt @@ -0,0 +1,60 @@ +fun test() { + // simple function call + build { + consumeA(this) + } + + // function call with a named argument + build { + consumeB(base = this) + } + + // local function definition with a default parameter value + build { + fun consumeC(base: BaseBuildee = this) {} + } + + // local function definition with a return type and a block body + build { + fun consumeD(): BaseBuildee { return this } + } + + // local function definition with a return type and an expression body + build { + fun consumeE(): BaseBuildee = this + } + + // call of a function with a vararg parameter + build { + consumeF(this, this) + } + + // call of an extension function + build { + this.consumeG() + } + + // call of an infix function + build { + this consumeH this + } +} + +open class BaseBuildee +class DerivedBuildee: BaseBuildee() + +fun build(instructions: DerivedBuildee.() -> Unit): DerivedBuildee { + return DerivedBuildee().apply(instructions) +} + +class TargetType + +fun consumeA(base: BaseBuildee) {} + +fun consumeB(base: BaseBuildee) {} + +fun consumeF(vararg bases: BaseBuildee) {} + +fun BaseBuildee.consumeG() {} + +infix fun BaseBuildee.consumeH(base: BaseBuildee) {} diff --git a/compiler/testData/diagnostics/tests/builderInference/additional/BuildeeSupertypeAsTypeVariableSourceInFunctions.kt b/compiler/testData/diagnostics/tests/builderInference/additional/BuildeeSupertypeAsTypeVariableSourceInFunctions.kt new file mode 100644 index 00000000000..358e8450fcb --- /dev/null +++ b/compiler/testData/diagnostics/tests/builderInference/additional/BuildeeSupertypeAsTypeVariableSourceInFunctions.kt @@ -0,0 +1,60 @@ +fun test() { + // simple function call + build { + consumeA(this) + } + + // function call with a named argument + build { + consumeB(base = this) + } + + // local function definition with a default parameter value + build { + fun consumeC(base: BaseBuildee = this) {} + } + + // local function definition with a return type and a block body + build { + fun consumeD(): BaseBuildee { return this } + } + + // local function definition with a return type and an expression body + build { + fun consumeE(): BaseBuildee = this + } + + // call of a function with a vararg parameter + build { + consumeF(this, this) + } + + // call of an extension function + build { + this.consumeG() + } + + // call of an infix function + build { + this consumeH this + } +} + +open class BaseBuildee +class DerivedBuildee: BaseBuildee() + +fun build(instructions: DerivedBuildee.() -> Unit): DerivedBuildee { + return DerivedBuildee().apply(instructions) +} + +class TargetType + +fun consumeA(base: BaseBuildee) {} + +fun consumeB(base: BaseBuildee) {} + +fun consumeF(vararg bases: BaseBuildee) {} + +fun BaseBuildee.consumeG() {} + +infix fun BaseBuildee.consumeH(base: BaseBuildee) {} diff --git a/compiler/testData/diagnostics/tests/builderInference/additional/BuildeeSupertypeAsTypeVariableSourceInProperties.fir.kt b/compiler/testData/diagnostics/tests/builderInference/additional/BuildeeSupertypeAsTypeVariableSourceInProperties.fir.kt new file mode 100644 index 00000000000..cb4f56d1d67 --- /dev/null +++ b/compiler/testData/diagnostics/tests/builderInference/additional/BuildeeSupertypeAsTypeVariableSourceInProperties.fir.kt @@ -0,0 +1,110 @@ +// WITH_REFLECT +// DIAGNOSTICS: -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE + +import kotlin.reflect.KProperty + +fun test() { + // initialization of an immutable local value + build { + val baseA: BaseBuildee = this + } + + // assignment to a mutable local variable + build { + var baseB = BaseBuildee() + baseB = this + } + + // a destructuring declaration + build { + val (_: BaseBuildee, _: BaseBuildee) = this to this + } + + // body of a getter of an immutable property + build { + class LocalWrapper { + val baseC: BaseBuildee + get() = this@build + } + } + + // initialization of a mutable property's backing field + build { + class LocalWrapper { + var baseD: BaseBuildee = this@build + set(value) { + field = BaseBuildee() + } + } + } + + // body of a setter of a mutable property + build { + class LocalWrapper { + var baseE: BaseBuildee = BaseBuildee() + set(value) { + field = this@build + } + } + } + + // assignment via a mutable property's setter + build { + baseF = this + } + + // declaration of a property delegated via getValue/setValue + build { + val baseG: BaseBuildee by Delegate(this) + } + + // assignment to a property delegated via getValue/setValue + build { + baseH = this + } + + // declaration of a property delegated via provideDelegate + build { + val baseI: BaseBuildee by DelegateProvider(this) + } + + // assignment to a property delegated via provideDelegate + build { + baseJ = this + } + + // an extension property + build { + this.baseK + } +} + +open class BaseBuildee +class DerivedBuildee: BaseBuildee() + +fun build(instructions: DerivedBuildee.() -> Unit): DerivedBuildee { + return DerivedBuildee().apply(instructions) +} + +class TargetType + +var baseF + get() = BaseBuildee() + set(value) {} + +class Delegate(private var arg: T) { + operator fun getValue(thisRef: Any?, property: KProperty<*>): T = arg + operator fun setValue(thisRef: Any?, property: KProperty<*>, value: T) { + arg = value + } +} + +var baseH by Delegate(BaseBuildee()) + +class DelegateProvider(private val arg: T) { + operator fun provideDelegate(thisRef: Any?, property: KProperty<*>): Delegate = Delegate(arg) +} + +var baseJ by DelegateProvider(BaseBuildee()) + +val BaseBuildee.baseK get() = this diff --git a/compiler/testData/diagnostics/tests/builderInference/additional/BuildeeSupertypeAsTypeVariableSourceInProperties.kt b/compiler/testData/diagnostics/tests/builderInference/additional/BuildeeSupertypeAsTypeVariableSourceInProperties.kt new file mode 100644 index 00000000000..03748412579 --- /dev/null +++ b/compiler/testData/diagnostics/tests/builderInference/additional/BuildeeSupertypeAsTypeVariableSourceInProperties.kt @@ -0,0 +1,110 @@ +// WITH_REFLECT +// DIAGNOSTICS: -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE + +import kotlin.reflect.KProperty + +fun test() { + // initialization of an immutable local value + build { + val baseA: BaseBuildee = this + } + + // assignment to a mutable local variable + build { + var baseB = BaseBuildee() + baseB = this + } + + // a destructuring declaration + build { + val (_: BaseBuildee, _: BaseBuildee) = this to this + } + + // body of a getter of an immutable property + build { + class LocalWrapper { + val baseC: BaseBuildee + get() = this@build + } + } + + // initialization of a mutable property's backing field + build { + class LocalWrapper { + var baseD: BaseBuildee = this@build + set(value) { + field = BaseBuildee() + } + } + } + + // body of a setter of a mutable property + build { + class LocalWrapper { + var baseE: BaseBuildee = BaseBuildee() + set(value) { + field = this@build + } + } + } + + // assignment via a mutable property's setter + build { + baseF = this + } + + // declaration of a property delegated via getValue/setValue + build { + val baseG: BaseBuildee by Delegate(this) + } + + // assignment to a property delegated via getValue/setValue + build { + baseH = this + } + + // declaration of a property delegated via provideDelegate + build { + val baseI: BaseBuildee by DelegateProvider(this) + } + + // assignment to a property delegated via provideDelegate + build { + baseJ = this + } + + // an extension property + build { + this.baseK + } +} + +open class BaseBuildee +class DerivedBuildee: BaseBuildee() + +fun build(instructions: DerivedBuildee.() -> Unit): DerivedBuildee { + return DerivedBuildee().apply(instructions) +} + +class TargetType + +var baseF + get() = BaseBuildee() + set(value) {} + +class Delegate(private var arg: T) { + operator fun getValue(thisRef: Any?, property: KProperty<*>): T = arg + operator fun setValue(thisRef: Any?, property: KProperty<*>, value: T) { + arg = value + } +} + +var baseH by Delegate(BaseBuildee()) + +class DelegateProvider(private val arg: T) { + operator fun provideDelegate(thisRef: Any?, property: KProperty<*>): Delegate = Delegate(arg) +} + +var baseJ by DelegateProvider(BaseBuildee()) + +val BaseBuildee.baseK get() = this diff --git a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/DiagnosticTestGenerated.java b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/DiagnosticTestGenerated.java index 22ca393f72e..e2df246bb4d 100644 --- a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/DiagnosticTestGenerated.java +++ b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/DiagnosticTestGenerated.java @@ -3862,6 +3862,34 @@ public class DiagnosticTestGenerated extends AbstractDiagnosticTest { runTest("compiler/testData/diagnostics/tests/builderInference/overloadResolutionByLambdaReturnType.kt"); } + @Nested + @TestMetadata("compiler/testData/diagnostics/tests/builderInference/additional") + @TestDataPath("$PROJECT_ROOT") + public class Additional { + @Test + public void testAllFilesPresentInAdditional() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/tests/builderInference/additional"), Pattern.compile("^(.*)\\.kts?$"), Pattern.compile("^(.+)\\.(reversed|fir|ll)\\.kts?$"), true); + } + + @Test + @TestMetadata("BuildeeSupertypeAsTypeVariableSourceInClassifiers.kt") + public void testBuildeeSupertypeAsTypeVariableSourceInClassifiers() throws Exception { + runTest("compiler/testData/diagnostics/tests/builderInference/additional/BuildeeSupertypeAsTypeVariableSourceInClassifiers.kt"); + } + + @Test + @TestMetadata("BuildeeSupertypeAsTypeVariableSourceInFunctions.kt") + public void testBuildeeSupertypeAsTypeVariableSourceInFunctions() throws Exception { + runTest("compiler/testData/diagnostics/tests/builderInference/additional/BuildeeSupertypeAsTypeVariableSourceInFunctions.kt"); + } + + @Test + @TestMetadata("BuildeeSupertypeAsTypeVariableSourceInProperties.kt") + public void testBuildeeSupertypeAsTypeVariableSourceInProperties() throws Exception { + runTest("compiler/testData/diagnostics/tests/builderInference/additional/BuildeeSupertypeAsTypeVariableSourceInProperties.kt"); + } + } + @Nested @TestMetadata("compiler/testData/diagnostics/tests/builderInference/issues") @TestDataPath("$PROJECT_ROOT")