Skip to content

Backport "Simplify macro tests with custom args" to LTS #19158

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Dec 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,6 @@ class BootstrappedOnlyCompilationTests {
aggregateTests(
compileFilesInDir("tests/bench", defaultOptions.without("-Yno-deep-subtypes")),
compileFilesInDir("tests/pos-macros", defaultOptions.and("-Xcheck-macros")),
compileFilesInDir("tests/pos-custom-args/semanticdb", defaultOptions.and("-Xsemanticdb")),
compileDir("tests/pos-special/i7592", defaultOptions.and("-Yretain-trees")),
compileDir("tests/pos-special/i11331.1", defaultOptions),
compileDir("tests/pos-custom-args/i13405", defaultOptions.and("-Xfatal-warnings")),
).checkCompile()
}

Expand Down Expand Up @@ -107,12 +103,8 @@ class BootstrappedOnlyCompilationTests {

@Test def negMacros: Unit = {
implicit val testGroup: TestGroup = TestGroup("compileNegWithCompiler")
aggregateTests(
compileFilesInDir("tests/neg-macros", defaultOptions.and("-Xcheck-macros")),
compileFile("tests/pos-macros/i9570.scala", defaultOptions.and("-Xfatal-warnings")),
compileFile("tests/pos-macros/macro-deprecation.scala", defaultOptions.and("-Xfatal-warnings", "-deprecation")),
compileFile("tests/pos-macros/macro-experimental.scala", defaultOptions.and("-Yno-experimental")),
).checkExpectedErrors()
compileFilesInDir("tests/neg-macros", defaultOptions.and("-Xcheck-macros"))
.checkExpectedErrors()
}

@Test def negWithCompiler: Unit = {
Expand All @@ -127,26 +119,20 @@ class BootstrappedOnlyCompilationTests {

@Test def runMacros: Unit = {
implicit val testGroup: TestGroup = TestGroup("runMacros")
aggregateTests(
compileFilesInDir("tests/run-macros", defaultOptions.and("-Xcheck-macros")),
compileFilesInDir("tests/run-custom-args/Yretain-trees", defaultOptions and "-Yretain-trees"),
compileFilesInDir("tests/run-custom-args/Yread-comments", defaultOptions and "-Yread-docs"),
compileFilesInDir("tests/run-custom-args/run-macros-erased", defaultOptions.and("-language:experimental.erasedDefinitions").and("-Xcheck-macros")),
compileDir("tests/run-custom-args/Xmacro-settings/simple", defaultOptions.and("-Xmacro-settings:one,two,three")),
compileDir("tests/run-custom-args/Xmacro-settings/compileTimeEnv", defaultOptions.and("-Xmacro-settings:a,b=1,c.b.a=x.y.z=1,myLogger.level=INFO")),
)
}.checkRuns()
compileFilesInDir("tests/run-macros", defaultOptions.and("-Xcheck-macros"))
.checkRuns()
}

@Test def runWithCompiler: Unit = {
implicit val testGroup: TestGroup = TestGroup("runWithCompiler")
val basicTests = List(
compileFilesInDir("tests/run-with-compiler", withCompilerOptions),
compileFilesInDir("tests/run-staging", withStagingOptions),
compileFilesInDir("tests/run-custom-args/tasty-inspector", withTastyInspectorOptions)
compileFilesInDir("tests/run-tasty-inspector", withTastyInspectorOptions)
)
val tests =
if scala.util.Properties.isWin then basicTests
else compileDir("tests/run-custom-args/tasty-interpreter", withTastyInspectorOptions) :: basicTests
else compileDir("tests/old-tasty-interpreter-prototype", withTastyInspectorOptions) :: basicTests

aggregateTests(tests: _*).checkRuns()
}
Expand Down
1 change: 0 additions & 1 deletion compiler/test/dotty/tools/dotc/CompilationTests.scala
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ class CompilationTests {
compileFilesInDir("tests/pos-custom-args/no-experimental", defaultOptions.and("-Yno-experimental")),
compileFilesInDir("tests/pos-custom-args/strict", defaultOptions.and("-source", "future", "-deprecation", "-Xfatal-warnings")),
compileDir("tests/pos-special/java-param-names", defaultOptions.withJavacOnlyOptions("-parameters")),
compileDir("tests/pos-special/stdlib", defaultOptions),
compileFile(
// succeeds despite -Xfatal-warnings because of -nowarn
"tests/neg-custom-args/fatal-warnings/xfatalWarnings.scala",
Expand Down
2 changes: 2 additions & 0 deletions tests/pos-macros/i9570.scala → tests/neg-macros/i9570.scala
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// scalac: -Xfatal-warnings

import scala.quoted.*

object Macros {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// scalac: -Xfatal-warnings -deprecation

import scala.quoted.*

inline def f = ${ impl } // error
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// scalac: -Yno-experimental

import scala.quoted.*
import scala.annotation.experimental

Expand Down
1 change: 0 additions & 1 deletion tests/pos-custom-args/i13405/Test.scala

This file was deleted.

3 changes: 3 additions & 0 deletions tests/pos-macros/i13405/Test.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
// scalac: -Xfatal-warnings

@main def main: Unit = hh()
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// scalac: -Yretain-trees

def return1 = 1

def testReturn1 = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// scalac: -Xsemanticdb

object Test {
def main(args: Array[String]): Unit = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// scalac: -Xsemanticdb

import scala.quoted.*

object Succ:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// scalac: -Xsemanticdb

import quoted.*

object CodeImpl {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// scalac: -Xsemanticdb

import quoted.*

object TestImpl {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// scalac: -Xsemanticdb

object Test {

def test = TestImpl.fun("")
Expand Down
34 changes: 0 additions & 34 deletions tests/pos-special/stdlib/Test1.scala

This file was deleted.

232 changes: 0 additions & 232 deletions tests/pos-special/stdlib/Test2.scala

This file was deleted.

Loading