Skip to content

Commit 4649d5e

Browse files
committed
Rename :require to :jar and deprecate :require
1 parent 9a60679 commit 4649d5e

File tree

8 files changed

+16
-56
lines changed

8 files changed

+16
-56
lines changed

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

+9-1
Original file line numberDiff line numberDiff line change
@@ -52,13 +52,20 @@ object Load {
5252
val command: String = ":load"
5353
}
5454

55-
/** `:require <path>` adds a jar to the classpath
55+
/** `:require` is a deprecated alias for :jar`
5656
*/
5757
case class Require(path: String) extends Command
5858
object Require {
5959
val command: String = ":require"
6060
}
6161

62+
/** `:jar <path>` adds a jar to the classpath
63+
*/
64+
case class JarCmd(path: String) extends Command
65+
object JarCmd {
66+
val command: String = ":jar"
67+
}
68+
6269
/** `:kind <type>` display the kind of a type. see also :help kind
6370
*/
6471
case class KindOf(expr: String) extends Command
@@ -152,6 +159,7 @@ object ParseResult {
152159
Help.command -> (_ => Help),
153160
Reset.command -> (arg => Reset(arg)),
154161
Imports.command -> (_ => Imports),
162+
JarCmd.command -> (arg => JarCmd(arg)),
155163
KindOf.command -> (arg => KindOf(arg)),
156164
Load.command -> (arg => Load(arg)),
157165
Require.command -> (arg => Require(arg)),

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

+4
Original file line numberDiff line numberDiff line change
@@ -515,6 +515,10 @@ class ReplDriver(settings: Array[String],
515515
}
516516

517517
case Require(path) =>
518+
out.println(":require has been deprecated and replaced with :jar. Please use :jar")
519+
state
520+
521+
case JarCmd(path) =>
518522
val jarFile = AbstractFile.getDirectory(path)
519523
if (jarFile == null)
520524
out.println(s"""Cannot add "$path" to classpath.""")

compiler/test-resources/jars/MyLibrary.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* JAR used for testing repl :require
2+
* JAR used for testing repl :jar
33
* Generated using: mkdir out; scalac -d out MyLibrary.scala; jar cf mylibrary.jar -C out .
44
*/
55
package mylibrary

compiler/test-resources/jars/MyLibrary2.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* JAR used for testing repl :require
2+
* JAR used for testing repl :jar
33
* Generated using: mkdir out2; scalac -d out MyLibrary2.scala; jar cf mylibrary2.jar -C out2 .
44
*/
55
package mylibrary2

compiler/test-resources/repl/require-command

-13
This file was deleted.

compiler/test-resources/repl/require-errors

-8
This file was deleted.

compiler/test-resources/repl/require-multiple

-32
This file was deleted.

compiler/test/dotty/tools/repl/TabcompleteTests.scala

+1
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,7 @@ class TabcompleteTests extends ReplTest {
213213
":exit",
214214
":help",
215215
":imports",
216+
":jar",
216217
":kind",
217218
":load",
218219
":quit",

0 commit comments

Comments
 (0)