@@ -4,19 +4,31 @@ import java.util.stream.{ Stream => JStream }
4
4
5
5
import scala .collection .JavaConverters ._
6
6
7
- object Test {
8
-
9
- def main (args : Array [String ]): Unit = checkIdempotency()
10
-
11
- val blacklisted = Set (
12
- // Bridges on collections in different order. Second one in scala2 order.
7
+ object IdempotencyCheck {
8
+ val blacklistedSet = Set (
9
+ // No fix needed. Bridges on collections in different order. Second one in scala2 order.
13
10
" pos/Map/scala/collection/immutable/Map" ,
14
11
" pos/Map/scala/collection/immutable/AbstractMap" ,
15
12
" pos/t1203a/NodeSeq" ,
16
13
" pos/i2345/Whatever"
17
14
)
18
15
19
- def checkIdempotency (): Unit = {
16
+ def blacklisted (s : String ) = {
17
+ blacklistedSet(s) ||
18
+ // FIXME: non-deterministic method/class names
19
+ s.contains(" $$anon$" ) ||
20
+ s.contains(" $$anonfun$" ) ||
21
+ s.contains(" $accu$" ) ||
22
+ s.contains(" $accum$" ) ||
23
+ s.startsWith(" /dotty/dotty/tools/dotc/sbt/ExtractAPICollector$classFirstSort$" ) ||
24
+ s.startsWith(" /dotty/dotty/tools/dotc/transform/PatternMatcher$Translator$TreeMakers$IntEqualityTestTreeMaker$" ) ||
25
+ s.startsWith(" /dotty/dotty/tools/dotc/typer/RefChecks$MixinOverrideError$" ) ||
26
+ s.startsWith(" /dotty/dotty/tools/dotc/typer/ImplicitRunInfo$liftToClasses$" ) ||
27
+ s.startsWith(" /dotty/dotty/tools/dotc/typer/Inliner$addAccessors$" ) ||
28
+ s.startsWith(" /dotty/dotty/tools/dotc/typer/ErrorReporting$reported$" )
29
+ }
30
+
31
+ def checkIdempotency (dirPrefix : String ): Unit = {
20
32
var failed = 0
21
33
var total = 0
22
34
@@ -26,20 +38,21 @@ object Test {
26
38
def isBytecode (file : String ) = file.endsWith(" .class" ) || file.endsWith(" .tasty" )
27
39
paths.iterator.asScala.filter(path => isBytecode(path.toString)).toList
28
40
}
29
- val compilerDir1 = Paths .get(" ../out/idempotency1 " )
30
- val compilerDir2 = Paths .get(" ../out/idempotency2 " )
41
+ val compilerDir1 = Paths .get(dirPrefix + 1 )
42
+ val compilerDir2 = Paths .get(dirPrefix + 2 )
31
43
bytecodeFiles(Files .walk(compilerDir1)) ++ bytecodeFiles(Files .walk(compilerDir2))
32
44
}
33
- val groups = bytecodeFiles.groupBy(f => f.toString.substring(" ../out/idempotencyN/" .length, f.toString.length - 6 ))
45
+ val groups = bytecodeFiles.groupBy(f => f.toString.substring(dirPrefix.length + 1 , f.toString.length - 6 ))
46
+
34
47
groups.filterNot(x => blacklisted(x._1)).valuesIterator.flatMap { g =>
35
48
def pred (f : Path , i : Int , isTasty : Boolean ) =
36
- f.toString.contains(" idempotency " + i) && f.toString.endsWith(if (isTasty) " .tasty" else " .class" )
49
+ f.toString.contains(dirPrefix + i) && f.toString.endsWith(if (isTasty) " .tasty" else " .class" )
37
50
val class1 = g.find(f => pred(f, 1 , isTasty = false ))
38
51
val class2 = g.find(f => pred(f, 2 , isTasty = false ))
39
52
val tasty1 = g.find(f => pred(f, 1 , isTasty = true ))
40
53
val tasty2 = g.find(f => pred(f, 2 , isTasty = true ))
41
- assert(class1.isDefined, " Could not find class in idempotency1 for " + class2)
42
- assert(class2.isDefined, " Could not find class in idempotency2 for " + class1)
54
+ assert(class1.isDefined, s " Could not find class in ${dirPrefix + 1 } for $ class2" )
55
+ assert(class2.isDefined, s " Could not find class in ${dirPrefix + 2 } for $ class1" )
43
56
if (tasty1.isEmpty || tasty2.isEmpty) Nil
44
57
else List (Tuple4 (class1.get, tasty1.get, class2.get, tasty2.get))
45
58
}.toList
0 commit comments