Revert "[Metadata] Add tests for missing rewrite of context receivers"

This reverts commit 3c3a9df61c7ed057481560609b58e9dae9744b28.


Revert "[Metadata] Model context receiver types in metadata"

This reverts commit 5ffc027d952de8ef9a115072995e748e6079107f.

Change-Id: I49bf3f74d0eedd63823072d6a426ab15451aa302
diff --git a/src/main/java/com/android/tools/r8/kotlin/KotlinClassInfo.java b/src/main/java/com/android/tools/r8/kotlin/KotlinClassInfo.java
index da35a69..810f2de 100644
--- a/src/main/java/com/android/tools/r8/kotlin/KotlinClassInfo.java
+++ b/src/main/java/com/android/tools/r8/kotlin/KotlinClassInfo.java
@@ -17,7 +17,6 @@
 import com.android.tools.r8.graph.DexString;
 import com.android.tools.r8.utils.Box;
 import com.android.tools.r8.utils.DescriptorUtils;
-import com.android.tools.r8.utils.ListUtils;
 import com.android.tools.r8.utils.Pair;
 import com.android.tools.r8.utils.Reporter;
 import com.google.common.collect.ImmutableList;
@@ -58,8 +57,6 @@
   private final KotlinTypeInfo inlineClassUnderlyingType;
   private final int jvmFlags;
   private final String companionObjectName;
-  // Collection of context receiver types
-  private final List<KotlinTypeInfo> contextReceiverTypes;
 
   // List of tracked assignments of kotlin metadata.
   private final KotlinMetadataMembersTracker originalMembersWithKotlinInfo;
@@ -85,8 +82,7 @@
       KotlinTypeInfo inlineClassUnderlyingType,
       KotlinMetadataMembersTracker originalMembersWithKotlinInfo,
       int jvmFlags,
-      String companionObjectName,
-      List<KotlinTypeInfo> contextReceiverTypes) {
+      String companionObjectName) {
     this.flags = flags;
     this.name = name;
     this.nameCanBeSynthesizedFromClassOrAnonymousObjectOrigin =
@@ -109,7 +105,6 @@
     this.originalMembersWithKotlinInfo = originalMembersWithKotlinInfo;
     this.jvmFlags = jvmFlags;
     this.companionObjectName = companionObjectName;
-    this.contextReceiverTypes = contextReceiverTypes;
   }
 
   public static KotlinClassInfo create(
@@ -193,10 +188,7 @@
         KotlinTypeInfo.create(kmClass.getInlineClassUnderlyingType(), factory, reporter),
         originalMembersWithKotlinInfo,
         JvmExtensionsKt.getJvmFlags(kmClass),
-        setCompanionObject(kmClass, hostClass, reporter),
-        ListUtils.map(
-            kmClass.getContextReceiverTypes(),
-            contextRecieverType -> KotlinTypeInfo.create(contextRecieverType, factory, reporter)));
+        setCompanionObject(kmClass, hostClass, reporter));
   }
 
   private static KotlinTypeReference getAnonymousObjectOrigin(
@@ -422,9 +414,6 @@
       rewritten |=
           inlineClassUnderlyingType.rewrite(kmClass::visitInlineClassUnderlyingType, appView);
     }
-    for (KotlinTypeInfo contextReceiverType : contextReceiverTypes) {
-      rewritten |= contextReceiverType.rewrite(kmClass::visitContextReceiverType, appView);
-    }
     JvmClassExtensionVisitor extensionVisitor =
         (JvmClassExtensionVisitor) kmClass.visitExtensions(JvmClassExtensionVisitor.TYPE);
     extensionVisitor.visitJvmFlags(jvmFlags);
@@ -468,7 +457,6 @@
     forEachApply(superTypes, type -> type::trace, definitionSupplier);
     forEachApply(sealedSubClasses, sealedClass -> sealedClass::trace, definitionSupplier);
     forEachApply(nestedClasses, nested -> nested::trace, definitionSupplier);
-    forEachApply(contextReceiverTypes, nested -> nested::trace, definitionSupplier);
     localDelegatedProperties.trace(definitionSupplier);
     // TODO(b/154347404): trace enum entries.
     if (anonymousObjectOrigin != null) {
diff --git a/src/main/java/com/android/tools/r8/kotlin/KotlinFunctionInfo.java b/src/main/java/com/android/tools/r8/kotlin/KotlinFunctionInfo.java
index 69e4004..f5b40c2 100644
--- a/src/main/java/com/android/tools/r8/kotlin/KotlinFunctionInfo.java
+++ b/src/main/java/com/android/tools/r8/kotlin/KotlinFunctionInfo.java
@@ -10,7 +10,6 @@
 import com.android.tools.r8.graph.DexDefinitionSupplier;
 import com.android.tools.r8.graph.DexEncodedMethod;
 import com.android.tools.r8.graph.DexItemFactory;
-import com.android.tools.r8.utils.ListUtils;
 import com.android.tools.r8.utils.Reporter;
 import java.util.List;
 import kotlinx.metadata.KmFunction;
@@ -42,8 +41,6 @@
   private final KotlinContractInfo contract;
   // A value describing if any of the parameters are crossinline.
   private final boolean crossInlineParameter;
-  // Collection of context receiver types
-  private final List<KotlinTypeInfo> contextReceiverTypes;
 
   private KotlinFunctionInfo(
       int flags,
@@ -56,8 +53,7 @@
       KotlinTypeReference lambdaClassOrigin,
       KotlinVersionRequirementInfo versionRequirements,
       KotlinContractInfo contract,
-      boolean crossInlineParameter,
-      List<KotlinTypeInfo> contextReceiverTypes) {
+      boolean crossInlineParameter) {
     this.flags = flags;
     this.name = name;
     this.returnType = returnType;
@@ -69,7 +65,6 @@
     this.versionRequirements = versionRequirements;
     this.contract = contract;
     this.crossInlineParameter = crossInlineParameter;
-    this.contextReceiverTypes = contextReceiverTypes;
   }
 
   public boolean hasCrossInlineParameter() {
@@ -103,10 +98,7 @@
         getlambdaClassOrigin(kmFunction, factory),
         KotlinVersionRequirementInfo.create(kmFunction.getVersionRequirements()),
         KotlinContractInfo.create(kmFunction.getContract(), factory, reporter),
-        isCrossInline,
-        ListUtils.map(
-            kmFunction.getContextReceiverTypes(),
-            contextRecieverType -> KotlinTypeInfo.create(contextRecieverType, factory, reporter)));
+        isCrossInline);
   }
 
   private static KotlinTypeReference getlambdaClassOrigin(
@@ -149,9 +141,6 @@
     for (KotlinTypeParameterInfo typeParameterInfo : typeParameters) {
       rewritten |= typeParameterInfo.rewrite(kmFunction::visitTypeParameter, appView);
     }
-    for (KotlinTypeInfo contextReceiverType : contextReceiverTypes) {
-      rewritten |= contextReceiverType.rewrite(kmFunction::visitContextReceiverType, appView);
-    }
     if (receiverParameterType != null) {
       rewritten |= receiverParameterType.rewrite(kmFunction::visitReceiverParameterType, appView);
     }
@@ -198,7 +187,6 @@
       receiverParameterType.trace(definitionSupplier);
     }
     forEachApply(typeParameters, param -> param::trace, definitionSupplier);
-    forEachApply(contextReceiverTypes, type -> type::trace, definitionSupplier);
     if (signature != null) {
       signature.trace(definitionSupplier);
     }
diff --git a/src/main/java/com/android/tools/r8/kotlin/KotlinMetadataWriter.java b/src/main/java/com/android/tools/r8/kotlin/KotlinMetadataWriter.java
index dfb5d76..1e4d633 100644
--- a/src/main/java/com/android/tools/r8/kotlin/KotlinMetadataWriter.java
+++ b/src/main/java/com/android/tools/r8/kotlin/KotlinMetadataWriter.java
@@ -379,31 +379,20 @@
         indent,
         "constructors",
         sb,
-        newIndent ->
-            appendKmList(
-                newIndent,
-                "KmConstructor",
-                sb,
-                kmClass.getConstructors().stream()
-                    .sorted(
-                        Comparator.comparing(
-                            kmConstructor ->
-                                JvmExtensionsKt.getSignature(kmConstructor).asString()))
-                    .collect(Collectors.toList()),
-                (nextIndent, constructor) -> {
-                  appendKmConstructor(nextIndent, sb, constructor);
-                }));
-    appendKeyValue(
-        indent,
-        "contextReceiverTypes",
-        sb,
-        newIndent ->
-            appendKmList(
-                newIndent,
-                "KmType",
-                sb,
-                kmClass.getContextReceiverTypes(),
-                (nextIndent, kmType) -> appendKmType(nextIndent, sb, kmType)));
+        newIndent -> {
+          appendKmList(
+              newIndent,
+              "KmConstructor",
+              sb,
+              kmClass.getConstructors().stream()
+                  .sorted(
+                      Comparator.comparing(
+                          kmConstructor -> JvmExtensionsKt.getSignature(kmConstructor).asString()))
+                  .collect(Collectors.toList()),
+              (nextIndent, constructor) -> {
+                appendKmConstructor(nextIndent, sb, constructor);
+              });
+        });
     appendKmDeclarationContainer(indent, sb, kmClass);
   }
 
@@ -469,17 +458,6 @@
                   appendKmContract(nextIndent, sb, contract);
                 });
           }
-          appendKeyValue(
-              newIndent,
-              "contextReceiverTypes",
-              sb,
-              newNewIndent ->
-                  appendKmList(
-                      newNewIndent,
-                      "KmType",
-                      sb,
-                      function.getContextReceiverTypes(),
-                      (nextIndent, kmType) -> appendKmType(nextIndent, sb, kmType)));
           JvmMethodSignature signature = JvmExtensionsKt.getSignature(function);
           appendKeyValue(
               newIndent, "signature", sb, signature != null ? signature.asString() : "null");
@@ -522,17 +500,6 @@
               sb,
               nextIndent -> appendValueParameter(nextIndent, sb, kmProperty.getSetterParameter()));
           appendKmVersionRequirement(newIndent, sb, kmProperty.getVersionRequirements());
-          appendKeyValue(
-              newIndent,
-              "contextReceiverTypes",
-              sb,
-              newNewIndent ->
-                  appendKmList(
-                      newNewIndent,
-                      "KmType",
-                      sb,
-                      kmProperty.getContextReceiverTypes(),
-                      (nextIndent, kmType) -> appendKmType(nextIndent, sb, kmType)));
           appendKeyValue(newIndent, "jvmFlags", sb, JvmExtensionsKt.getJvmFlags(kmProperty) + "");
           JvmFieldSignature fieldSignature = JvmExtensionsKt.getFieldSignature(kmProperty);
           appendKeyValue(
diff --git a/src/main/java/com/android/tools/r8/kotlin/KotlinPropertyInfo.java b/src/main/java/com/android/tools/r8/kotlin/KotlinPropertyInfo.java
index a11b9a9..6d10139 100644
--- a/src/main/java/com/android/tools/r8/kotlin/KotlinPropertyInfo.java
+++ b/src/main/java/com/android/tools/r8/kotlin/KotlinPropertyInfo.java
@@ -12,7 +12,6 @@
 import com.android.tools.r8.graph.DexEncodedMethod;
 import com.android.tools.r8.graph.DexItemFactory;
 import com.android.tools.r8.utils.Box;
-import com.android.tools.r8.utils.ListUtils;
 import com.android.tools.r8.utils.Reporter;
 import java.util.List;
 import kotlinx.metadata.KmProperty;
@@ -59,8 +58,6 @@
   private final KotlinJvmMethodSignatureInfo syntheticMethodForAnnotations;
 
   private final KotlinJvmMethodSignatureInfo syntheticMethodForDelegate;
-  // Collection of context receiver types
-  private final List<KotlinTypeInfo> contextReceiverTypes;
 
   private KotlinPropertyInfo(
       int flags,
@@ -77,8 +74,7 @@
       KotlinJvmMethodSignatureInfo getterSignature,
       KotlinJvmMethodSignatureInfo setterSignature,
       KotlinJvmMethodSignatureInfo syntheticMethodForAnnotations,
-      KotlinJvmMethodSignatureInfo syntheticMethodForDelegate,
-      List<KotlinTypeInfo> contextReceiverTypes) {
+      KotlinJvmMethodSignatureInfo syntheticMethodForDelegate) {
     this.flags = flags;
     this.getterFlags = getterFlags;
     this.setterFlags = setterFlags;
@@ -94,7 +90,6 @@
     this.setterSignature = setterSignature;
     this.syntheticMethodForAnnotations = syntheticMethodForAnnotations;
     this.syntheticMethodForDelegate = syntheticMethodForDelegate;
-    this.contextReceiverTypes = contextReceiverTypes;
   }
 
   public static KotlinPropertyInfo create(
@@ -118,10 +113,7 @@
         KotlinJvmMethodSignatureInfo.create(
             JvmExtensionsKt.getSyntheticMethodForAnnotations(kmProperty), factory),
         KotlinJvmMethodSignatureInfo.create(
-            JvmExtensionsKt.getSyntheticMethodForDelegate(kmProperty), factory),
-        ListUtils.map(
-            kmProperty.getContextReceiverTypes(),
-            contextRecieverType -> KotlinTypeInfo.create(contextRecieverType, factory, reporter)));
+            JvmExtensionsKt.getSyntheticMethodForDelegate(kmProperty), factory));
   }
 
   @Override
