tlaplus: Raise warning when definition or declaration appears as Record field name

The formula SeemsObvious is false for any value of C1, except for the one value "C1".

---- MODULE Foo ----
CONSTANTS C1
SomeSet == {C1}

SomeRecord == 
  [
    C1 |-> 1
  ]

SeemsObvious == 
    DOMAIN SomeRecord = SomeSet

\* A more real-world scenario.
Next == \E v \in SomeSet: SomeRecord[v] = 1

\* TLAPS proves this theorem
THEOREM DOMAIN SomeRecord = {"C1"} BY DEF SomeRecord
====

This appears sufficiently counterintuitive to warrant a warning. ~Unfortunately, such a warning can only be raised during model checking in the general case.~ SANY could issue a warning when it sees the symbol of the CONSTANT C1 appear as a record field. Thoughts?

/cc @craft095

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 33 (29 by maintainers)

Commits related to this issue

Most upvoted comments

I can probably take on #1186 this month. SANY has needed an overhaul to its output system for a while.

Can you explain how a warning breaks a client spec?

“Breaks” was a little strong, more like it caused problems. Nontechnical people were suddenly worried that the specs were now flawed, and weren’t reassured that the warnings were coming from the Pluscal translation process.

It might be worthwhile to add an optional user-friendly warnings pass after level checking. We don’t really make much use of warnings in the parser but I’m sure there are a lot of things we could think of to add warnings for.