@@ -275,20 +275,45 @@ class CompilationTests {
275
275
* compatible, but (b) and (c) are not. If (b) and (c) are compiled together, there should be
276
276
* an error when reading the files' TASTy trees. */
277
277
locally {
278
- val tastyErrorGroup = TestGroup (" checkInit/tasty-error" )
278
+ val tastyErrorGroup = TestGroup (" checkInit/tasty-error/val-or-defdef " )
279
279
val tastyErrorOptions = options.without(" -Xfatal-warnings" )
280
280
281
- val a0Dir = defaultOutputDir + tastyErrorGroup + " /A/v0/A"
282
- val a1Dir = defaultOutputDir + tastyErrorGroup + " /A/v1/A"
283
- val b1Dir = defaultOutputDir + tastyErrorGroup + " /B/v1/B"
281
+ val classA0 = defaultOutputDir + tastyErrorGroup + " /A/v0/A"
282
+ val classA1 = defaultOutputDir + tastyErrorGroup + " /A/v1/A"
283
+ val classB1 = defaultOutputDir + tastyErrorGroup + " /B/v1/B"
284
284
285
285
val tests = List (
286
- compileFile(" tests/init/tasty-error/v1/A.scala" , tastyErrorOptions)(tastyErrorGroup),
287
- compileFile(" tests/init/tasty-error/v1/B.scala" , tastyErrorOptions.withClasspath(a1Dir ))(tastyErrorGroup),
288
- compileFile(" tests/init/tasty-error/v0/A.scala" , tastyErrorOptions)(tastyErrorGroup),
286
+ compileFile(" tests/init/tasty-error/val-or-defdef/ v1/A.scala" , tastyErrorOptions)(tastyErrorGroup),
287
+ compileFile(" tests/init/tasty-error/val-or-defdef/ v1/B.scala" , tastyErrorOptions.withClasspath(classA1 ))(tastyErrorGroup),
288
+ compileFile(" tests/init/tasty-error/val-or-defdef/ v0/A.scala" , tastyErrorOptions)(tastyErrorGroup),
289
289
).map(_.keepOutput.checkCompile())
290
290
291
- compileFile(" tests/init/tasty-error/Main.scala" , tastyErrorOptions.withClasspath(a0Dir).withClasspath(b1Dir))(tastyErrorGroup).checkExpectedErrors()
291
+ compileFile(" tests/init/tasty-error/val-or-defdef/Main.scala" , tastyErrorOptions.withClasspath(classA0).withClasspath(classB1))(tastyErrorGroup).checkExpectedErrors()
292
+
293
+ tests.foreach(_.delete())
294
+ }
295
+
296
+ /* This tests for errors in the program's TASTy trees.
297
+ * The test consists of five files: Main, C, v1/A, v1/B, and v0/A. The files v1/A, v1/B, and v0/A all depend on C. v1/A and v1/B are
298
+ * compatible, but v1/B and v0/A are not. If v1/B and v0/A are compiled together, there should be
299
+ * an error when reading the files' TASTy trees. This fact is demonstrated by the compilation of Main. */
300
+ locally {
301
+ val tastyErrorGroup = TestGroup (" checkInit/tasty-error/typedef" )
302
+ val tastyErrorOptions = options.without(" -Xfatal-warnings" ).without(" -Ycheck:all" )
303
+
304
+ val classC = defaultOutputDir + tastyErrorGroup + " /C/typedef/C"
305
+ val classA0 = defaultOutputDir + tastyErrorGroup + " /A/v0/A"
306
+ val classA1 = defaultOutputDir + tastyErrorGroup + " /A/v1/A"
307
+ val classB1 = defaultOutputDir + tastyErrorGroup + " /B/v1/B"
308
+
309
+ val tests = List (
310
+ compileFile(" tests/init/tasty-error/typedef/C.scala" , tastyErrorOptions)(tastyErrorGroup),
311
+ compileFile(" tests/init/tasty-error/typedef/v1/A.scala" , tastyErrorOptions.withClasspath(classC))(tastyErrorGroup),
312
+ compileFile(" tests/init/tasty-error/typedef/v1/B.scala" , tastyErrorOptions.withClasspath(classC).withClasspath(classA1))(tastyErrorGroup),
313
+ compileFile(" tests/init/tasty-error/typedef/v0/A.scala" , tastyErrorOptions.withClasspath(classC))(tastyErrorGroup),
314
+ ).map(_.keepOutput.checkCompile())
315
+
316
+ compileFile(" tests/init/tasty-error/typedef/Main.scala" , tastyErrorOptions.withClasspath(classC).withClasspath(classA0).withClasspath(classB1))(tastyErrorGroup).checkExpectedErrors()
292
317
293
318
tests.foreach(_.delete())
294
319
}
0 commit comments