Aladdin - Scala Bugtracking
[#256] project: compiler priority: low category: bug
submitter assigned to status date submitted
Michel Martin fixed 2003-12-09 15:20:39.0
subject No eta-expansion performed in special cases
code
object Main {
  def f(x: Int): Int = 0;
  def v: Unit = f;
  def main(args: Array[String]): Unit = ();
}
what happened
The eta-expansion on f is not performed. Here is the tree after analysis:
// Scala source: bug_twounit.scala
final object Main extends scala.Object() {
  final def f(x: scala.Int): scala.Int = 0;
  final def v: scala.Unit = {
    Main.f;
    {
      
    }
  };
  final def main(args: scala.Array[scala.String]): scala.Unit = {
    
  }
};
This is wrong, as f appears unapplied in the RHS of v. This happens here only because \ we force the type of v to be Unit. If we omit the type in the definition of v, it works.
what expected A correct expansion. Or maybe a warning/error, as Buraq suggested once.
[back to overview]
Changes of this bug report
Martin  edited on  2004-01-05 17:09:47.0