diff options
author | Som Snytt <som.snytt@gmail.com> | 2016-12-07 00:35:02 -0800 |
---|---|---|
committer | Som Snytt <som.snytt@gmail.com> | 2016-12-14 12:34:00 -0800 |
commit | 9df6d16f9b303caa98feb2ccd179352bd646c101 (patch) | |
tree | 09aa2a9be66e7ef89c09956303507293d67711c9 /spec | |
parent | b91b415b4fccfc46520dcd3f128b4b09d19d74f0 (diff) | |
download | scala-9df6d16f9b303caa98feb2ccd179352bd646c101.tar.gz scala-9df6d16f9b303caa98feb2ccd179352bd646c101.tar.bz2 scala-9df6d16f9b303caa98feb2ccd179352bd646c101.zip |
SI-10097 Error if no non-implicit case class param
Case class must have a non-implicit param list.
Error early, error often.
Also update spec to say that class implicitly gets
a non-implicit parameter section if it doesn't
have one, and that a case class must have one.
Diffstat (limited to 'spec')
-rw-r--r-- | spec/05-classes-and-objects.md | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/spec/05-classes-and-objects.md b/spec/05-classes-and-objects.md index 75620f57d4..6738c7a5b7 100644 --- a/spec/05-classes-and-objects.md +++ b/spec/05-classes-and-objects.md @@ -709,7 +709,7 @@ Here, value parameter may not form part of the types of any of the parent classes or members of the class template $t$. It is illegal to define two formal value parameters with the same name. - If no formal parameter sections are given, an empty parameter section `()` is assumed. + If a class has no formal parameter section that is not implicit, an empty parameter section `()` is assumed. If a formal parameter declaration $x: T$ is preceded by a `val` or `var` keyword, an accessor (getter) [definition](04-basic-declarations-and-definitions.html#variable-declarations-and-definitions) @@ -842,12 +842,13 @@ TmplDef ::= ‘case’ ‘class’ ClassDef If a class definition is prefixed with `case`, the class is said to be a _case class_. -The formal parameters in the first parameter section of a case class -are called _elements_; they are treated -specially. First, the value of such a parameter can be extracted as a +A case class is required to have a parameter section that is not implicit. +The formal parameters in the first parameter section +are called _elements_ and are treated specially. +First, the value of such a parameter can be extracted as a field of a constructor pattern. Second, a `val` prefix is -implicitly added to such a parameter, unless the parameter carries -already a `val` or `var` modifier. Hence, an accessor +implicitly added to such a parameter, unless the parameter already carries +a `val` or `var` modifier. Hence, an accessor definition for the parameter is [generated](#class-definitions). A case class definition of `$c$[$\mathit{tps}\,$]($\mathit{ps}_1\,$)$\ldots$($\mathit{ps}_n$)` with type |