Aladdin - Scala Bugtracking
[#515] project: compiler priority: low category: bug
submitter assigned to status date submitted
Gilles Martin fixed 2006-01-17 11:30:08.0
subject "()" not auto-applied to function in error message
code
object Test extends Application {
  class Truc {
    def getMachin() = "machin"
    def getMachinAsTruc() = this
  }
  val file = new Truc
  val parent: Truc = file.getMachin
}
what happened
error: missing arguments for method getMachin
  val parent: Truc = file.getMachin
                         ^

And when modifying the code as such:

val parent: Truc = file.getMachin()

The error becomes:

error: type mismatch;
 found   : java.lang.String
 required: Test.this.Truc
  val parent: Truc = file.getMachin()
                                   ^

While:

val parent: Truc = file.getMachinAsTruc

Compiles with no error (as expected).

what expected

The same error in both cases. Since the empty parameter is automatically added in the correct case, treating .foo() and .foo as identical, it is quite counterintuitive to have different error messages merely because it is an incorrect method.

This issue might be related or a duplicate of issue #514.

[back to overview]
Changes of this bug report
Martin  edited on  2006-01-20 18:52:44.0
Actually, the conversion is only applied when the