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

Incorrect ambiguous import error (probably a regression since M4) #6117

Closed
scabug opened this issue Jul 21, 2012 · 9 comments
Closed

Incorrect ambiguous import error (probably a regression since M4) #6117

scabug opened this issue Jul 21, 2012 · 9 comments
Assignees
Labels
Milestone

Comments

@scabug
Copy link

@scabug scabug commented Jul 21, 2012

package test

trait ImportMe {
  def foo(i: Int) = 1
  def foo(s: String) = 2
}

class Test(val importMe: ImportMe) {
  import importMe._
  import importMe._

  // A.scala:12: error: reference to foo is ambiguous;
  // it is imported twice in the same scope by
  // import importMe._
  // and import importMe._
  //   println(foo(1))
  //           ^
  println(foo(1))
}

Note: if there's only one def foo in ImportMe, there's no problem.

@scabug

This comment has been minimized.

Copy link
Author

@scabug scabug commented Jul 21, 2012

Imported From: https://issues.scala-lang.org/browse/SI-6117?orig=1
Reporter: @VladUreche
Affected Versions: 2.10.0-M5
See #4831

@scabug

This comment has been minimized.

Copy link
Author

@scabug scabug commented Jul 21, 2012

@xeno-by said:
This is an excerpt from the Ensime codebase, which compiles fine with 2.9.2 and 2.10.0-M4. We've raised the priority to "Critical" because it seems to be a regression.

@scabug

This comment has been minimized.

Copy link
Author

@scabug scabug commented Jul 21, 2012

@scabug

This comment has been minimized.

Copy link
Author

@scabug scabug commented Jul 21, 2012

@VladUreche said:
Thank you! :)

@scabug

This comment has been minimized.

Copy link
Author

@scabug scabug commented Jul 21, 2012

@paulp said:
"This is an excerpt from the Ensime codebase, which compiles fine with 2.9.2 and 2.10.0-M4."

Please be extremely careful with claims like this; when you are wrong, it is very misleading about where the problem was introduced.

% m4scalac /scala/trunk/test/files/pos/t6117.scala 
/scala/trunk/test/files/pos/t6117.scala:18: error: reference to foo is ambiguous;
it is imported twice in the same scope by
import importMe._
and import importMe._
  println(foo(1))
          ^
one error found
% m3scalac /scala/trunk/test/files/pos/t6117.scala 
%
@scabug

This comment has been minimized.

Copy link
Author

@scabug scabug commented Jul 21, 2012

@xeno-by said:
Sorry I misinterpreted the results. Ensime indeed compiled finely with 2.10.0-M4 and didn't compile with today's nightly. However I should've run M4 on the distilled snippet before jumping into the discussion.

@scabug

This comment has been minimized.

Copy link
Author

@scabug scabug commented Jul 21, 2012

@paulp said:
It's a completely understandable error, especially if ensime compiled and the snippet doesn't - I'm just drawing attention to it because the more reliable the speaker is in general, the longer it is before one questions the input data. It's not a fair universe if being reliable imposes a greater obligation to be reliable, but indeed it is not a fair universe.

@scabug

This comment has been minimized.

Copy link
Author

@scabug scabug commented Jul 21, 2012

@retronym said:
Regression introduced (by me) in the fix for #4831

@scabug

This comment has been minimized.

Copy link
Author

@scabug scabug commented Jul 24, 2012

@scabug scabug closed this Jul 24, 2012
@scabug scabug added this to the 2.10.0-M5 milestone Apr 7, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.