Aladdin - Scala Bugtracking
[#1241] project: compiler priority: medium category: bug
submitter assigned to status date submitted
Stephane Martin fixed 2007-07-24 13:49:20.0
subject structural type error
code
object test extends Application {
  // more..
  type T = { def hello() }
  //val x4 = new AnyRef { def hello() { println("4") } } // ok!
  val x4 = new T { def hello() { println("4") } }        // error!
  x4.hello()
  // more..
}
what happened
test.scala:16: error:  is not a legal prefix for a constructor
  val x4 = new T { def hello() { println("4") } }        // error!
               ^
one error found
what expected better error message or prints "4"
[back to overview]
Changes of this bug report
Martin  edited on  2007-07-25 16:35:59.0
You now get: bug1241.scala:5: error: AnyRef{def hello(): Unit} does not have a constructor val x4 = new T { def hello() { println("4") } } // error! ^
Stephane  edited on  2007-07-27 13:29:21.0