Skip to content

Commit 4ae474d

Browse files
authored
Add warning for :kind command (#22572)
After discussion with the core team, it was decided to postpone implementation of the `:kind` command for #21655. For now, emit a warning.
2 parents 2366bd9 + e399364 commit 4ae474d

File tree

4 files changed

+15
-0
lines changed

4 files changed

+15
-0
lines changed

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

+8
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

+4
Original file line numberDiff line numberDiff line change
@@ -510,6 +510,10 @@ class ReplDriver(settings: Array[String],
510510
state
511511
}
512512

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

compiler/test-resources/repl/i21655

+2
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

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

0 commit comments

Comments
 (0)