<commit_before>import org.scalatest._
import java.net._
import java.io.File
import scala.reflect.runtime.{ universe => ru }
import scala.tools.reflect.{ ToolBox, ToolBoxError }
import scala.compat.Platform.EOL
import scala.meta._
import scala.meta.syntactic.parsers._
import scala.meta.syntactic.show._
import scala.meta.internal.hosts.scalacompiler.scalahost.Scalahost
import scala.meta.semantic.{ Host => PalladiumHost }
import scala.meta.internal.hosts.scalacompiler.scalahost.{ Host => OurHost }
class ScalaToMeta extends FunSuite {
  def typecheckConvertAndPrettyprint(code: String, debug: Boolean): String = {
    val pluginJar = System.getProperty("sbt.paths.plugin.jar")
    val compilationClasspath = System.getProperty("sbt.paths.tests.classpath").split(File.pathSeparatorChar.toString()).map(path => new URL("file://" + path))
    val classloader = new URLClassLoader(compilationClasspath, getClass().getClassLoader())
    val mirror = ru.runtimeMirror(classloader)
    val tb = mirror.mkToolBox(options = "-cp " + System.getProperty("sbt.paths.tests.classpath") + " -Xplugin:" + pluginJar + " -Xplugin-require:scalahost")
    var result: String = null
    def cont(compilerApi: AnyRef): Unit = {
      val m_compiler = compilerApi.getClass().getDeclaredMethod("compiler")
      val compiler = m_compiler.invoke(compilerApi).asInstanceOf[scala.tools.nsc.Global]
      import compiler._
      import analyzer._
      reporter.reset()
      val m_frontEnd = tb.getClass().getDeclaredMethod("frontEnd")
      val frontEnd = m_frontEnd.invoke(tb).asInstanceOf[scala.tools.reflect.FrontEnd]
      frontEnd.reset()
      def throwIfErrors(): Unit = if (frontEnd.hasErrors) throw ToolBoxError("reflective compilation has failed:" + EOL + EOL + frontEnd.infos.map(_.msg).mkString(EOL))
      val run = new compiler.Run
      compiler.phase = run.parserPhase
      compiler.globalPhase = run.parserPhase
      val unit = compiler.newCompilationUnit(code, "<memory>")
      unit.body = compiler.newUnitParser(unit).parse()
      throwIfErrors()
      compiler.phase = run.namerPhase
      compiler.globalPhase = run.namerPhase
      newNamer(rootContext(unit)).enterSym(unit.body)
      throwIfErrors()
      compiler.phase = run.phaseNamed("packageobjects")
      compiler.globalPhase = run.phaseNamed("packageobjects")
      val openPackageObjectsTraverser = new Traverser {
        override def traverse(tree: Tree): Unit = tree match {
          case ModuleDef(_, _, _) =>
            if (tree.symbol.name == nme.PACKAGEkw) openPackageModule(tree.symbol, tree.symbol.owner)
          case ClassDef(_, _, _, _) =>
            ()
          case _ =>
            super.traverse(tree)
        }
      }
      openPackageObjectsTraverser(unit.body)
      throwIfErrors()
      compiler.phase = run.typerPhase
      compiler.globalPhase = run.typerPhase
      val typer = newTyper(rootContext(unit))
      typer.context.setReportErrors()
      unit.body = typer.typed(unit.body).asInstanceOf[compiler.Tree]
      if (debug) println(unit.body)
      unit.toCheck.foreach(workItem => workItem())
      throwIfErrors()
      val h = Scalahost(compiler).asInstanceOf[PalladiumHostwithOurHost[compiler.type] {  }]
      val ptree = h.toPalladium(unit.body, classOf[Aux.CompUnit])
      if (debug) println(ptree.show[Code])
      if (debug) println(ptree.show[Raw])
      result = ptree.show[Code]
    }<commit_msg>updates to a new build of scala.meta that fixes compound type prettyprinting<commit_after>import org.scalatest._
import java.net._
import java.io.File
import scala.reflect.runtime.{ universe => ru }
import scala.tools.reflect.{ ToolBox, ToolBoxError }
import scala.compat.Platform.EOL
import scala.meta._
import scala.meta.syntactic.parsers._
import scala.meta.syntactic.show._
import scala.meta.internal.hosts.scalacompiler.scalahost.Scalahost
import scala.meta.semantic.{ Host => PalladiumHost }
import scala.meta.internal.hosts.scalacompiler.scalahost.{ Host => OurHost }
class ScalaToMeta extends FunSuite {
  def typecheckConvertAndPrettyprint(code: String, debug: Boolean): String = {
    val pluginJar = System.getProperty("sbt.paths.plugin.jar")
    val compilationClasspath = System.getProperty("sbt.paths.tests.classpath").split(File.pathSeparatorChar.toString()).map(path => new URL("file://" + path))
    val classloader = new URLClassLoader(compilationClasspath, getClass().getClassLoader())
    val mirror = ru.runtimeMirror(classloader)
    val tb = mirror.mkToolBox(options = "-cp " + System.getProperty("sbt.paths.tests.classpath") + " -Xplugin:" + pluginJar + " -Xplugin-require:scalahost")
    var result: String = null
    def cont(compilerApi: AnyRef): Unit = {
      val m_compiler = compilerApi.getClass().getDeclaredMethod("compiler")
      val compiler = m_compiler.invoke(compilerApi).asInstanceOf[scala.tools.nsc.Global]
      import compiler._
      import analyzer._
      reporter.reset()
      val m_frontEnd = tb.getClass().getDeclaredMethod("frontEnd")
      val frontEnd = m_frontEnd.invoke(tb).asInstanceOf[scala.tools.reflect.FrontEnd]
      frontEnd.reset()
      def throwIfErrors(): Unit = if (frontEnd.hasErrors) throw ToolBoxError("reflective compilation has failed:" + EOL + EOL + frontEnd.infos.map(_.msg).mkString(EOL))
      val run = new compiler.Run
      compiler.phase = run.parserPhase
      compiler.globalPhase = run.parserPhase
      val unit = compiler.newCompilationUnit(code, "<memory>")
      unit.body = compiler.newUnitParser(unit).parse()
      throwIfErrors()
      compiler.phase = run.namerPhase
      compiler.globalPhase = run.namerPhase
      newNamer(rootContext(unit)).enterSym(unit.body)
      throwIfErrors()
      compiler.phase = run.phaseNamed("packageobjects")
      compiler.globalPhase = run.phaseNamed("packageobjects")
      val openPackageObjectsTraverser = new Traverser {
        override def traverse(tree: Tree): Unit = tree match {
          case ModuleDef(_, _, _) =>
            if (tree.symbol.name == nme.PACKAGEkw) openPackageModule(tree.symbol, tree.symbol.owner)
          case ClassDef(_, _, _, _) =>
            ()
          case _ =>
            super.traverse(tree)
        }
      }
      openPackageObjectsTraverser(unit.body)
      throwIfErrors()
      compiler.phase = run.typerPhase
      compiler.globalPhase = run.typerPhase
      val typer = newTyper(rootContext(unit))
      typer.context.setReportErrors()
      unit.body = typer.typed(unit.body).asInstanceOf[compiler.Tree]
      if (debug) println(unit.body)
      unit.toCheck.foreach(workItem => workItem())
      throwIfErrors()
      val h = Scalahost(compiler).asInstanceOf[PalladiumHost with OurHost[compiler.type] {}]
      val ptree = h.toPalladium(unit.body, classOf[Aux.CompUnit])
      if (debug) println(ptree.show[Code])
      if (debug) println(ptree.show[Raw])
      result = ptree.show[Code]
    }
{'fraction_non_alphanumeric': 0.11876726268352958, 'fraction_numerical': 0.0, 'mean_word_length': 3.608171466845278, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 21, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1114966', 'n_tokens_mistral': 2091, 'n_tokens_neox': 2081, 'n_words': 385}