Aladdin - Scala Bugtracking
[#391] project: specification priority: high category: bug
submitter assigned to status date submitted
Philippe Martin fixed 2005-01-06 13:06:58.0
subject The parser incorrectly accepts def and val in parameters
code
trait C {
  def fun1(def x: Int): Int = x; // the "def x" is illegal
  def fun2(val x: Int): Int = x; // the "val x" is illegal
}

class E(def x: Int); // the "def x" is illegal
what happened
No error
what expected The two def x and the val x should be rejected. The notation def x: Int has been replaced by x: => Int. The notation val x: Int is legal only as a class parameter.
[back to overview]
Changes of this bug report
Burak  edited on  2005-02-02 12:39:04.0

I see what you mean and have a fix, but these issues are deviating significantly from the spec.

I think we should fix the spec before I check-in the implementation. This is why I change "project" to specification and reassign to Martin.

The relevant productions are ParamClause, Param and maybe Type.

Do we permit the notation x : => Foo also in other places than definitions? Are these major asymmetries intended.

Martin  edited on  2006-05-08 10:39:19.0