comp.lang.ada
 help / color / mirror / Atom feed
* Puzzled by SPARK global aspect
@ 2017-06-30 21:29 digitig
  2017-07-01 15:51 ` Anh Vo
  0 siblings, 1 reply; 5+ messages in thread
From: digitig @ 2017-06-30 21:29 UTC (permalink / raw)


Suppose in my package specification I have

   type Quadrant_Specification_Array is 
   array(Global.Quadrant_X_Index'Range, Global.Quadrant_Y_Index'Range) 
   of Quadrant_Specification;

(With QuadrantSpecification being a record type) and in my package body I have:

   function N_Total_Klingons return Global.Klingon_Counter
       with
         Refined_Global => (Input => Quadrant_Specifications)
   is
      Total: Global.Klingon_Counter := 0;
   begin
      for X in Quadrant_Specifications'Range loop
         for Y in Quadrant_Specifications'Range(2) loop
            Total := Total + Quadrant_Specifications(X, Y).N_Klingons;
         end loop;
      end loop;
      return Total;
   end N_Total_Klingons;

Spark gives me an error
  useless refinement, subprogram "N_Total_Klingons" does not depend on abstract state with visible refinement

But if I take the Refined_Global specification out I get the error

  "Quadrant_Specifications" must be listed in the Global aspect of "N_Total_Klingons"

I feel I'm losing either way - if I do specify it I'm wrong, if I don't specify it I'm wrong.

How *do* I fix this?


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2017-07-02  0:59 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-06-30 21:29 Puzzled by SPARK global aspect digitig
2017-07-01 15:51 ` Anh Vo
2017-07-01 18:25   ` digitig
2017-07-02  0:45     ` Anh Vo
2017-07-02  0:59       ` Anh Vo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox