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

Am I missing something? More error help. #10181

Closed
scabug opened this issue Feb 12, 2017 · 2 comments
Closed

Am I missing something? More error help. #10181

scabug opened this issue Feb 12, 2017 · 2 comments

Comments

@scabug
Copy link

scabug commented Feb 12, 2017

Errors could report near-misses:

import scala.io.StdIn.{readline, readInt}

http://stackoverflow.com/questions/42183644/scala-import-scala-io-stdin-readline-error-importing

And the deprecation message could emit the corrected line for easy cut/paste:

scala> readLine
<console>:12: warning: method readLine in trait DeprecatedPredef is deprecated (since 2.11.0): use the method in `scala.io.StdIn`
       readLine       // hint: scala.io.StdIn.readLine
       ^
res0: String = abc

scala> import scala.io.StdIn.{readline => line}
<console>:11: error: value readline is not a member of object scala.io.StdIn
       import scala.io.StdIn.{readline => line}    // hint: import scala.io.StdIn.{readLine => line}
              ^

scala> import scala.io.stdin.{readLine => line}
<console>:11: error: object stdin is not a member of package io
       import scala.io.stdin.{readLine => line}    // hint: import scala.io.StdIn.{readLine => line}
                       ^
@scabug
Copy link
Author

scabug commented Feb 12, 2017

Imported From: https://issues.scala-lang.org/browse/SI-10181?orig=1
Reporter: @som-snytt
Affected Versions: 2.12.1

@scabug scabug added this to the Backlog milestone Apr 7, 2017
eed3si9n added a commit to eed3si9n/scala that referenced this issue Jun 3, 2018
Fixes scala/bug#10181

With this change, NotAMemberError checks for possible members under target with edit distance of 2 or 1. To avoid false positives, `eq`, `ne`, `_1` etc are filtered out.

```scala
scala> import scala.io.StdIn.{readline, readInt}
              ^
       error: value readline is not a member of object scala.io.StdIn
       did you mean readLine?

scala> import scala.io.stdin.{readLine => line}
                       ^
       error: object stdin is not a member of package io
       did you mean StdIn?

scala> import scala.sth
              ^
       error: object sth is not a member of package scala
       did you mean sys or math?
```
@eed3si9n eed3si9n self-assigned this Jun 3, 2018
@eed3si9n
Copy link
Member

eed3si9n commented Jun 3, 2018

I have a PR - scala/scala#6711

eed3si9n added a commit to eed3si9n/scala that referenced this issue Jun 9, 2018
Fixes scala/bug#10181

With this change, NotAMemberError checks for possible members under target with edit distance of 2 or 1.

```scala
scala> import scala.io.StdIn.{readline, readInt}
              ^
       error: value readline is not a member of object scala.io.StdIn
       did you mean readLine?

scala> import scala.io.stdin.{readLine => line}
                       ^
       error: object stdin is not a member of package io
       did you mean StdIn?

scala> import scala.sth
              ^
       error: object sth is not a member of package scala
       did you mean sys or math?
```
eed3si9n added a commit to eed3si9n/scala that referenced this issue Jun 12, 2018
Fixes scala/bug#10181

With this change, NotAMemberError checks for possible members under target with edit distance of 2 or 1.

```scala
scala> import scala.io.StdIn.{readline, readInt}
              ^
       error: value readline is not a member of object scala.io.StdIn
       did you mean readLine?

scala> import scala.io.stdin.{readLine => line}
                       ^
       error: object stdin is not a member of package io
       did you mean StdIn?

scala> import scala.sth
              ^
       error: object sth is not a member of package scala
       did you mean sys or math?
```
lrytz pushed a commit to eed3si9n/scala that referenced this issue Nov 2, 2018
Fixes scala/bug#10181

With this change, NotAMemberError checks for possible members under target with edit distance of 2 or 1.

```scala
scala> import scala.io.StdIn.{readline, readInt}
              ^
       error: value readline is not a member of object scala.io.StdIn
       did you mean readLine?

scala> import scala.io.stdin.{readLine => line}
                       ^
       error: object stdin is not a member of package io
       did you mean StdIn?

scala> import scala.sth
              ^
       error: object sth is not a member of package scala
       did you mean sys or math?
```
lrytz pushed a commit to eed3si9n/scala that referenced this issue Nov 2, 2018
Fixes scala/bug#10181

With this change, NotAMemberError checks for possible members under target with edit distance of 2 or 1.

```scala
scala> import scala.io.StdIn.{readline, readInt}
              ^
       error: value readline is not a member of object scala.io.StdIn
       did you mean readLine?

scala> import scala.io.stdin.{readLine => line}
                       ^
       error: object stdin is not a member of package io
       did you mean StdIn?

scala> import scala.sth
              ^
       error: object sth is not a member of package scala
       did you mean sys or math?
```
@lrytz lrytz modified the milestones: Backlog, 2.13.0-RC1 Nov 2, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants