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
Scala 2.10-RC2 possible regression #6697
Comments
Imported From: https://issues.scala-lang.org/browse/SI-6697?orig=1
|
@oxbowlakes said (edited on Nov 21, 2012 11:06:36 AM UTC): // a.b.c.d.Functions.scala
package a.b //if these 3 package declarations are replaced by a.b.c.d it compiles OK
package c
package d
trait Functions {
import Conversions._ //omit this line and it compiles OK
val toStrLen = (_ : String).strlen
} The above will also fail to compile with the error
|
@retronym said: % squalac -Xlog-implicits *.scala
Functions.scala:8: <str2todstring: error> is not a valid implicit value for String => ?{def strlen: ?} because:
reference to str2todstring is ambiguous;
it is both defined in trait Conversions and imported subsequently by
import Conversions._
val toStrLen = (_ : String).strlen
^
Functions.scala:8: error: value strlen is not a member of String
val toStrLen = (_ : String).strlen
^
one error found
% squalac -Xlog-implicits *.scala
Functions.scala:8: error: reference to str2todstring is ambiguous;
it is both defined in trait Conversions and imported subsequently by
import Conversions._
val toStrLen = str2todstring((_ : String)).strlen
^
one error found Before the fix for #4270, this code was accepted. |
@retronym said: IntelliJ doesn't do very well with multi-line compiler error messages; I think the in-progress work to integrate directly with the SBT builder might help out. But for bug reports here, its best if you reproduce them using the command line scalac. |
Apologies if this is not a regression, or is intended.
I just tried to recompile one of our basic libs with 2.10-RC2 and hit a bizarre error. It seems to require a perfect storm of things to be the case (i.e. change package nestings, or exact classes and it disappears). The symptom of the problem is that compilation fails with the compiler reporting that some method does not exist. The method is added by implicit conversion and should be there. What is especially odd is that the compilation error disappears depending on the type of that which is to implicitly converted into.
The following is my attempt at a minimal example. Steps to reproduce
a.b.c
create 3 files.scalac 2.10.0-RC2
and a 1.6 JDK. You will get the compile error ina/b/c/d/Functions.scala
:import language.implicitConversions
line froma.b.c.d.Conversions.scala
and recompile with 2.9.2. It compiles just finePlease find attached the regression example in a ZIP file
regression-minimal.zip
.Please use the files exactly as specified. The issue goes away if, for example, you change the package declarations in the files, or omit unnecessary imports.
The text was updated successfully, but these errors were encountered: