poke-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 7/9] pkl: add location info to synthesized assignment stmts


From: Jose E. Marchesi
Subject: Re: [PATCH 7/9] pkl: add location info to synthesized assignment stmts
Date: Thu, 28 Dec 2023 16:34:01 +0100
User-agent: Gnus/5.13 (Gnus v5.13)

> On Thu, Dec 28, 2023 at 03:23:10PM +0100, Jose E. Marchesi wrote:
>> 
>> Hmm, how accurate are these locations?
>> Can you please add a couple of tests to make sure the locations make
>> sense?
>> 
>
> These locations are necessary for the "pkl: report evaluation location in 
> E_constraint exception"
> patch.
>
> Example:
>
> (poke) type A =  struct { int i == 1; }
> (poke) var a = A {}
> (poke) a.i++
> unhandled constraint violation exception
> failed expression
>   i == 1
> in field A.i evaluated at <stdin>:1:1 (defined at <stdin>:1:24)
>   
>
> Reason: In the codegen, we need the location of the synthesized assignment to 
> report it to the user.

Yes I understand.

My point was that since the assignment (in the AST) is synthesized, to
make sure the location makes sense when presented to the user, and to
add a couple of tests to make sure of it.

For example, in the code:

  var a =
   A
   {
   };

What location above will these synthetised assignments have?



reply via email to

[Prev in Thread] Current Thread [Next in Thread]