Open scabug opened 13 years ago
Imported From: https://issues.scala-lang.org/browse/SI-4713?orig=1 Reporter: @dragos Affected Versions: 2.9.0 See #6613
Commit Message Bot (anonymous) said: (odersky in r25128) Putting in a fix for #4713. Not sure this goes deep enough, though. Review and maybe deeper changes by plocinic.
@odersky said: r25128 contains a fix, but it might be just papering over. The problem is that a companion object Book comes back as NoSymbol after adaptation. The patch returns the type unchanged, but we should dig why adaptation failed. You can reproduce it by running the test pending/run/t4713 with -Ydebug. That shows you where the adaptation failure occurs.
@dragos said (edited on Nov 1, 2011 11:04:47 AM UTC): More info: If it is in a jar on the build path, but to work fully it requires the destination type to be known.
i.e. if I do
val book : java.util.List[String] = JavaAnnots.Book
it is ok
but if I do
val book = JavaAnnots.Book
I get the following error:
Multiple markers at this line
- ambiguous reference to overloaded definition, both value Book in object JavaAnnots of type java.util.List[java.lang.String] and object Book in object JavaAnnots of type
object com.foo.JavaAnnots.Book match expected type ?
- ambiguous reference to overloaded definition, both value Book in object JavaAnnots of type java.util.List[java.lang.String] and object Book in object JavaAnnots of type
object com.foo.JavaAnnots.Book match expected type ?
If JavaAnnots.java is in same project as the scala code ‘val book = JavaAnnots.Book’ works fine.
@adriaanm said: François, could you perhaps have a look?
@retronym said: Seems related to: #6613
The presentation compiler crashes in the type checker on the second run.
First compile the following Java file:
Then fire up the interactive repl ('scala scala.tools.nsc.interactive.REPL') and pass the following file twice:
Here's what happens: