7854 Commits

Author SHA1 Message Date
Romain Beguet
a638facb03 V622-017: Fix env grouping with non-default metadata.
The routine for grouping lexical envs would previously always flatten grouped
envs. However, this process would discard the `default_md` field of the nested
grouped envs.
The implementation now decides to flatten grouped envs only if the resulting
env behavior is the same.
v23.0.0
2022-09-01 12:45:19 +02:00
Laurent Thévenoux
540f2d3242 langkit/parsers.py: support Cut in Opt subparser
Improve error recovery of incomplete code parsing by allowing Cut
parser in Opt ones.

TN: S201-022
2022-08-01 10:51:45 +02:00
Pierre-Marie de Rodat
de0d147d1e Properties: add "Self" sloc to messages of implicit Property_Error exc.
When a property raises an error, for instance because it tries to get
some field in a null node, it would be nice to include the sloc of the
node in that property, so that error messages give users a clue about
how it relates to the Ada source code that Libadalang analyzes, which
would be useful to workaround or investigate an issue.

Note that adding this sloc information is done on a best effort basis.
As a notable example, the Property_Error exception raised in the lexical
environment lookup system do not provide it, as the "Self" node for the
property that triggers a lexical env lookup is not available there, and
taking this information to this point would require a lot of logistics,
and possibly run time performance degradation.

Closes #635
2022-07-26 12:55:57 +00:00
Pierre-Marie de Rodat
c174e5c703 Lkt lowering: fix lowering order for list node derivation
Depending on the order picked by Langkit for node type lowering,
processing the definition of a derived list node could crash. The
problem was that lowering code just assumed so far that the root node
was lowered before list nodes, and that list element nodes were lowered
before the corresponding list nodes as well, whereas this has never been
guaranteed.

To fix this, we now force the lowering of the element node when lowering
a list node, and stop assuming that the root node is lowered first.

For #622
2022-07-26 12:46:52 +00:00
Pierre-Marie de Rodat
460af0bd1e Lkt lowering: properly catch type inheritance loops
For #622
2022-07-26 12:46:52 +00:00
Pierre-Marie de Rodat
2cb44f1bc8 Lkt lowering: robustify traits checking for nodes
Reject invalid uses of traits, make sure that the Node trait is
instantiated with the root node, etc.

For #622
2022-07-26 12:46:52 +00:00
Pierre-Marie de Rodat
7d9cbe0c40 Lexical envs: fix inverted logic
In exception handlers, we must free resources when it *is* a "legit"
exception taht is raised, and leave them unchanged in other cases. This
fixes a memory leak in the former case.

For #632
2022-07-21 08:07:13 +00:00
Romain Beguet
3f9cf09bf5 V708-016: Fix concatenation order of rebindings.
Given rebindings L and R with R = R1 -> .. -> Rn, the previous implementation
returned Rn -> .. -> R1 -> L, so the order of the parents in R was reversed in
the result. We now correctly return R1 -> .. -> Rn -> L.
2022-07-19 17:15:12 +02:00
Pierre-Marie de Rodat
583bf96327 properties/rebindings: simplify and fix pasto
Fix the "p_old" property so that it returns the old env (not the new
one). Also remove lots of useless bits in this testcase, to avoid noise
to the readers.

TN: V708-016
2022-07-19 16:55:33 +02:00
Pierre-Marie de Rodat
80da226ef8 Fix the "is_optional" information for list fields
When they return a list node type, parsers never return a null node:
they create instead an empty list. Fix the computation of "is_optional"
field information for this case. Also clarify the semantics of
"is_optional".

TN: V629-007
2022-07-19 12:32:37 +00:00
Pierre-Marie de Rodat
a21e0e8519 REQUIREMENTS.dev: fix the gnat-gdb-scripts entry
TN: V707-013
2022-07-19 11:55:37 +00:00
Pierre-Marie de Rodat
8e13558aac manage.py: fix path formatting on Windows
Use the correct path environment variable separator (':' or ';')
depending on the platfrom and the environment variable. This should fix
builds on Windows/GitHub.

For #631
2022-07-19 11:44:24 +00:00
Pierre-Marie de Rodat
f55fcb92ea Properties DSL: make it possible to raise PreconditionFailure exceptions
For #632
2022-07-19 09:42:07 +00:00
Pierre-Marie de Rodat
8f220c9e25 Allow lang. specs to extend the set of exceptions properties may raise
So far, properties were allowed to raise Property_Error exceptions only:
other exceptions were considered as a low-level bug (i.e. assumed not
possible), which could corrupt the process state.

This commits allows language specs to allow additional kinds of
exceptions to be raised in property errors.

For #632
2022-07-19 09:42:07 +00:00
Pierre-Marie de Rodat
30d2f7ac8c Mypy: leverage type hints from gdb and gnat-gdb-scripts
TN: V707-013
2022-07-18 15:20:38 +00:00
Pierre-Marie de Rodat
5e83e72c4f GDB helpers: remove the obsolete EnvNamePrinter class
Environment names are mere symbols for quite a long time now (they used
to be an array of symbols, wrapped in a Env_Name_Record type). Remove
the pretty-printer that was associated to this type.

TN: V707-013
2022-07-07 13:41:32 +00:00
Pierre-Marie de Rodat
1f5ac4e0d4 Doc: add a section about property memoization
For #630
2022-07-07 12:21:22 +00:00
Pierre-Marie de Rodat
78e82bca97 Fix memoization for predicates that need to work on null nodes
For #630
2022-07-07 12:21:22 +00:00
Pierre-Marie de Rodat
60c8a1b7b1 Fix properties tracing for the Ref_Categories type
For #630
2022-07-07 12:21:22 +00:00
Pierre-Marie de Rodat
ed6b405069 ArrayType.builtin_properties: set lazy_field to False
Whether properties are lazy fields is determined in the "compute
property attributes" compilation pass. However, array types, and thus
their "to_iterator" properties, can be created later on (when
constructing property expressions). As a result, in order for the "lazy
field" information to be properly initialized for "to_iterator", we need
to fill it in right at property creation.

For #630
2022-07-07 12:21:22 +00:00
Pierre-Marie de Rodat
ac610cdd78 Fix the memoization of properties taking enum arguments
For #630
2022-07-07 12:21:22 +00:00
Pierre-Marie de Rodat
76343db6b7 memoization_ada.mako: emit enum types on several lines
GNAT complains when lines are too long in Ada source code. An upcoming
change will allow to memoize as many properties as possible, making
enum types used to implement memoization very big, so we need to break
up their declarations on multiple lines.

For #630
2022-07-07 12:21:22 +00:00
Pierre-Marie de Rodat
835548a53f Change license to Apache 2.0 2022-07-05 09:58:50 +00:00
Pierre-Marie de Rodat
e13dfe6d05 Run stylechecks on manage.py & setup.py
Also fix existing style issues in manage.py.

Closes #633
2022-07-04 16:11:24 +02:00
Raphaël AMIARD
bfce25b08d Make toplevel manage.py accept -J
Fixes issue #631
2022-06-29 08:27:19 +00:00