@@ -2721,7 +2721,7 @@ void TypecheckSpec(List<int> layers, Action<TypecheckingContext> f)
27212721 {
27222722 var oldGlobalAccessOnlyInOld = tc . GlobalAccessOnlyInOld ;
27232723 if ( this is YieldProcedureDecl yieldProcedureDecl &&
2724- ( ! yieldProcedureDecl . HasMoverType || layers . Any ( layer => layer < yieldProcedureDecl . Layer ) ) )
2724+ ( ! yieldProcedureDecl . MoverType . HasValue || layers . Any ( layer => layer < yieldProcedureDecl . Layer ) ) )
27252725 {
27262726 tc . GlobalAccessOnlyInOld = true ;
27272727 }
@@ -2736,9 +2736,9 @@ void TypecheckSpec(List<int> layers, Action<TypecheckingContext> f)
27362736 foreach ( Requires e in Preserves )
27372737 {
27382738 if ( this is YieldProcedureDecl yieldProcedureDecl &&
2739- ( ! yieldProcedureDecl . HasMoverType || e . Layers . Any ( layer => layer < yieldProcedureDecl . Layer ) ) )
2739+ ( ! yieldProcedureDecl . MoverType . HasValue || e . Layers . Any ( layer => layer < yieldProcedureDecl . Layer ) ) )
27402740 {
2741- if ( yieldProcedureDecl . HasMoverType )
2741+ if ( yieldProcedureDecl . MoverType . HasValue )
27422742 {
27432743 tc . Error ( e , $ "only layer { yieldProcedureDecl . Layer } allowed for preserves clause") ;
27442744 }
@@ -2864,7 +2864,6 @@ public enum MoverType
28642864 Right ,
28652865 Left ,
28662866 Both ,
2867- None
28682867 }
28692868
28702869 public class ActionDecl : Procedure
@@ -2922,14 +2921,6 @@ public override void Resolve(ResolutionContext rc)
29222921 if ( RefinedAction != null )
29232922 {
29242923 RefinedAction . Resolve ( rc ) ;
2925- if ( ! HasMoverType )
2926- {
2927- MoverType = MoverType . Atomic ;
2928- }
2929- if ( RefinedAction . ActionDecl is { HasMoverType : false } )
2930- {
2931- RefinedAction . ActionDecl . MoverType = MoverType . Atomic ;
2932- }
29332924 }
29342925 }
29352926
@@ -3025,8 +3016,6 @@ public IEnumerable<ActionDeclRef> ActionDeclRefs()
30253016
30263017 public bool HasPreconditions => Requires . Count > 0 || YieldRequires . Count > 0 ;
30273018
3028- public bool HasMoverType => MoverType != MoverType . None ;
3029-
30303019 public bool IsRightMover => MoverType == MoverType . Right || MoverType == MoverType . Both ;
30313020
30323021 public bool IsLeftMover => MoverType == MoverType . Left || MoverType == MoverType . Both ;
@@ -3051,7 +3040,7 @@ public YieldingLoop(int layer, List<CallCmd> yieldInvariants)
30513040
30523041 public class YieldProcedureDecl : Procedure
30533042 {
3054- public MoverType MoverType ;
3043+ public MoverType ? MoverType ;
30553044 public List < CallCmd > YieldRequires ;
30563045 public List < CallCmd > YieldPreserves ;
30573046 public List < CallCmd > YieldEnsures ;
@@ -3061,7 +3050,7 @@ public class YieldProcedureDecl : Procedure
30613050 public HashSet < Variable > VisibleFormals ; // set during resolution
30623051 public Dictionary < Block , YieldingLoop > YieldingLoops ; // empty initially, filled up during type checking
30633052
3064- public YieldProcedureDecl ( IToken tok , string name , MoverType moverType , List < Variable > inParams ,
3053+ public YieldProcedureDecl ( IToken tok , string name , MoverType ? moverType , List < Variable > inParams ,
30653054 List < Variable > outParams ,
30663055 List < Requires > requires , List < Requires > preserves , List < Ensures > ensures , List < IdentifierExpr > modifies ,
30673056 List < CallCmd > yieldRequires , List < CallCmd > yieldPreserves , List < CallCmd > yieldEnsures ,
@@ -3117,7 +3106,7 @@ public override void Resolve(ResolutionContext rc)
31173106 rc . StateMode = oldStateMode ;
31183107 rc . Proc = null ;
31193108
3120- if ( ! HasMoverType )
3109+ if ( ! MoverType . HasValue )
31213110 {
31223111 VisibleFormals = RefinedAction == null
31233112 ? new HashSet < Variable > ( )
@@ -3128,13 +3117,9 @@ public override void Resolve(ResolutionContext rc)
31283117 if ( RefinedAction != null )
31293118 {
31303119 RefinedAction . Resolve ( rc ) ;
3131- if ( RefinedAction . ActionDecl is { HasMoverType : false } )
3132- {
3133- RefinedAction . ActionDecl . MoverType = MoverType . Atomic ;
3134- }
31353120 }
31363121
3137- if ( ! HasMoverType )
3122+ if ( ! MoverType . HasValue )
31383123 {
31393124 if ( Modifies . Any ( ) )
31403125 {
@@ -3160,7 +3145,7 @@ public override void Typecheck(TypecheckingContext tc)
31603145 }
31613146 }
31623147
3163- if ( HasMoverType )
3148+ if ( MoverType . HasValue )
31643149 {
31653150 Modifies . Where ( ie => ! ie . Decl . LayerRange . Contains ( Layer ) ) . ForEach ( ie =>
31663151 {
@@ -3219,12 +3204,10 @@ public IEnumerable<CallCmd> CallCmds()
32193204 {
32203205 return YieldEnsures . Union ( YieldPreserves ) . Union ( YieldRequires ) ;
32213206 }
3222-
3223- public bool HasMoverType => MoverType != MoverType . None ;
32243207
3225- public bool IsRightMover => MoverType == MoverType . Right || MoverType == MoverType . Both ;
3208+ public bool IsRightMover => MoverType . HasValue && ( MoverType . Value == Boogie . MoverType . Right || MoverType . Value == Boogie . MoverType . Both ) ;
32263209
3227- public bool IsLeftMover => MoverType == MoverType . Left || MoverType == MoverType . Both ;
3210+ public bool IsLeftMover => MoverType . HasValue && ( MoverType . Value == Boogie . MoverType . Left || MoverType . Value == Boogie . MoverType . Both ) ;
32283211
32293212 public ActionDecl RefinedActionAtLayer ( int layer )
32303213 {
0 commit comments