Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add warning for :kind command #22572

Merged
merged 1 commit into from
Feb 11, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.""")
aherlihy marked this conversation as resolved.
Show resolved Hide resolved
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.
aherlihy marked this conversation as resolved.
Show resolved Hide resolved
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
Loading