Skip to content

Commit 5a9f3e2

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 5a9f3e2

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

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

+2-1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import util.Positions._
99
import util.CommentParsing._
1010
import util.Property.Key
1111
import parsing.Parsers.Parser
12+
import reporting.diagnostic.messages.ProperDefinitionNotFound
1213

1314
object Comments {
1415
val ContextDoc = new Key[ContextDocstrings]
@@ -125,7 +126,7 @@ object Comments {
125126
val newName = (tree.name.show + "$" + codePos + "$doc").toTermName
126127
untpd.DefDef(newName, tree.tparams, tree.vparamss, tree.tpt, tree.rhs)
127128
case _ =>
128-
ctx.error("proper definition was not found in `@usecase`", codePos)
129+
ctx.error(ProperDefinitionNotFound(), codePos)
129130
tree
130131
}
131132
}

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

+9
Original file line numberDiff line numberDiff line change
@@ -500,4 +500,13 @@ 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"""|Proper definition was not found in ${"@usecase"}"""
507+
val explanation = {
508+
hl"""|You should use ${"def"} when overriding the method signature on ${"@usecase"}"""
509+
}
510+
}
511+
503512
}

0 commit comments

Comments
 (0)