Skip to content

Commit 7c90f48

Browse files
committed
Merge pull request #1302 from dotty-staging/fix/partest-cli-error
Properly report errors when cli flags are malformed
2 parents 04b0e85 + 35abf29 commit 7c90f48

File tree

3 files changed

+6
-1
lines changed

3 files changed

+6
-1
lines changed

src/dotty/tools/dotc/Driver.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ abstract class Driver extends DotClass {
3131
ctx.error(ex.getMessage) // signals that we should fail compilation.
3232
ctx.reporter
3333
}
34-
else emptyReporter
34+
else ctx.reporter
3535

3636
protected def initCtx = (new ContextBase).initialCtx
3737

test/dotc/tests.scala

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,9 @@ class tests extends CompilerTest {
119119
@Test def neg_typedIdents() = compileDir(negDir, "typedIdents")
120120

121121
val negCustomArgs = negDir + "customArgs/"
122+
123+
@Test def neg_cli_error = compileFile(negCustomArgs, "cliError", List("-thisOptionDoesNotExist"))
124+
122125
@Test def neg_typers() = compileFile(negCustomArgs, "typers")(allowDoubleBindings)
123126
@Test def neg_overrideClass = compileFile(negCustomArgs, "overrideClass", scala2mode)
124127
@Test def neg_autoTupling = compileFile(negCustomArgs, "autoTuplingTest", args = "-language:noAutoTupling" :: Nil)

tests/neg/customArgs/cliError.scala

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
// nopos-error
2+
object Test

0 commit comments

Comments
 (0)