Inconsistency in placement of comments as returned by OpDefOrDeclNode.getComment
See original GitHub issueWe are now using OpDefOrDeclNode.getComment
to parse annotations in TLA+ declarations, see this PR. While it works well, we have noticed a few inconsistencies in the placement of comments. For instance, in the recursive definitions, a comment has to be placed between RECURSIVE ...
and the definition, whereas in the local definitions, a comment has to be placed in front of LOCAL
.
Below you can find an example of how annotations should be placed in front of declarations. It would be great, if SANY was using a more consistent scheme for getComment
.
-------- MODULE Annotations ----------
EXTENDS Integers
CONSTANT
\* @type: Int;
N
VARIABLE
\* @type: Set(Int);
set
\* @pure
\* @type: Int => Int;
Inc(n) == n + 1
\* @type: Int => Int;
LOCAL LocalInc(x) == x + 1
A(n) ==
LET \* @pure
\* @type: Int => Int;
Dec(x) == x + 1
IN
Dec(n)
RECURSIVE Fact(_)
\* @tailrec
\* @type: Int => Int;
Fact(n) ==
IF n <= 1 THEN 1 ELSE n * Fact(n - 1)
\* @tailrec
\* @type: Int -> Int;
FactFun[n \in Int] ==
IF n <= 1 THEN 1 ELSE n * FactFun[n - 1]
======================================
Issue Analytics
- State:
- Created 3 years ago
- Comments:13 (7 by maintainers)
Top Results From Across the Web
tlaplus - Bountysource
Inconsistency in placement of comments as returned by OpDefOrDeclNode.getComment $ 0 ... getComment to parse annotations in TLA+ declarations, see this PR.
Read more >How to easily extract comments contents in Excel?
Save the code and go back to the sheet you want to extract comment contents, type =getComment(B2) in a cell which will place...
Read more >Insert comments and notes in Excel - Microsoft Support
Insert threaded comments for discussions · Right-click the cell and then click New Comment. · Type your comment. · Click the Post button...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
FWIW: Annotations appear to be an interesting alternative to the config file. Especially, when combined with multi-module .tla files:
spec.tla
model.tla
Why do we have to care about the JLS? Anyway, make it “@apalache_type”.