Skip to content

Commit

Permalink
Add tracing for enumerations
Browse files Browse the repository at this point in the history
  • Loading branch information
florianschanda committed Oct 4, 2023
1 parent 8beee5c commit e2518b9
Show file tree
Hide file tree
Showing 10 changed files with 38 additions and 1 deletion.
1 change: 1 addition & 0 deletions tests-system/enum-ok/tracing
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
LRM.Enumeration_Declaration
1 change: 1 addition & 0 deletions tests-system/enum/tracing
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
LRM.Enumeration_Declaration
15 changes: 15 additions & 0 deletions tests-system/rbt-unique-enumeration-literals/bar.rsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package Bar

enum ASIL {
QM
A
B
C
D
}

enum Language {
Ada
C // Not an issue since it's a different enum
Python
}
10 changes: 10 additions & 0 deletions tests-system/rbt-unique-enumeration-literals/foo.rsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package Foo

enum E {
Foo
Bar
Foo
Baz
Bork
Baz
}
3 changes: 3 additions & 0 deletions tests-system/rbt-unique-enumeration-literals/output
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Foo
^^^ rbt-unique-enumeration-literals/foo.rsl:6: error: duplicate definition, previous definition at foo.rsl:4
Processed 2 model(s), 0 check(s) and 0 requirement file(s) and found 1 error(s)
1 change: 1 addition & 0 deletions tests-system/rbt-unique-enumeration-literals/output.brief
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
rbt-unique-enumeration-literals/foo.rsl:6:3: trlc error: duplicate definition, previous definition at foo.rsl:4
3 changes: 3 additions & 0 deletions tests-system/rbt-unique-enumeration-literals/output.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Foo
^^^ rbt-unique-enumeration-literals/foo.rsl:6: error: duplicate definition, previous definition at foo.rsl:4
Processed 2 model(s), 0 check(s) and 0 requirement file(s) and found 1 error(s)
3 changes: 3 additions & 0 deletions tests-system/rbt-unique-enumeration-literals/output.smtlib
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Foo
^^^ rbt-unique-enumeration-literals/foo.rsl:6: error: duplicate definition, previous definition at foo.rsl:4
Processed 2 model(s), 0 check(s) and 0 requirement file(s) and found 1 error(s)
1 change: 1 addition & 0 deletions trlc/ast.py
Original file line number Diff line number Diff line change
Expand Up @@ -2973,6 +2973,7 @@ def make_visible(self, stab):

def register(self, mh, entity):
# lobster-trace: LRM.Duplicate_Types
# lobster-trace: LRM.Unique_Enumeration_Literals
assert isinstance(mh, Message_Handler)
assert isinstance(entity, Entity)

Expand Down
1 change: 0 additions & 1 deletion trlc/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,6 @@ def parse_enum_declaration(self):
location = name.location,
enum = enum)
empty = False
# lobster-trace: LRM.Unique_Enumeration_Literals
enum.literals.register(self.mh, lit)
self.match("C_KET")

Expand Down

0 comments on commit e2518b9

Please sign in to comment.