Skip to content

Commit b510c6a

Browse files
committed
Remove debug code for stdlib whitelist
Now that our blacklist is a single file this code does not serve any purpose. It was added back when the whitelist was the main file as a way to copy files from the blacklist to the whitelist.
1 parent 385082b commit b510c6a

File tree

1 file changed

+0
-50
lines changed

1 file changed

+0
-50
lines changed

compiler/test/dotty/tools/StdLibSources.scala

Lines changed: 0 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -7,48 +7,12 @@ import org.junit.Assert._
77

88
object StdLibSources {
99

10-
/* For debug only */
11-
private val useExplicitWhiteList = false
12-
1310
private final val stdLibPath = "scala2-library/src/library/"
1411

1512
def blacklistFile: String = "compiler/test/dotc/scala-collections.blacklist"
16-
private def whitelistFile: String = "compiler/test/dotc/scala-collections.whitelist"
17-
18-
def whitelisted: List[String] = {
19-
lazy val whitelistBasedOnBlacklist = all.diff(blacklisted)
20-
if (!useExplicitWhiteList) {
21-
whitelistBasedOnBlacklist
22-
} else if (!new File(whitelistFile).exists()) {
23-
genWhitelist(whitelistBasedOnBlacklist.map(_.replace(stdLibPath, "")))
24-
whitelistBasedOnBlacklist
25-
} else {
26-
loadList(whitelistFile)
27-
}
28-
}
2913

3014
def blacklisted: List[String] = loadList(blacklistFile)
3115

32-
def all: List[String] = {
33-
def collectAllFilesInDir(dir: File, acc: List[String]): List[String] = {
34-
val files = dir.listFiles()
35-
val acc2 = files.foldLeft(acc)((acc1, file) => if (file.isFile && file.getPath.endsWith(".scala")) file.getPath :: acc1 else acc1)
36-
files.foldLeft(acc2)((acc3, file) => if (file.isDirectory) collectAllFilesInDir(file, acc3) else acc3)
37-
}
38-
collectAllFilesInDir(new File(stdLibPath), Nil)
39-
}
40-
41-
private def genWhitelist(list: List[String]): Unit = {
42-
println(s"Generating $whitelistFile based on $blacklistFile")
43-
val whitelist = new File(whitelistFile)
44-
val p = new java.io.PrintWriter(whitelist)
45-
try {
46-
list.foreach(p.println)
47-
} finally {
48-
p.close()
49-
}
50-
}
51-
5216
private def loadList(path: String): List[String] = Source.fromFile(path, "UTF8").getLines()
5317
.map(_.trim) // allow identation
5418
.filter(!_.startsWith("#")) // allow comment lines prefixed by #
@@ -58,17 +22,3 @@ object StdLibSources {
5822
.toList
5923

6024
}
61-
62-
class StdLibSources {
63-
@Test def checkWBLists = {
64-
val stdlibFilesBlackListed = StdLibSources.blacklisted
65-
66-
val duplicates = stdlibFilesBlackListed.groupBy(x => x).filter(_._2.size > 1).filter(_._2.size > 1)
67-
val msg = duplicates.map(x => s"'${x._1}' appears ${x._2.size} times").mkString(s"Duplicate entries in ${StdLibSources.blacklistFile}:\n", "\n", "\n")
68-
assertTrue(msg, duplicates.isEmpty)
69-
70-
val filesNotInStdLib = stdlibFilesBlackListed.toSet -- StdLibSources.all
71-
val msg2 = filesNotInStdLib.map(x => s"'$x'").mkString(s"Entries in ${StdLibSources.blacklistFile} where not found:\n", "\n", "\n")
72-
assertTrue(msg2, filesNotInStdLib.isEmpty)
73-
}
74-
}

0 commit comments

Comments
 (0)