@@ -168,9 +160,6 @@
     for (KotlinTypeParameterInfo typeParameter : typeParameters) {
       rewritten |= typeParameter.rewrite(kmProperty::visitTypeParameter, appView);
     }
-    for (KotlinTypeInfo contextReceiverType : contextReceiverTypes) {
-      rewritten |= contextReceiverType.rewrite(kmProperty::visitContextReceiverType, appView);
-    }
     rewritten |= versionRequirements.rewrite(kmProperty::visitVersionRequirement);
     JvmPropertyExtensionVisitor extensionVisitor =
         (JvmPropertyExtensionVisitor) kmProperty.visitExtensions(JvmPropertyExtensionVisitor.TYPE);
@@ -218,7 +207,6 @@
       setterParameter.trace(definitionSupplier);
     }
     forEachApply(typeParameters, param -> param::trace, definitionSupplier);
-    forEachApply(contextReceiverTypes, type -> type::trace, definitionSupplier);
     if (fieldSignature != null) {
       fieldSignature.trace(definitionSupplier);
     }
diff --git a/src/test/java/com/android/tools/r8/KotlinCompilerTool.java b/src/test/java/com/android/tools/r8/KotlinCompilerTool.java
index 259f1a0..36f3b07 100644
--- a/src/test/java/com/android/tools/r8/KotlinCompilerTool.java
+++ b/src/test/java/com/android/tools/r8/KotlinCompilerTool.java
@@ -5,7 +5,6 @@
 
 import static com.android.tools.r8.KotlinCompilerTool.KotlinCompilerVersion.MAX_SUPPORTED_VERSION;
 import static com.android.tools.r8.ToolHelper.isWindows;
-import static com.google.common.io.Files.getNameWithoutExtension;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotEquals;
 import static org.junit.Assert.assertNotNull;
@@ -224,10 +223,6 @@
     return this;
   }
 
-  public KotlinCompilerTool enableExperimentalContextReceivers() {
-    return addArguments("-Xcontext-receivers");
-  }
-
   public KotlinCompilerTool addSourceFiles(Path... files) {
     return addSourceFiles(Arrays.asList(files));
   }
