Skip to content

Commit c0aca2c

Browse files
committed
Test source compiled twice
Test that an error message is issued for sources in different directories but with the same filename and package. Also: Drop out-of-date ErrorMessageTest
1 parent 2f98500 commit c0aca2c

File tree

4 files changed

+9
-15
lines changed

4 files changed

+9
-15
lines changed

compiler/test/dotty/tools/dotc/CompilationTests.scala

+5-1
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,11 @@ class CompilationTests extends ParallelTesting {
165165
compileFile("tests/neg-custom-args/i3627.scala", allowDeepSubtypes) +
166166
compileFile("tests/neg-custom-args/matchtype-loop.scala", allowDeepSubtypes) +
167167
compileFile("tests/neg-custom-args/completeFromSource/nested/Test1.scala", defaultOptions.and("-sourcepath", "tests/neg-custom-args", "-scansource")) +
168-
compileFile("tests/neg-custom-args/repeatedArgs213.scala", defaultOptions.and("-Ynew-collections"))
168+
compileFile("tests/neg-custom-args/repeatedArgs213.scala", defaultOptions.and("-Ynew-collections")) +
169+
compileList("duplicate source", List(
170+
"tests/neg-custom-args/toplevel-samesource/S.scala",
171+
"tests/neg-custom-args/toplevel-samesource/nested/S.scala"),
172+
defaultOptions)
169173
}.checkExpectedErrors()
170174

171175
@Test def fuzzyAll: Unit = {

compiler/test/dotty/tools/dotc/reporting/ErrorMessagesTests.scala

-14
Original file line numberDiff line numberDiff line change
@@ -705,20 +705,6 @@ class ErrorMessagesTests extends ErrorMessagesTest {
705705
assertEquals("final", flags.toString)
706706
}
707707

708-
@Test def topLevelCantBeImplicit =
709-
checkMessagesAfter(FrontEnd.name) {
710-
"""package Foo {
711-
| implicit object S
712-
|}
713-
|""".stripMargin
714-
}
715-
.expect { (ictx, messages) =>
716-
implicit val ctx: Context = ictx
717-
assertMessageCount(1, messages)
718-
val TopLevelCantBeImplicit(symbol) :: Nil = messages
719-
assertEquals("object S", symbol.show)
720-
}
721-
722708
@Test def typesAndTraitsCantBeImplicit =
723709
checkMessagesAfter(FrontEnd.name) {
724710
"""class Foo {
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
package p
2+
val a = 1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
package p
2+
val b = 2 // error: package object S$package in package p has already been compiled once during this run

0 commit comments

Comments
 (0)