Skip to content

Commit

Permalink
Fix dcg compiler plugin to match new APIs
Browse files Browse the repository at this point in the history
Summary: Changes to the compile testing framework are now causing dcg tests to fail. We also need to add the experimental compiler api annotation, to stop the compiler from complaining that we're using experimental methods.

Differential Revision: D54039510

fbshipit-source-id: ab8dc5a263b78750f248f32f540e12548d2e3fef
  • Loading branch information
wangk5 authored and facebook-github-bot committed Feb 22, 2024
1 parent 050aabd commit 1bc8666
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import org.assertj.core.api.Assertions.assertThat
import org.junit.BeforeClass
import org.junit.Test

@OptIn(org.jetbrains.kotlin.compiler.plugin.ExperimentalCompilerApi::class)
class DcgCompilerIdentityTest : DcgTestCase() {

companion object {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ package com.facebook.kotlin.compilerplugins.dataclassgenerate

import com.facebook.kotlin.compilerplugins.dataclassgenerate.configuration.CompilerConfigurationProperties
import com.facebook.kotlin.compilerplugins.dataclassgenerate.configuration.PluginMode
import com.tschuchort.compiletesting.CompilationResult
import com.tschuchort.compiletesting.JvmCompilationResult
import com.tschuchort.compiletesting.KotlinCompilation
import com.tschuchort.compiletesting.PluginOption
import com.tschuchort.compiletesting.SourceFile
Expand All @@ -20,19 +20,14 @@ open class DcgTestCase {
fun compileWithK2(
vararg srcs: SourceFile,
dcgConfig: DcgTestConfiguration = DEFAULT_DCG_CONFIG,
): CompilationResult {
return makeCompilationContext(srcs, dcgConfig)
.apply {
useK2 = true
supportsK2 = true
}
.compile()
): JvmCompilationResult {
return makeCompilationContext(srcs, dcgConfig).apply { supportsK2 = true }.compile()
}

fun compileWithK1(
vararg srcs: SourceFile,
dcgConfig: DcgTestConfiguration = DEFAULT_DCG_CONFIG,
): CompilationResult {
): JvmCompilationResult {
return makeCompilationContext(srcs, dcgConfig).compile()
}

Expand Down

0 comments on commit 1bc8666

Please sign in to comment.