@@ -241,20 +241,45 @@ class CompilationTests {
241241 * compatible, but (b) and (c) are not. If (b) and (c) are compiled together, there should be
242242 * an error when reading the files' TASTy trees. */
243243 locally {
244- val tastyErrorGroup = TestGroup (" checkInit/tasty-error" )
244+ val tastyErrorGroup = TestGroup (" checkInit/tasty-error/val-or-defdef " )
245245 val tastyErrorOptions = options.without(" -Xfatal-warnings" )
246246
247- val a0Dir = defaultOutputDir + tastyErrorGroup + " /A/v0/A"
248- val a1Dir = defaultOutputDir + tastyErrorGroup + " /A/v1/A"
249- val b1Dir = defaultOutputDir + tastyErrorGroup + " /B/v1/B"
247+ val classA0 = defaultOutputDir + tastyErrorGroup + " /A/v0/A"
248+ val classA1 = defaultOutputDir + tastyErrorGroup + " /A/v1/A"
249+ val classB1 = defaultOutputDir + tastyErrorGroup + " /B/v1/B"
250250
251251 val tests = List (
252- compileFile(" tests/init/tasty-error/v1/A.scala" , tastyErrorOptions)(tastyErrorGroup),
253- compileFile(" tests/init/tasty-error/v1/B.scala" , tastyErrorOptions.withClasspath(a1Dir ))(tastyErrorGroup),
254- compileFile(" tests/init/tasty-error/v0/A.scala" , tastyErrorOptions)(tastyErrorGroup),
252+ compileFile(" tests/init/tasty-error/val-or-defdef/ v1/A.scala" , tastyErrorOptions)(tastyErrorGroup),
253+ compileFile(" tests/init/tasty-error/val-or-defdef/ v1/B.scala" , tastyErrorOptions.withClasspath(classA1 ))(tastyErrorGroup),
254+ compileFile(" tests/init/tasty-error/val-or-defdef/ v0/A.scala" , tastyErrorOptions)(tastyErrorGroup),
255255 ).map(_.keepOutput.checkCompile())
256256
257- compileFile(" tests/init/tasty-error/Main.scala" , tastyErrorOptions.withClasspath(a0Dir).withClasspath(b1Dir))(tastyErrorGroup).checkExpectedErrors()
257+ compileFile(" tests/init/tasty-error/val-or-defdef/Main.scala" , tastyErrorOptions.withClasspath(classA0).withClasspath(classB1))(tastyErrorGroup).checkExpectedErrors()
258+
259+ tests.foreach(_.delete())
260+ }
261+
262+ /* This tests for errors in the program's TASTy trees.
263+ * 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
264+ * compatible, but v1/B and v0/A are not. If v1/B and v0/A are compiled together, there should be
265+ * an error when reading the files' TASTy trees. This fact is demonstrated by the compilation of Main. */
266+ locally {
267+ val tastyErrorGroup = TestGroup (" checkInit/tasty-error/typedef" )
268+ val tastyErrorOptions = options.without(" -Xfatal-warnings" ).without(" -Ycheck:all" )
269+
270+ val classC = defaultOutputDir + tastyErrorGroup + " /C/typedef/C"
271+ val classA0 = defaultOutputDir + tastyErrorGroup + " /A/v0/A"
272+ val classA1 = defaultOutputDir + tastyErrorGroup + " /A/v1/A"
273+ val classB1 = defaultOutputDir + tastyErrorGroup + " /B/v1/B"
274+
275+ val tests = List (
276+ compileFile(" tests/init/tasty-error/typedef/C.scala" , tastyErrorOptions)(tastyErrorGroup),
277+ compileFile(" tests/init/tasty-error/typedef/v1/A.scala" , tastyErrorOptions.withClasspath(classC))(tastyErrorGroup),
278+ compileFile(" tests/init/tasty-error/typedef/v1/B.scala" , tastyErrorOptions.withClasspath(classC).withClasspath(classA1))(tastyErrorGroup),
279+ compileFile(" tests/init/tasty-error/typedef/v0/A.scala" , tastyErrorOptions.withClasspath(classC))(tastyErrorGroup),
280+ ).map(_.keepOutput.checkCompile())
281+
282+ compileFile(" tests/init/tasty-error/typedef/Main.scala" , tastyErrorOptions.withClasspath(classC).withClasspath(classA0).withClasspath(classB1))(tastyErrorGroup).checkExpectedErrors()
258283
259284 tests.foreach(_.delete())
260285 }
0 commit comments