From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: a07f3367d7,aa0ebfe6afda2b3 X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,CP1252 Path: g2news2.google.com!postnews.google.com!l6g2000vbo.googlegroups.com!not-for-mail From: Phil Thornley Newsgroups: comp.lang.ada Subject: =?windows-1252?Q?Re=3A_SPARK_syntax_and_=93use_type=94_=3A_lack_of_featur?= =?windows-1252?Q?e_=3F?= Date: Mon, 24 May 2010 16:01:08 -0700 (PDT) Organization: http://groups.google.com Message-ID: <17c936fc-66ce-4bb9-ba5a-069d9ed5a2fe@l6g2000vbo.googlegroups.com> References: NNTP-Posting-Host: 80.177.171.182 Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable X-Trace: posting.google.com 1274742068 24054 127.0.0.1 (24 May 2010 23:01:08 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Mon, 24 May 2010 23:01:08 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: l6g2000vbo.googlegroups.com; posting-host=80.177.171.182; posting-account=Fz1-yAoAAACc1SDCr-Py2qBj8xQ-qC2q User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0),gzip(gfe) Xref: g2news2.google.com comp.lang.ada:11945 Date: 2010-05-24T16:01:08-07:00 List-Id: On 24 May, 19:41, Yannick Duch=EAne (Hibou57) wrote: > Hi, > > I meet a strange behavior with the SPARK syntax checker (via the examiner= ). I can't get the behaviour that you are reporting (I'm still on GPL version 8.1.1) - can you post a complete SPARKable example? > If I have something of the form > > =A0 =A0 procedure My_Procedure > =A0 =A0 is > =A0 =A0 =A0 =A0Who_Know_What : Who_Know_What_Type; > =A0 =A0 =A0 =A0use type My_Type; > =A0 =A0 begin > =A0 =A0 =A0 =A0... bla-bla-bla ... > =A0 =A0 end My_Procedure; > > it's OK. This definitely should not be OK, 'use type' clauses should (normally) only appear as part of a context clause. With this code in a package body: type A_Type is range 1 .. 10; procedure My_Procedure(A : in A_Type; B : in A_Type; X : out Integer) --# derives X from A, B; is Y : Integer; use type A_Type; begin Y :=3D Integer(A + B); X :=3D Y; end My_Procedure; I get a semantic error (112) at the 'use type'. "A use type clause may not appear here. They are only permitted as part of a context clause or directly following an embedded package specification." (although, of course, a use type clause never needs to reference a type in the same package). > While if I have something like > > =A0 =A0 procedure My_Procedure > =A0 =A0 is > =A0 =A0 =A0 =A0use type My_Type; > =A0 =A0 begin > =A0 =A0 =A0 =A0... bla-bla-bla ... > =A0 =A0 end My_Procedure; > > Then the spark syntax checker complains =93Syntax Error reserved "IS" can= not =A0 > be followed by "USE" here.=94 I do get that error (which is to be expected since a 'use type' clause must follow a semi-colon). > Is SPARK missing something or is there a rational ? Not sure, unless you can post your complete SPARKable code? Cheers, Phil