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

Friendly typo checker relies on selections #12023

Open
som-snytt opened this issue May 31, 2020 · 1 comment
Open

Friendly typo checker relies on selections #12023

som-snytt opened this issue May 31, 2020 · 1 comment
Labels
backport enhancement errors and warnings fixed in Scala 3 This issue does not exist in the Scala 3 compiler (https://github.com/lampepfl/dotty/)
Milestone

Comments

@som-snytt
Copy link

reproduction steps

scala 2.13.2> val hello = "hi there" ; hellx
                                       ^
              error: not found: value hellx

scala 2.13.2> val hello = "hi there" ; this.hellx
                                            ^
              error: value hellx is not a member of $iw
              did you mean hello?

problem

It would be nice to typo check against scope, including locals.

@SethTisue SethTisue added this to the Backlog milestone Jun 1, 2020
@som-snytt som-snytt added backport fixed in Scala 3 This issue does not exist in the Scala 3 compiler (https://github.com/lampepfl/dotty/) labels Oct 25, 2023
@som-snytt
Copy link
Author

-- [E008] Not Found Error: test/files/neg/suggest-similar.scala:16:25 --------------------------------------------------
16 |  import scala.io.StdIn.{readline, readInt}
   |                         ^^^^^^^^
   |value readline is not a member of object scala.io.StdIn - did you mean StdIn.readLine? or perhaps StdIn.readLine?

// compare

suggest-similar.scala:16: error: value readline is not a member of object scala.io.StdIn
did you mean readLine? or perhaps readByte, readInt, or readLong?
  import scala.io.StdIn.{readline, readInt}
         ^

// but dotty is probably trimming the suggestions by length; maybe scala 2 admits too much;
// and scala 2 should not suggest `readInt`, which is already in the clause

Noticed at scala/scala3#18762

Dotty is more nuanced in comparing edit distance to lengths of candidates.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport enhancement errors and warnings fixed in Scala 3 This issue does not exist in the Scala 3 compiler (https://github.com/lampepfl/dotty/)
Projects
None yet
Development

No branches or pull requests

2 participants