Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert "Get fullName post flatten, to get flatten names" #1256

Merged
merged 1 commit into from
Sep 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ sealed class ZincCompiler(settings: Settings, dreporter: DelegatingReporter, out
}
()
}
exitingFlatten(loop(suffix.length(), symbol))
loop(suffix.length(), symbol)
b.append(suffix)
b.toString
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import java.io.PrintWriter
import xsbti.compile.Output
import scala.reflect.{ internal => sri }
import scala.reflect.internal.{ util => sriu }
import scala.tools.nsc.{ Global, Phase, Settings }
import scala.tools.nsc.{ Global, Settings }
import scala.tools.nsc.interactive.RangePositions
import scala.tools.nsc.symtab.Flags, Flags._

Expand Down Expand Up @@ -150,8 +150,7 @@ abstract class Compat {
}

/** Defines compatibility utils for [[ZincCompiler]]. */
trait ZincGlobalCompat { g: Global =>
@inline final def exitingFlatten[T](op: => T): T = atPhase(currentRun.flattenPhase.next)(op)
trait ZincGlobalCompat {

/** Use `dropRun` only in 2.10.x series. It was removed as of 2.11.0. */
protected def superDropRun(): Unit = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -232,9 +232,6 @@ class IncHandler(directory: Path, cacheDir: Path, scriptedLog: ManagedLogger, co
onArgs("checkProducts") {
case (p, src :: products, i) => p.checkProducts(i, dropRightColon(src), products)
},
onArgs("checkProductsExists") {
case (p, src :: Nil, i) => p.checkProductsExist(i, src)
},
onArgs("checkDependencies") {
case (p, cls :: dependencies, i) => p.checkDependencies(i, dropRightColon(cls), dependencies)
},
Expand Down Expand Up @@ -444,32 +441,28 @@ case class ProjectStructure(
()
}

def getProducts(analysis: Analysis)(srcFile: String): Set[VirtualFileRef] =
analysis.relations.products(converter.toVirtualFile(baseDirectory / srcFile))

def checkProducts(i: IncState, src: String, expected: List[String]): Future[Unit] =
compile(i).map { analysis =>
// def isWindows: Boolean = sys.props("os.name").toLowerCase.startsWith("win")
// def relativeClassDir(f: File): File = f.relativeTo(classesDir) getOrElse f
// def normalizePath(path: String): String = {
// if (isWindows) path.replace('\\', '/') else path
// }
def products(srcFile: String): Set[String] = {
val productFiles = analysis.relations.products(converter.toVirtualFile(baseDirectory / src))
productFiles.map { file: VirtualFileRef =>
// if (JarUtils.isClassInJar(file)) {
// JarUtils.ClassInJar.fromPath(output.toPath).toClassFilePath
// } else {
// normalizePath(relativeClassDir(file).getPath)
// }
file.id
}
}
def assertClasses(expected: Set[String], actual: Set[String]) =
assert(
expected == actual,
s"""Mismatch:
|Expected:${expected.map("\n " + _).mkString}
|Obtained:${actual.map("\n " + _).mkString}""".stripMargin
)
assert(expected == actual, s"Expected $expected products, got $actual")

assertClasses(expected.toSet, getProducts(analysis)(src).map(_.id))
()
}

def checkProductsExist(i: IncState, src: String): Future[Unit] =
compile(i).map { analysis =>
val missing =
for (p <- getProducts(analysis)(src).toList if !Files.exists(converter.toPath(p))) yield p
assert(
missing.isEmpty,
s"""Missing ${missing.size} products:${missing.map("\n " + _).mkString}
|Generated:${generatedClassFiles.get.toList.map("\n " + _).mkString}""".stripMargin
)
assertClasses(expected.toSet, products(src))
()
}

Expand Down
13 changes: 0 additions & 13 deletions zinc/src/sbt-test/source-dependencies/compactify-nested/main.scala

This file was deleted.

2 changes: 0 additions & 2 deletions zinc/src/sbt-test/source-dependencies/compactify-nested/test

This file was deleted.