Skip to content

Commit 6d12c19

Browse files
authored
Merge pull request #242 from scala/backport-lts-3.3-22572
Backport "Add warning for :kind command" to 3.3 LTS
2 parents 6c0c384 + 912fd2b commit 6d12c19

File tree

4 files changed

+15
-0
lines changed

4 files changed

+15
-0
lines changed

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,13 @@ object Load {
5252
val command: String = ":load"
5353
}
5454

55+
/** `:kind <type>` display the kind of a type. see also :help kind
56+
*/
57+
case class KindOf(expr: String) extends Command
58+
object KindOf {
59+
val command: String = ":kind"
60+
}
61+
5562
/** To find out the type of an expression you may simply do:
5663
*
5764
* ```
@@ -138,6 +145,7 @@ object ParseResult {
138145
Help.command -> (_ => Help),
139146
Reset.command -> (arg => Reset(arg)),
140147
Imports.command -> (_ => Imports),
148+
KindOf.command -> (arg => KindOf(arg)),
141149
Load.command -> (arg => Load(arg)),
142150
TypeOf.command -> (arg => TypeOf(arg)),
143151
DocOf.command -> (arg => DocOf(arg)),

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -511,6 +511,10 @@ class ReplDriver(settings: Array[String],
511511
state
512512
}
513513

514+
case KindOf(expr) =>
515+
out.println(s"""The :kind command is not currently supported.""")
516+
state
517+
514518
case TypeOf(expr) =>
515519
expr match {
516520
case "" => out.println(s":type <expression>")

compiler/test-resources/repl/i21655

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
scala>:kind
2+
The :kind command is not currently supported.

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,7 @@ class TabcompleteTests extends ReplTest {
216216
":exit",
217217
":help",
218218
":imports",
219+
":kind",
219220
":load",
220221
":quit",
221222
":reset",

0 commit comments

Comments
 (0)