Skip to content

Commit 7e2dd57

Browse files
committed
Support //> options directive in compilation tests
1 parent ca6a80e commit 7e2dd57

File tree

402 files changed

+403
-402
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

402 files changed

+403
-402
lines changed

compiler/test/dotty/tools/utils.scala

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,13 +80,15 @@ def toolArgsFor(tool: ToolName)(lines: List[String]): List[String] =
8080
// scalac: arg1 arg2, with alternative opening, optional space, alt names, text that is not */ up to end.
8181
// groups are (name, args)
8282
private val toolArg = raw"(?://|/\*| \*) ?(?i:(${ToolName.values.mkString("|")})):((?:[^*]|\*(?!/))*)".r.unanchored
83+
private val directiveOptionsArg = raw"//> using options (.*)".r.unanchored
8384

8485
// Inspect the lines for compiler options of the form
8586
// `// scalac: args`, `/* scalac: args`, ` * scalac: args`.
8687
// If args string ends in close comment, stop at the `*` `/`.
8788
// Returns all the matches by the regex.
8889
def toolArgsParse(lines: List[String]): List[(String,String)] =
89-
lines.flatMap { case toolArg(name, args) => List((name, args)) case _ => Nil }
90+
lines.flatMap { case toolArg(name, args) => List((name, args)) case _ => Nil } ++
91+
lines.flatMap { case directiveOptionsArg(args) => List(("scalac", args)) case _ => Nil }
9092

9193
import org.junit.Test
9294
import org.junit.Assert._

tests/explicit-nulls/neg-patmat/match-pat.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// scalac: -Xfatal-warnings
1+
//> using options -Xfatal-warnings
22

33
class Foo {
44

tests/explicit-nulls/pos/i14682.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// scalac: -Ysafe-init
1+
//> using options -Ysafe-init
22

33
class C1:
44
sealed abstract class Name {

tests/explicit-nulls/pos/i14947.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// scalac: -Ytest-pickler -Xprint-types
1+
//> using options -Ytest-pickler -Xprint-types
22

33
class B:
44
def g: String | Null = ???

tests/explicit-nulls/pos/match-pat.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// scalac: -Xfatal-warnings
1+
//> using options -Xfatal-warnings
22

33
// Ensure we don't get "the type test for argType cannot be checked at runtime" warning
44

tests/explicit-nulls/pos/unsafe-match-null-pat.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// scalac: -Xfatal-warnings
1+
//> using options -Xfatal-warnings
22

33
import scala.language.unsafeNulls
44

tests/neg-custom-args/wildcards.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// scalac: -source future -deprecation -Xfatal-warnings
1+
//> using options -source future -deprecation -Xfatal-warnings
22

33
object Test {
44
val xs: List[_] = List(1, 2, 3) // error

tests/neg-macros/i16355a.scala

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
//> using scala "3.2.1"
21
import scala.quoted.Expr
32
import scala.quoted.Type
43
import scala.quoted.quotes

tests/neg-macros/i9570.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// scalac: -Xfatal-warnings
1+
//> using options -Xfatal-warnings
22

33
import scala.quoted.*
44

tests/neg-macros/macro-deprecation.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// scalac: -Xfatal-warnings -deprecation
1+
//> using options -Xfatal-warnings -deprecation
22

33
import scala.quoted.*
44

0 commit comments

Comments
 (0)