Skip to content

Commit e0521b4

Browse files
CyberShadowGeod24
authored andcommitted
spec: Merge ClassInvariant and StructInvariant
Their definition is identical, and therefore indistinguishable.
1 parent c70320b commit e0521b4

File tree

5 files changed

+15
-16
lines changed

5 files changed

+15
-16
lines changed

spec/class.dd

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -902,13 +902,13 @@ $(GNAME SharedStaticDestructor):
902902
$(H2 $(LNAME2 invariants, Class Invariants))
903903

904904
$(GRAMMAR
905-
$(GNAME ClassInvariant):
905+
$(GNAME Invariant):
906906
$(D invariant $(LPAREN) $(RPAREN)) $(GLINK2 statement, BlockStatement)
907907
$(D invariant) $(GLINK2 statement, BlockStatement)
908908
$(D invariant $(LPAREN)) $(GLINK2 expression, AssertArguments) $(D $(RPAREN) ;)
909909
)
910910

911-
$(P $(I ClassInvariant) specify the relationships among the members of a class instance.
911+
$(P Class $(I Invariant)s specify the relationships among the members of a class instance.
912912
Those relationships must hold for any interactions with the instance from its
913913
public interface.
914914
)
@@ -924,10 +924,10 @@ $(GNAME ClassInvariant):
924924

925925
$(P There may be multiple invariants in a class. They are applied in lexical order.)
926926

927-
$(P $(I ClassInvariant)s must hold at the exit of the class constructor (if any),
927+
$(P Class $(I Invariant)s must hold at the exit of the class constructor (if any),
928928
at the entry of the class destructor (if any).)
929929

930-
$(P $(I ClassInvariant)s must hold
930+
$(P Class $(I Invariant)s must hold
931931
at the entry and exit of all public or exported non-static member functions.
932932
The order of application of invariants is:
933933
$(OL
@@ -983,7 +983,7 @@ $(GNAME ClassInvariant):
983983

984984
$(IMPLEMENTATION_DEFINED
985985
$(OL
986-
$(LI Whether the $(I Class Invariant) is executed at runtime or not. This is typically
986+
$(LI Whether the class $(I Invariant) is executed at runtime or not. This is typically
987987
controlled with a compiler switch.)
988988
$(LI The behavior when the invariant does not hold is typically the same as
989989
for when $(GLINK2 expression, AssertExpression)s fail.)

spec/contracts.dd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ $(H2 $(LNAME2 pre_post_contracts, Pre and Post Contracts))
3434

3535
$(H2 $(LNAME2 Invariants, Invariants))
3636

37-
$(P See $(DDSUBLINK struct, StructInvariant, Struct Invariants) and $(DDSUBLINK class, invariants, Class Invariants).)
37+
$(P See $(DDSUBLINK struct, Invariant, Struct Invariants) and $(DDSUBLINK class, invariants, Class Invariants).)
3838

3939

4040
$(H2 $(LNAME2 references, References))

spec/expression.dd

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1933,11 +1933,11 @@ $(GNAME AssertArguments):
19331933
)
19341934

19351935
$(P If the first $(I AssignExpression) is a reference to a class instance for
1936-
which a $(DDSUBLINK spec/class, invariants, Class Invariant) exists, the $(I Class Invariant) must hold.
1936+
which a $(DDSUBLINK spec/class, invariants, class Invariant) exists, the class $(I Invariant) must hold.
19371937
)
19381938

19391939
$(P If the first $(I AssignExpression) is a pointer to a struct instance for
1940-
which a $(I Struct Invariant) exists, the $(I Struct Invariant) must hold.
1940+
which a struct $(I Invariant) exists, the struct $(I Invariant) must hold.
19411941
)
19421942

19431943
$(P The type of an $(I AssertExpression) is $(D void).

spec/module.dd

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,7 @@ $(GNAME DeclDef):
2121
$(GLINK2 struct, Postblit)
2222
$(GLINK2 class, Allocator)
2323
$(GLINK2 class, Deallocator)
24-
$(GLINK2 class, ClassInvariant)
25-
$(GLINK2 struct, StructInvariant)
24+
$(GLINK2 class, Invariant)
2625
$(GLINK2 unittest, UnitTest)
2726
$(GLINK2 class, AliasThis)
2827
$(GLINK2 class, StaticConstructor)

spec/struct.dd

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1500,16 +1500,16 @@ void main()
15001500
---
15011501
)
15021502

1503-
$(H2 $(LNAME2 StructInvariant, Struct Invariants))
1503+
$(H2 $(LNAME2 Invariant, Struct Invariants))
15041504

15051505
$(GRAMMAR
1506-
$(GNAME StructInvariant):
1506+
$(GNAME Invariant):
15071507
$(D invariant $(LPAREN) $(RPAREN)) $(GLINK2 statement, BlockStatement)
15081508
$(D invariant) $(GLINK2 statement, BlockStatement)
15091509
$(D invariant $(LPAREN)) $(GLINK2 expression, AssertArguments) $(D $(RPAREN) ;)
15101510
)
15111511

1512-
$(P $(I StructInvariant)s specify the relationships among the members of a struct instance.
1512+
$(P Struct $(I Invariant)s specify the relationships among the members of a struct instance.
15131513
Those relationships must hold for any interactions with the instance from its
15141514
public interface.
15151515
)
@@ -1525,10 +1525,10 @@ $(GNAME StructInvariant):
15251525

15261526
$(P There may be multiple invariants in a struct. They are applied in lexical order.)
15271527

1528-
$(P $(I StructInvariant)s must hold at the exit of the struct constructor (if any),
1528+
$(P Struct $(I Invariant)s must hold at the exit of the struct constructor (if any),
15291529
and at the entry of the struct destructor (if any).)
15301530

1531-
$(P $(I StructInvariant)s must hold
1531+
$(P Struct $(I Invariant)s must hold
15321532
at the entry and exit of all public or exported non-static member functions.
15331533
The order of application of invariants is:
15341534
$(OL
@@ -1588,7 +1588,7 @@ $(GNAME StructInvariant):
15881588

15891589
$(IMPLEMENTATION_DEFINED
15901590
$(OL
1591-
$(LI Whether the $(I StructInvariant) is executed at runtime or not. This is typically
1591+
$(LI Whether the struct $(I Invariant) is executed at runtime or not. This is typically
15921592
controlled with a compiler switch.)
15931593
$(LI The behavior when the invariant does not hold is typically the same as
15941594
for when $(GLINK2 expression, AssertExpression)s fail.)

0 commit comments

Comments
 (0)