Skip to content

Commit 7349e76

Browse files
committed
repl: Ignore spurious arguments in :settings
1 parent cfa358b commit 7349e76

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

compiler/src/dotty/tools/repl/ReplDriver.scala

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import dotty.tools.dotc.ast.{tpd, untpd}
88
import dotty.tools.dotc.config.CommandLineParser.tokenize
99
import dotty.tools.dotc.config.Properties.{javaVersion, javaVmName, simpleVersionString}
1010
import dotty.tools.dotc.core.Contexts._
11+
import dotty.tools.dotc.core.Decorators._
1112
import dotty.tools.dotc.core.Phases.{unfusedPhases, typerPhase}
1213
import dotty.tools.dotc.core.Denotations.Denotation
1314
import dotty.tools.dotc.core.Flags._
@@ -424,8 +425,11 @@ class ReplDriver(settings: Array[String],
424425
case _ =>
425426
setup(tokenize(arg).toArray, rootCtx) match
426427
case Some((files, ictx)) =>
427-
ictx.base.initialize()(using ictx)
428-
rootCtx = ictx
428+
inContext(ictx) {
429+
if files.nonEmpty then out.println(i"Ignoring spurious arguments: $files%, %")
430+
ictx.base.initialize()(using ictx)
431+
rootCtx = ictx
432+
}
429433
case _ =>
430434
state.copy(context = rootCtx)
431435

compiler/test-resources/repl/settings-command

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@ scala> def f(thread: Thread) = thread.stop()
22
there were 1 deprecation warning(s); re-run with -deprecation for details
33
def f(thread: Thread): Unit
44

5-
scala>:settings -deprecation
5+
scala>:settings -deprecation foo.scala
6+
Ignoring spurious arguments: foo.scala
67

78
scala> def f(thread: Thread) = thread.stop()
89
1 warning found

0 commit comments

Comments
 (0)