Skip to content

Commit

Permalink
Add warning for :kind command
Browse files Browse the repository at this point in the history
  • Loading branch information
aherlihy committed Feb 11, 2025
1 parent 7ac31d0 commit e399364
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 0 deletions.
8 changes: 8 additions & 0 deletions compiler/src/dotty/tools/repl/ParseResult.scala
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,13 @@ object Load {
val command: String = ":load"
}

/** `:kind <type>` display the kind of a type. see also :help kind
*/
case class KindOf(expr: String) extends Command
object KindOf {
val command: String = ":kind"
}

/** To find out the type of an expression you may simply do:
*
* ```
Expand Down Expand Up @@ -138,6 +145,7 @@ object ParseResult {
Help.command -> (_ => Help),
Reset.command -> (arg => Reset(arg)),
Imports.command -> (_ => Imports),
KindOf.command -> (arg => KindOf(arg)),
Load.command -> (arg => Load(arg)),
TypeOf.command -> (arg => TypeOf(arg)),
DocOf.command -> (arg => DocOf(arg)),
Expand Down
4 changes: 4 additions & 0 deletions compiler/src/dotty/tools/repl/ReplDriver.scala
Original file line number Diff line number Diff line change
Expand Up @@ -510,6 +510,10 @@ class ReplDriver(settings: Array[String],
state
}

case KindOf(expr) =>
out.println(s"""The :kind command is not currently supported.""")
state

case TypeOf(expr) =>
expr match {
case "" => out.println(s":type <expression>")
Expand Down
2 changes: 2 additions & 0 deletions compiler/test-resources/repl/i21655
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
scala>:kind
The :kind command is not currently supported.
1 change: 1 addition & 0 deletions compiler/test/dotty/tools/repl/TabcompleteTests.scala
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,7 @@ class TabcompleteTests extends ReplTest {
":exit",
":help",
":imports",
":kind",
":load",
":quit",
":reset",
Expand Down

0 comments on commit e399364

Please sign in to comment.