@@ -109,7 +109,7 @@ impl fmt::Display for Class<'_> {
109109 is_final: false ,
110110 return_type: None ,
111111 formal_parameters: vec![ ] ,
112- body: charpred. clone( ) ,
112+ body: Some ( charpred. clone( ) ) ,
113113 overlay: None ,
114114 }
115115 ) ?;
@@ -307,7 +307,9 @@ pub struct Predicate<'a> {
307307 pub is_final : bool ,
308308 pub return_type : Option < Type < ' a > > ,
309309 pub formal_parameters : Vec < FormalParameter < ' a > > ,
310- pub body : Expression < ' a > ,
310+ /// The body of the predicate, or `None` if this is an `abstract`
311+ /// predicate declaration with no body.
312+ pub body : Option < Expression < ' a > > ,
311313 pub overlay : Option < OverlayAnnotation > ,
312314}
313315
@@ -330,6 +332,9 @@ impl fmt::Display for Predicate<'_> {
330332 if self . is_final {
331333 write ! ( f, "final " ) ?;
332334 }
335+ if self . body . is_none ( ) {
336+ write ! ( f, "abstract " ) ?;
337+ }
333338 if self . overridden {
334339 write ! ( f, "override " ) ?;
335340 }
@@ -344,7 +349,10 @@ impl fmt::Display for Predicate<'_> {
344349 }
345350 write ! ( f, "{param}" ) ?;
346351 }
347- write ! ( f, ") {{ {} }}" , self . body) ?;
352+ match & self . body {
353+ Some ( body) => write ! ( f, ") {{ {body} }}" ) ?,
354+ None => write ! ( f, ");" ) ?,
355+ }
348356
349357 Ok ( ( ) )
350358 }
0 commit comments