@@ -263,6 +263,29 @@ class CompilationTests {
263263
264264 tests.foreach(_.delete())
265265 }
266+
267+ /* This tests for errors in the program's TASTy trees.
268+ * The test consists of three files: (a) v1/A, (b) v1/B, and (c) v0/A. (a) and (b) are
269+ * compatible, but (b) and (c) are not. If (b) and (c) are compiled together, there should be
270+ * an error when reading the files' TASTy trees. */
271+ locally {
272+ val tastyErrorGroup = TestGroup (" checkInit/tasty-error" )
273+ val tastyErrorOptions = options.without(" -Xfatal-warnings" )
274+
275+ val a0 = defaultOutputDir + tastyErrorGroup + " /A/v0/A"
276+ val a1 = defaultOutputDir + tastyErrorGroup + " /A/v1/A"
277+ val b1 = defaultOutputDir + tastyErrorGroup + " /B/v1/B"
278+ val a0b1 = a0 + " :" + b1
279+
280+ val tests = List (
281+ compileFile(" tests/init/tasty-error/v1/A.scala" , tastyErrorOptions)(tastyErrorGroup),
282+ compileFile(" tests/init/tasty-error/v1/B.scala" , tastyErrorOptions.withClasspath(a1))(tastyErrorGroup),
283+ compileFile(" tests/init/tasty-error/v0/A.scala" , tastyErrorOptions)(tastyErrorGroup),
284+ ).map(_.keepOutput.checkCompile())
285+ compileFile(" tests/init/tasty-error/Main.scala" , tastyErrorOptions.withClasspath(a0b1))(tastyErrorGroup).expectFailure.checkCompile()
286+
287+ tests.foreach(_.delete())
288+ }
266289 }
267290
268291 // parallel backend tests
0 commit comments