Skip to content

Commit b668f16

Browse files
authored
Merge pull request #4793 from dotty-staging/remove-debug-dead-code
Remove debug code for stdlib whitelist
2 parents 2e53688 + 7c2a61c commit b668f16

File tree

1 file changed

+1
-41
lines changed

1 file changed

+1
-41
lines changed

compiler/test/dotty/tools/StdLibSources.scala

Lines changed: 1 addition & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -7,26 +7,11 @@ 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

14+
def whitelisted: List[String] = all.diff(blacklisted)
3015
def blacklisted: List[String] = loadList(blacklistFile)
3116

3217
def all: List[String] = {
@@ -38,17 +23,6 @@ object StdLibSources {
3823
collectAllFilesInDir(new File(stdLibPath), Nil)
3924
}
4025

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-
5226
private def loadList(path: String): List[String] = Source.fromFile(path, "UTF8").getLines()
5327
.map(_.trim) // allow identation
5428
.filter(!_.startsWith("#")) // allow comment lines prefixed by #
@@ -58,17 +32,3 @@ object StdLibSources {
5832
.toList
5933

6034
}
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)