File tree Expand file tree Collapse file tree 2 files changed +19
-2
lines changed Expand file tree Collapse file tree 2 files changed +19
-2
lines changed Original file line number Diff line number Diff line change @@ -1742,8 +1742,8 @@ object Parsers {
1742
1742
if (owner == nme.CONSTRUCTOR && (result.isEmpty || (result.head take 1 exists (_.mods is Implicit )))) {
1743
1743
in.token match {
1744
1744
case LBRACKET => syntaxError(" no type parameters allowed here" )
1745
- case EOF => incompleteInputError(" auxiliary constructor needs non-implicit parameter list " )
1746
- case _ => syntaxError(" auxiliary constructor needs non-implicit parameter list " , start)
1745
+ case EOF => incompleteInputError(AuxConstructorNeedsNonImplicitParameter () )
1746
+ case _ => syntaxError(AuxConstructorNeedsNonImplicitParameter () , start)
1747
1747
}
1748
1748
}
1749
1749
result
Original file line number Diff line number Diff line change @@ -715,4 +715,21 @@ object messages {
715
715
| """ .stripMargin
716
716
}
717
717
}
718
+
719
+ case class AuxConstructorNeedsNonImplicitParameter ()(implicit ctx: Context ) extends Message (26 ) {
720
+ val kind = " Syntax"
721
+ val msg = " auxiliary constructor needs non-implicit parameter list"
722
+ val explanation =
723
+ hl """ Only the primary constructor is allowed an ${" implicit" } parameter list;
724
+ |auxiliary constructors need a non-implicit parameter list. When a primary
725
+ |constructor has an implicit argslist, auxiliary constructors that call the
726
+ |primary constructor must specify the implicit value.
727
+ |
728
+ |To resolve this issue check for:
729
+ | - forgotten parenthesis on ${" this" } ( ${" def this() = // ..." })
730
+ | - auxiliary constructors specify the implicit value
731
+ | """ .stripMargin
732
+ }
733
+
734
+
718
735
}
You can’t perform that action at this time.
0 commit comments