@@ -273,8 +268,7 @@
                   try {
                     // The Kotlin compiler does not require particular naming of files except for
                     // the extension, so just create a file called source.kt in a new directory.
-                    String newFileName = getNameWithoutExtension(fileNotNamedKt.toString()) + ".kt";
-                    Path fileNamedKt = temp.newFolder().toPath().resolve(newFileName);
+                    Path fileNamedKt = temp.newFolder().toPath().resolve("source.kt");
                     Files.copy(fileNotNamedKt, fileNamedKt);
                     return fileNamedKt;
                   } catch (IOException e) {
diff --git a/src/test/java/com/android/tools/r8/kotlin/metadata/MetadataRewriteContextReceiverTest.java b/src/test/java/com/android/tools/r8/kotlin/metadata/MetadataRewriteContextReceiverTest.java
deleted file mode 100644
index 102a056..0000000
--- a/src/test/java/com/android/tools/r8/kotlin/metadata/MetadataRewriteContextReceiverTest.java
+++ /dev/null
@@ -1,193 +0,0 @@
-// Copyright (c) 2023, the R8 project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-package com.android.tools.r8.kotlin.metadata;
-
-import static com.android.tools.r8.KotlinCompilerTool.KotlinCompilerVersion.KOTLINC_1_8_0;
-import static com.android.tools.r8.KotlinCompilerTool.KotlinTargetVersion.JAVA_8;
-import static com.android.tools.r8.utils.codeinspector.Matchers.isPresentAndRenamed;
-import static org.hamcrest.MatcherAssert.assertThat;
-
-import com.android.tools.r8.KotlinTestParameters;
-import com.android.tools.r8.R8TestCompileResult;
-import com.android.tools.r8.TestParameters;
-import com.android.tools.r8.shaking.ProguardKeepAttributes;
-import com.android.tools.r8.utils.DescriptorUtils;
-import com.android.tools.r8.utils.FileUtils;
-import com.android.tools.r8.utils.StringUtils;
-import com.android.tools.r8.utils.codeinspector.ClassSubject;
-import com.android.tools.r8.utils.codeinspector.CodeInspector;
-import java.nio.charset.StandardCharsets;
-import java.nio.file.Files;
-import java.nio.file.Path;
-import java.util.Collection;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
-
-@RunWith(Parameterized.class)
-public class MetadataRewriteContextReceiverTest extends KotlinMetadataTestBase {
-
-  private static final String PKG_LIB = PKG + ".context_receiver_lib";
-  private static final String PKG_APP = PKG + ".context_receiver_app";
-  private static final Path LIB_FILE =
-      getFileInTest(PKG_PREFIX + "/context_receiver_lib", "lib.txt");
-  private static final Path MAIN_FILE =
-      getFileInTest(PKG_PREFIX + "/context_receiver_app", "main.txt");
-  private static final String MAIN = PKG_APP + ".MainKt";
-  private final TestParameters parameters;
-
-  private static final String EXPECTED =
-      StringUtils.lines(
-          "FooImpl::m1",
-          "BarImpl::m2",
-          "BazImpl::m3",
-          "BazImpl::m3",
-          "FooImpl::m1",
-          "BarImpl::m2",
-          "Hello World!");
-
-  @Parameterized.Parameters(name = "{0}, {1}")
-  public static Collection<Object[]> data() {
-    return buildParameters(
-        getTestParameters().withCfRuntimes().build(),
-        getKotlinTestParameters()
-            .withCompilersStartingFromIncluding(KOTLINC_1_8_0)
-            .withOldCompilersStartingFrom(KOTLINC_1_8_0)
-            .withTargetVersion(JAVA_8)
-            .build());
-  }
-
-  public MetadataRewriteContextReceiverTest(
-      TestParameters parameters, KotlinTestParameters kotlinParameters) {
-    super(kotlinParameters);
-    this.parameters = parameters;
-  }
-
-  private static final KotlinCompileMemoizer libJars =
-      getCompileMemoizer()
-          .configure(
-              kotlinc ->
-                  kotlinc
-                      .addSourceFilesWithNonKtExtension(getStaticTemp(), LIB_FILE)
-                      .enableExperimentalContextReceivers());
-
-  @Test
-  public void smokeTest() throws Exception {
-    Path output =
-        kotlinc(parameters.getRuntime().asCf(), kotlinc, targetVersion)
-            .addClasspathFiles(libJars.getForConfiguration(kotlinc, targetVersion))
-            .addSourceFilesWithNonKtExtension(temp, MAIN_FILE)
-            .setOutputPath(temp.newFolder().toPath())
-            .enableExperimentalContextReceivers()
-            .compile();
-    testForJvm()
-        .addRunClasspathFiles(
-            kotlinc.getKotlinStdlibJar(),
-            kotlinc.getKotlinReflectJar(),
-            libJars.getForConfiguration(kotlinc, targetVersion))
-        .addClasspath(output)
-        .run(parameters.getRuntime(), MAIN)
-        .assertSuccessWithOutput(EXPECTED);
-  }
-
-  @Test
-  public void testMetadataForCompilationWithKeepAll() throws Exception {
-    Path libJar =
-        testForR8(parameters.getBackend())
-            .addClasspathFiles(kotlinc.getKotlinAnnotationJar())
-            .addProgramFiles(
-                libJars.getForConfiguration(kotlinc, targetVersion), kotlinc.getKotlinStdlibJar())
-            .addKeepClassAndMembersRules(PKG_LIB + ".*")
-            .addKeepAttributes(
-                ProguardKeepAttributes.SIGNATURE,
-                ProguardKeepAttributes.INNER_CLASSES,
-                ProguardKeepAttributes.ENCLOSING_METHOD)
-            .addKeepKotlinMetadata()
-            .allowDiagnosticWarningMessages()
-            .addOptionsModification(
-                options -> options.testing.keepMetadataInR8IfNotRewritten = false)
-            .compile()
-            // Since this has a keep-all classes rule assert that the meta-data is equal to the
-            // original one.
-            .inspect(
-                inspector ->
-                    assertEqualDeserializedMetadata(
-                        inspector,
-                        new CodeInspector(libJars.getForConfiguration(kotlinc, targetVersion))))
-            .writeToZip();
-    Path main =
-        kotlinc(parameters.getRuntime().asCf(), kotlinc, targetVersion)
-            .addClasspathFiles(libJar)
-            .addSourceFilesWithNonKtExtension(temp, MAIN_FILE)
-            .setOutputPath(temp.newFolder().toPath())
-            .enableExperimentalContextReceivers()
-            .compile();
-    testForJvm()
-        .addRunClasspathFiles(kotlinc.getKotlinStdlibJar(), kotlinc.getKotlinReflectJar(), libJar)
-        .addClasspath(main)
-        .run(parameters.getRuntime(), MAIN)
-        .assertSuccessWithOutput(EXPECTED);
-  }
-
-  @Test
-  public void testMetadataInExtensionFunction_renamedKotlinSources() throws Exception {
-    R8TestCompileResult r8LibraryResult =
-        testForR8(parameters.getBackend())
-            .addClasspathFiles(kotlinc.getKotlinStdlibJar(), kotlinc.getKotlinAnnotationJar())
-            .addProgramFiles(libJars.getForConfiguration(kotlinc, targetVersion))
-            // Ensure that we do not rename members
-            .addKeepRules("-keepclassmembers class * { *; }")
-            // Keep the Foo class but rename it.
-            .addKeepRules("-keep,allowobfuscation class " + PKG_LIB + ".Foo")
-            // Keep the Bar class but rename it.
-            .addKeepRules("-keep,allowobfuscation class " + PKG_LIB + ".Bar")
-            // Keep the Baz class but rename it.
-            .addKeepRules("-keep,allowobfuscation class " + PKG_LIB + ".Baz")
-            // Keep all Printer fields.
-            .addKeepRules("-keep class " + PKG_LIB + ".Printer { *; }")
-            // Keep Super, but allow minification.
-            .addKeepRules("-keep class " + PKG_LIB + ".LibKt { <methods>; }")
-            .addKeepKotlinMetadata()
-            .compile();
-
-    // Rewrite the kotlin source to rewrite the classes from the mapping file
-    String kotlinSource = FileUtils.readTextFile(MAIN_FILE, StandardCharsets.UTF_8);
-
-    CodeInspector inspector = r8LibraryResult.inspector();
-    // Rewrite the source kotlin file that reference the renamed classes uses in the context
-    // receivers.
-    for (String className : new String[] {"Foo", "Bar", "Baz"}) {
-      String originalClassName = PKG_LIB + "." + className;
-      ClassSubject clazz = inspector.clazz(originalClassName);
-      assertThat(clazz, isPresentAndRenamed());
-      kotlinSource =
-          kotlinSource.replace("import " + originalClassName, "import " + clazz.getFinalName());
-      kotlinSource =
-          kotlinSource.replace(
-              ": " + className + " {",
-              ": "
-                  + DescriptorUtils.getSimpleClassNameFromDescriptor(clazz.getFinalDescriptor())
-                  + " {");
-    }
-
-    Path newSource = temp.newFolder().toPath().resolve("main.kt");
-    Files.write(newSource, kotlinSource.getBytes(StandardCharsets.UTF_8));
-
-    Path libJar = r8LibraryResult.writeToZip();
-    Path output =
-        kotlinc(parameters.getRuntime().asCf(), kotlinc, targetVersion)
-            .addClasspathFiles(libJar)
-            .addSourceFiles(newSource)
-            .setOutputPath(temp.newFolder().toPath())
-            .enableExperimentalContextReceivers()
-            .compile();
-
-    testForJvm()
-        .addRunClasspathFiles(kotlinc.getKotlinStdlibJar(), libJar)
-        .addClasspath(output)
-        .run(parameters.getRuntime(), MAIN)
-        .assertSuccessWithOutput(EXPECTED);
-  }
-}
diff --git a/src/test/java/com/android/tools/r8/kotlin/metadata/context_receiver_app/main.txt b/src/test/java/com/android/tools/r8/kotlin/metadata/context_receiver_app/main.txt
deleted file mode 100644
index 9380c6f..0000000
--- a/src/test/java/com/android/tools/r8/kotlin/metadata/context_receiver_app/main.txt
+++ /dev/null
@@ -1,46 +0,0 @@
-// Copyright (c) 2023, the R8 project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-package com.android.tools.r8.kotlin.metadata.context_receiver_app
-
-import com.android.tools.r8.kotlin.metadata.context_receiver_lib.Bar
-import com.android.tools.r8.kotlin.metadata.context_receiver_lib.Foo
-import com.android.tools.r8.kotlin.metadata.context_receiver_lib.Baz
-import com.android.tools.r8.kotlin.metadata.context_receiver_lib.Printer
-import com.android.tools.r8.kotlin.metadata.context_receiver_lib.callFooBar
-
-class FooImpl : Foo {
-
-  override fun m1(): String {
-    println("FooImpl::m1")
-    return "Hello "
-  }
-}
-
-class BarImpl : Bar {
-  override fun m2(): String {
-    println("BarImpl::m2")
-    return "World!"
-  }
-}
-
-class BazImpl : Baz {
-  override fun m3(): String {
-    println("BazImpl::m3")
-    return "BazImpl::m3"
-  }
-}
-
-fun main() {
-  with (FooImpl()) {
-    with (BarImpl()) {
-      val printer = Printer()
-      printer.fooBar()
-      with (BazImpl()) {
-        println(printer.getValue)
-        println(callFooBar())
-      }
-    }
-  }
-}
diff --git a/src/test/java/com/android/tools/r8/kotlin/metadata/context_receiver_lib/lib.txt b/src/test/java/com/android/tools/r8/kotlin/metadata/context_receiver_lib/lib.txt
deleted file mode 100644
index 0235848..0000000
--- a/src/test/java/com/android/tools/r8/kotlin/metadata/context_receiver_lib/lib.txt
+++ /dev/null
@@ -1,35 +0,0 @@
-// Copyright (c) 2023, the R8 project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-package com.android.tools.r8.kotlin.metadata.context_receiver_lib
-
-interface Foo {
-  fun m1(): String
-}
-
-interface Bar {
-  fun m2(): String
-}
-
-interface Baz {
-  fun m3(): String
-}
-
-context(Foo, Bar)
-class Printer {
-
-  fun fooBar() {
-    m1();
-    m2();
-  }
-
-  context(Baz)
-  val getValue: String
-    get() = if (System.currentTimeMillis() == 0L) "foo" else m3()
-}
-
-context(Foo, Bar)
-fun callFooBar() : String {
-  return m1() + m2();
-}
\ No newline at end of file