@@ -278,20 +278,45 @@ class CompilationTests {
278278 * compatible, but (b) and (c) are not. If (b) and (c) are compiled together, there should be
279279 * an error when reading the files' TASTy trees. */
280280 locally {
281- val tastyErrorGroup = TestGroup (" checkInit/tasty-error" )
281+ val tastyErrorGroup = TestGroup (" checkInit/tasty-error/val-or-defdef " )
282282 val tastyErrorOptions = options.without(" -Xfatal-warnings" )
283283
284- val a0Dir = defaultOutputDir + tastyErrorGroup + " /A/v0/A"
285- val a1Dir = defaultOutputDir + tastyErrorGroup + " /A/v1/A"
286- val b1Dir = defaultOutputDir + tastyErrorGroup + " /B/v1/B"
284+ val classA0 = defaultOutputDir + tastyErrorGroup + " /A/v0/A"
285+ val classA1 = defaultOutputDir + tastyErrorGroup + " /A/v1/A"
286+ val classB1 = defaultOutputDir + tastyErrorGroup + " /B/v1/B"
287287
288288 val tests = List (
289- compileFile(" tests/init/tasty-error/v1/A.scala" , tastyErrorOptions)(tastyErrorGroup),
290- compileFile(" tests/init/tasty-error/v1/B.scala" , tastyErrorOptions.withClasspath(a1Dir ))(tastyErrorGroup),
291- compileFile(" tests/init/tasty-error/v0/A.scala" , tastyErrorOptions)(tastyErrorGroup),
289+ compileFile(" tests/init/tasty-error/val-or-defdef/ v1/A.scala" , tastyErrorOptions)(tastyErrorGroup),
290+ compileFile(" tests/init/tasty-error/val-or-defdef/ v1/B.scala" , tastyErrorOptions.withClasspath(classA1 ))(tastyErrorGroup),
291+ compileFile(" tests/init/tasty-error/val-or-defdef/ v0/A.scala" , tastyErrorOptions)(tastyErrorGroup),
292292 ).map(_.keepOutput.checkCompile())
293293
294- compileFile(" tests/init/tasty-error/Main.scala" , tastyErrorOptions.withClasspath(a0Dir).withClasspath(b1Dir))(tastyErrorGroup).checkExpectedErrors()
294+ compileFile(" tests/init/tasty-error/val-or-defdef/Main.scala" , tastyErrorOptions.withClasspath(classA0).withClasspath(classB1))(tastyErrorGroup).checkExpectedErrors()
295+
296+ tests.foreach(_.delete())
297+ }
298+
299+ /* This tests for errors in the program's TASTy trees.
300+ * 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
301+ * compatible, but v1/B and v0/A are not. If v1/B and v0/A are compiled together, there should be
302+ * an error when reading the files' TASTy trees. This fact is demonstrated by the compilation of Main. */
303+ locally {
304+ val tastyErrorGroup = TestGroup (" checkInit/tasty-error/typedef" )
305+ val tastyErrorOptions = options.without(" -Xfatal-warnings" ).without(" -Ycheck:all" )
306+
307+ val classC = defaultOutputDir + tastyErrorGroup + " /C/typedef/C"
308+ val classA0 = defaultOutputDir + tastyErrorGroup + " /A/v0/A"
309+ val classA1 = defaultOutputDir + tastyErrorGroup + " /A/v1/A"
310+ val classB1 = defaultOutputDir + tastyErrorGroup + " /B/v1/B"
311+
312+ val tests = List (
313+ compileFile(" tests/init/tasty-error/typedef/C.scala" , tastyErrorOptions)(tastyErrorGroup),
314+ compileFile(" tests/init/tasty-error/typedef/v1/A.scala" , tastyErrorOptions.withClasspath(classC))(tastyErrorGroup),
315+ compileFile(" tests/init/tasty-error/typedef/v1/B.scala" , tastyErrorOptions.withClasspath(classC).withClasspath(classA1))(tastyErrorGroup),
316+ compileFile(" tests/init/tasty-error/typedef/v0/A.scala" , tastyErrorOptions.withClasspath(classC))(tastyErrorGroup),
317+ ).map(_.keepOutput.checkCompile())
318+
319+ compileFile(" tests/init/tasty-error/typedef/Main.scala" , tastyErrorOptions.withClasspath(classC).withClasspath(classA0).withClasspath(classB1))(tastyErrorGroup).checkExpectedErrors()
295320
296321 tests.foreach(_.delete())
297322 }
0 commit comments