diff options
author | Felix Mulder <felix.mulder@gmail.com> | 2016-10-31 15:50:44 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-10-31 15:50:44 +0100 |
commit | 01ae7ddfd4956660ed4897f5d2773587f845204c (patch) | |
tree | bf5166aa6d68073de7ad9e80326a3c24dc703c94 /src/dotty/tools/dotc | |
parent | b4f0c6e7856d1dff7139b9500b6a990f181b5f2d (diff) | |
parent | 7c473613266526eb51c3bd7b2003bb281a1f5343 (diff) | |
download | dotty-01ae7ddfd4956660ed4897f5d2773587f845204c.tar.gz dotty-01ae7ddfd4956660ed4897f5d2773587f845204c.tar.bz2 dotty-01ae7ddfd4956660ed4897f5d2773587f845204c.zip |
Merge pull request #1629 from ljdelight/errorMessages
Update error msg for Parsers.scala:1738 and 1739
Diffstat (limited to 'src/dotty/tools/dotc')
-rw-r--r-- | src/dotty/tools/dotc/parsing/Parsers.scala | 4 | ||||
-rw-r--r-- | src/dotty/tools/dotc/reporting/diagnostic/messages.scala | 17 |
2 files changed, 19 insertions, 2 deletions
diff --git a/src/dotty/tools/dotc/parsing/Parsers.scala b/src/dotty/tools/dotc/parsing/Parsers.scala index 4926ebb9f..95626846d 100644 --- a/src/dotty/tools/dotc/parsing/Parsers.scala +++ b/src/dotty/tools/dotc/parsing/Parsers.scala @@ -1742,8 +1742,8 @@ object Parsers { if (owner == nme.CONSTRUCTOR && (result.isEmpty || (result.head take 1 exists (_.mods is Implicit)))) { in.token match { case LBRACKET => syntaxError("no type parameters allowed here") - case EOF => incompleteInputError("auxiliary constructor needs non-implicit parameter list") - case _ => syntaxError("auxiliary constructor needs non-implicit parameter list", start) + case EOF => incompleteInputError(AuxConstructorNeedsNonImplicitParameter()) + case _ => syntaxError(AuxConstructorNeedsNonImplicitParameter(), start) } } result diff --git a/src/dotty/tools/dotc/reporting/diagnostic/messages.scala b/src/dotty/tools/dotc/reporting/diagnostic/messages.scala index bec49e728..02aa850c5 100644 --- a/src/dotty/tools/dotc/reporting/diagnostic/messages.scala +++ b/src/dotty/tools/dotc/reporting/diagnostic/messages.scala @@ -715,4 +715,21 @@ object messages { |""".stripMargin } } + + case class AuxConstructorNeedsNonImplicitParameter()(implicit ctx:Context) extends Message(26) { + val kind = "Syntax" + val msg = "auxiliary constructor needs non-implicit parameter list" + val explanation = + hl"""Only the primary constructor is allowed an ${"implicit"} parameter list; + |auxiliary constructors need a non-implicit parameter list. When a primary + |constructor has an implicit argslist, auxiliary constructors that call the + |primary constructor must specify the implicit value. + | + |To resolve this issue check for: + | - forgotten parenthesis on ${"this"} (${"def this() = // ..."}) + | - auxiliary constructors specify the implicit value + |""".stripMargin + } + + } |