-
-
Notifications
You must be signed in to change notification settings - Fork 40
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
Java-like annotations in comments #503
Conversation
@shonfeder the formatting check fails on a markdown file. What shall we do? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I left some comments, but I'm hoping the size of this PR will be very reduced once the formatting is fixed (as per the failing CI job) so I'll hold of on reviewing more until then.
docs/src/adr/004adr-annotations.md
Outdated
A more concise syntax for type annotations could be as follows: | ||
|
||
```tla | ||
\* @type: Int => Int |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would we have the same problem with @type(Int => Int)
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, the types may contain parentheses, that will confuse the annotation parser a lot. These are two separate parsers: one of java-like annotations, and one for types.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The problem is that we don't have an end marker, which is usually \n
. How about adding the infamous semicolon in the end of a quote-free annotation:
\* @type: (Int, Int) => Int ;
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have added this special form to the annotations. It definitely has less clutter when writing type annotations.
@konnov did you already try |
interesting. I forgot to do it. Can we add it to a PR template. |
There are plenty of small replacements in files, basically adding one more parameter |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
tla-bmcmt/src/main/scala/at/forsyte/apalache/tla/bmcmt/config/CheckerModule.scala
Outdated
Show resolved
Hide resolved
tla-import/src/test/scala/at/forsyte/apalache/tla/imp/TestSanyImporter.scala
Show resolved
Hide resolved
I have resolved the conflicts. The last commit is massive, as it merges the formatting reversal from unstable |
…to igor/annotations262-step2
This PR addresses two related issues: #262 and #226. Instead of developing a special solution for type annotations, we produce a simple and general syntax of annotations, like in Java. To make use of the annotations, this PR also extends
SanyImporter
to parse annotations in the comments that are written in front of declarations. The annotation syntax and examples are given in ADR004 (this PR).On top of that,
TestAnnotationParser
is the first property-based test in Apalache :-)