Skip to content

Commit a5f1dae

Browse files
authored
Merge pull request #8279 from michelou/dotty-t8124
Fix issue #8124
2 parents c14eadc + 65167ba commit a5f1dae

File tree

3 files changed

+30
-1
lines changed

3 files changed

+30
-1
lines changed

compiler/src/dotty/tools/dotc/config/Settings.scala

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,8 @@ object Settings {
150150
update(output, args)
151151
}
152152
case (StringTag, arg2 :: args2) =>
153-
update(arg2, args2)
153+
if (arg2 startsWith "-") missingArg
154+
else update(arg2, args2)
154155
case (IntTag, arg2 :: args2) =>
155156
try {
156157
val x = arg2.toInt

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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,14 @@ class SettingsTests {
2828
assertEquals(0, reporter.errorCount)
2929
assertTrue(Files.exists(out))
3030
}
31+
32+
@Test def t8124: Unit = {
33+
val source = Paths.get("tests/pos/Foo.scala").normalize
34+
val outputDir = Paths.get("out/testSettings").normalize
35+
if (Files.notExists(outputDir)) Files.createDirectory(outputDir)
36+
val options = Array("-encoding", "-d", outputDir.toString, source.toString)
37+
val reporter = Main.process(options)
38+
assertEquals(1, reporter.errorCount)
39+
}
40+
3141
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
package dotty.tools
2+
package dottydoc
3+
4+
import org.junit.Test
5+
import org.junit.Assert._
6+
7+
class SettingsTests {
8+
9+
@Test def t8124: Unit = {
10+
val source = "tests/pos/Foo.scala"
11+
val url = "https://github.com/lampepfl/dotty/tree/master/tests"
12+
val options = Array("-project", "-project-url", url, source)
13+
val reporter = Main.process(options)
14+
assertEquals(2, reporter.errorCount)
15+
assertEquals("missing argument for option -project", reporter.allErrors.last.message)
16+
}
17+
18+
}

0 commit comments

Comments
 (0)