-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Missing error messages #1589
Comments
This is an awesome way of empowering people to contribute to the project. I think I'll use this to contribute. Thanks a lot for writing this up @felixmulder! |
To avoid duplicated work: I'm taking on |
@markusthoemmes: yes! Done :) Added a clarification to the top :) |
👍 |
Indeed, this is an awesome way to get people to contribute to the project ... I'm tackling |
I'll take Desugar.scala and ErrorReporting.scala. |
@felixmulder: I created a PR for |
Hi, I'm new here. I'll take Parsers.scala:1737, Parsers.scala:1738, Parsers.scala:1739, Parsers.scala:1901 |
Taking |
Was just sitting down with @ShaneDelmore and looking at these a little bit. Looks like quite a few Parsers and TypeAssigner messages left, if there are one or two 'easier' messages in there that I can take a look at, would someone mind assigning those to me? Andrew |
Hi, Working on |
@AndrewZurn - how about |
@felixmulder can you mark Parsers:626 and Parsers:1492 as complete :-) ? |
@sebastianharko - yes done! Thanks |
Hi, also new over here, just trying to help this lovely project... I will work for now on |
@thiagoandrade6 - sounds great :) |
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]
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]
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]
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]
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]
…` error. It is part of the scala#1589
|
Working on |
Part of the effort documented in scala#1589 to port all error messages to the new scheme.
|
Part of the effort documented in scala#1589 to port all error messages to the new scheme.
Hi! |
Starting from the top I did Checking.scala: |
The architecture for errors described in this issue proved to be heavy and impractical. The migration process frequently interferes with in-flight PRs and the benefits are marginal. We should find a more light-weight way to represent errors. |
The issue was closed scala#1589
We have a multitude of errors that need to be ported to the new scheme - you'll find these under "Error Messages" below. But first, a tutorial:
HOWTO on creating new messages
Once you've identified an error you want to replace, you should decide what semantic information is needed in the message - i.e. the position, perhaps a tree or some types. For this example we're going to be implementing the error message for the following error:
So we create a file with this and compile it using
./bin/dotc test.scala
. This gives us the error message:So now we search the repository for "case class needs to have" - I do this with
git grep -n "case class needs to have"
.And now we find that in
src/dotty/tools/dotc/ast/Desugar.scala
we have the following line:ctx.error("case class needs to have at least one parameter list", cdef.pos)
Cool - now we know what to replace. So next step is to add a
case class
tosrc/dotty/tools/dotc/reporting/diagnostic/messages.scala
. The case class that we add should extendMessage
:Now we name our case class something useful and give it a unique
errorId
:Since we can see that the call to
ctx.error
took the position of acdef: TypeDef
, we could perhaps use this in the constructor of ourMessage
?It might also be that we're going to be manipulating
cdef
tree, as such we should pass aContext
to get all the implicit operations:Alright! Now we can start adding things to our
Messsage
:Stable Identifier
So far, we've simplified the above cases a smidge, the error messages themselves actually don't extend
Message
by passing an integer. They should actually create an entry into the java enum defined in ErrorMessageID.java. This will enable us to have stable identifiers which helps tooling between the different compilers.Now you replace the call to
ctx.error(String)
withctx.error(CaseClassMissingParamList(cdef))
- and you're done with the implementation!Tests
To test your solution, add a test to ErrorMessagesTests.scala. An example for
TypeMismatch
is provided and documented.Online documentation
We really want to have online documentation providing more detailed information on what went wrong. Currently the idea is to create markdown pages in the
docs/docs
folder. Any contribution here would be greatly appreciated!Things to keep in mind
Types
,Position
,Tree
val explanation = ""
Missing Messages
Please comment below saying which messages you'd like to tackle.
Available
Contributors
The text was updated successfully, but these errors were encountered: