Skip to content

Commit 52a60db

Browse files
Thiago PereiraThiago Pereira
Thiago Pereira
authored and
Thiago Pereira
committed
Add error message - Comments.scala:128
This commit adds the semantic object for the ```definition not found``` error. It is part of the (https://github.com/lampepfl/dotty/issues/1589)[https://github.com/lampepfl/dotty/issues/1589]
1 parent cdb83f9 commit 52a60db

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

src/dotty/tools/dotc/core/Comments.scala

+7-3
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,12 @@ package dotty.tools
22
package dotc
33
package core
44

5-
import ast.{ untpd, tpd }
6-
import Decorators._, Symbols._, Contexts._, Flags.EmptyFlags
5+
import ast.{tpd, untpd}
6+
import Decorators._
7+
import Symbols._
8+
import Contexts._
9+
import Flags.EmptyFlags
10+
import dotty.tools.dotc.reporting.diagnostic.messages.ProperDefinitionNotFound
711
import util.SourceFile
812
import util.Positions._
913
import util.CommentParsing._
@@ -125,7 +129,7 @@ object Comments {
125129
val newName = (tree.name.show + "$" + codePos + "$doc").toTermName
126130
untpd.DefDef(newName, tree.tparams, tree.vparamss, tree.tpt, tree.rhs)
127131
case _ =>
128-
ctx.error("proper definition was not found in `@usecase`", codePos)
132+
ctx.error(ProperDefinitionNotFound(), codePos)
129133
tree
130134
}
131135
}

src/dotty/tools/dotc/reporting/diagnostic/messages.scala

+6
Original file line numberDiff line numberDiff line change
@@ -500,4 +500,10 @@ object messages {
500500
|which cannot start with ${Red(illegalToken)}.""".stripMargin
501501
}
502502
}
503+
504+
case class ProperDefinitionNotFound()(implicit ctx: Context) extends Message(18) {
505+
val kind = "Definition Not Found"
506+
val msg = hl"""|A proper definition was not found in ${"@usecase"}"""
507+
val explanation = ""
508+
}
503509
}

0 commit comments

Comments
 (0)