Skip to content

Commit

Permalink
KT-69251: remove context receivers #KT-69251 fixed
Browse files Browse the repository at this point in the history
Merge-request: KT-MR-16618
Merged-by: Artem Olkov <[email protected]>
  • Loading branch information
mMaxy authored and Space Team committed Jun 25, 2024
1 parent aaf2856 commit cc39190
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 17 deletions.
6 changes: 0 additions & 6 deletions native/swift/sir-light-classes/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import org.jetbrains.kotlin.gradle.tasks.KotlinJvmCompile

plugins {
kotlin("jvm")
id("jps-compatible")
Expand All @@ -25,10 +23,6 @@ sourceSets {
"main" { projectDefault() }
}

tasks.withType<KotlinJvmCompile> {
compilerOptions.freeCompilerArgs.add("-Xcontext-receivers")
}

if (kotlinBuildProperties.isSwiftExportPluginPublishingEnabled) {
publish()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,26 @@ import org.jetbrains.kotlin.analysis.api.symbols.KaDeclarationSymbol
import org.jetbrains.kotlin.sir.providers.SirSession
import org.jetbrains.sir.lightclasses.SirFromKtSymbol

@Suppress("CONTEXT_RECEIVERS_DEPRECATED")
internal interface SirAndKaSession : KaSession, SirSession

internal class SirAndKaSessionImpl(
override val sirSession: SirSession,
private val kaSession: KaSession
) : SirAndKaSession, KaSession by kaSession, SirSession by sirSession

internal inline fun <reified S : KaDeclarationSymbol, reified R> SirFromKtSymbol<S>.lazyWithSessions(
crossinline block: context(SirSession, KaSession) () -> R
crossinline block: SirAndKaSession.() -> R
): Lazy<R> {
return lazy {
withSessions(block)
}
}

@Suppress("CONTEXT_RECEIVERS_DEPRECATED")
internal inline fun <reified S : KaDeclarationSymbol, reified R> SirFromKtSymbol<S>.withSessions(
crossinline block: context(SirSession, KaSession) () -> R,
crossinline block: SirAndKaSession.() -> R,
): R {
return analyze(ktModule) {
block(sirSession, useSiteSession)
val sirAndKaSession = SirAndKaSessionImpl(sirSession, useSiteSession)
sirAndKaSession.block()
}
}
6 changes: 0 additions & 6 deletions native/swift/sir-providers/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import org.jetbrains.kotlin.gradle.tasks.KotlinJvmCompile

plugins {
kotlin("jvm")
id("jps-compatible")
Expand All @@ -23,10 +21,6 @@ sourceSets {
"main" { projectDefault() }
}

tasks.withType<KotlinJvmCompile> {
compilerOptions.freeCompilerArgs.add("-Xcontext-receivers")
}

if (kotlinBuildProperties.isSwiftExportPluginPublishingEnabled) {
publish()
}
Expand Down

0 comments on commit cc39190

Please sign in to comment.