10. Libadalang API breaking changes

10.1. Move P_Get_Primitives from Type_Decl to Base_Type_Decl

This change moves the P_Get_Primitives from the Ada_Type_Decl type to the Ada_Base_Type_Decl type. This allows to call P_Get_Primitives on the Ada_Task_Type_Decl type for example.

tn:

libadalang-1083

apis:

all

10.2. Rename F_Digits field of Ada_Delta_Constraint

The field F_Digits of the node Ada_Delta_Constraint has been renamed to F_Delta to correctly match the definition of a delta constraint (which doesn’t specify digits but delta).

tn:

libadalang-1085

apis:

all

10.3. Return value of Children_And_Trivia type changes

The Children_And_Trivia function has been modified and does not return an Ada array anymore. Instead the return type Children_Array is a custom type with the Iterable aspect, which may break user code. For instance:

  • for C in N.Children_And_Trivia'Range should become for C in N.Children_And_Trivia

  • X (I) should become Element (X, I) when X is the result of Children_And_Trivia

Note that the for C of .. iteration style is not affected by this API break.

tn:

langkit-651

apis:

all

10.4. Remove the Libadalang.Introspection package

The Libadalang.Introspection package has been removed. Introspection primitives are now available in the Langkit_Support.Generic_API.Introspection package.

tn:

W106-006

apis:

all

10.5. Rename –exit-on-missing-file command line argument

This change renames App’s --exit-on-missing-file built in command line argument to --keep-going-on-missing-file. This inverts the semantics for this flag: when a source file is missing, the App exits with an error by default, and it just emits a warning and keeps going when the flag is passed.

tn:

VB23-023

apis:

all

10.6. Add a GPR2 based unit provider

In order to prepare for the upcoming deprecation of GNATCOLL.Projects and replacement by the new GPR2 library, this change duplicates Libadalang APIs to create unit providers based on projects to work with projects loaded using GPR2.

Note however that just like GPR2, this new API should be considered as still work in progress: it can change in the future and is thus not recommended for production code.

tn:

V608-025

apis:

all

10.7. Fix BasicDecl.relative_name on synthetic decls

Before this change, Name.relative_name did return a SingleTokNode, which made it impossible for it to return SyntheticIdentifiers, which are valid relative names for synthetic entities.

This change changes the signature of relative_name so that it returns a Name instead. To get the symbol corresponding to the returned name, you can call Name.name_symbol on it.

tn:

VB25-023

apis:

all

10.8. Change the structure of AcceptStmt nodes

Accept statements are a weird beast in Ada, in that they both look like subprogram bodies and like composite statements.

Similar to named loops, they’ll allow you to fully qualify the names of entities declared inside of them. Also you might expect to be able to navigate to them from the entry declaration.

For that reason, the Libadalang tree has been modified so that Accept statements now include a body declaration, so that the following accept statement:

accept Foo;

Will produce the following tree:

AcceptStmt
|f_body_decl:
|  AcceptStmtBody
|  |f_name:
|  |  DefiningName
|  |  |f_name:
|  |  |  Id: Foo
|f_entry_index_expr: <null>
|f_params:
|  EntryCompletionFormalParams
|  |f_params: <null>

This in turns allow both fully qualifying entities declared in them, as well as navigating to the first accept statement corresponding to an entry via the P_Next_Part/P_Body_Part properties.

tn:

VB07-098

apis:

all

10.9. File readers: allow both diagnostics and contents in a result

It may be interesting for file readers to return both decoded contents and also diagonstics, for example when doing error recovery while transcoding the source buffer.

The Read primitives did not allow this previously: Contents was considered uninitialized when Diagnostics was not empty. Read callers can now expect Contents to be initialized instead to support this case.

tn:

VA17-001

apis:

ada

10.10. Libadalang.Config_Pragmas: class-wide Project_Tree formals

Make subprograms that accept GNATCOLL.Project.Project_Tree formals actually take Project_Tree'Class values. This makes it easier for Libadalang users to interact with the Project_Tree_Access type from GNATCOLL.Projects, which is an access to the class-wide type.

tn:

VA07-037

apis:

ada

10.11. Correct parsing of attribute refs

This change fixes a long-standing issue in LAL where would incorrectly parse attribute references denoting subprograms. For example, we would parse Integer'Image (1) as a single AttributeRef node with its f_args field being the literal 1. After this change, this is now parsed as a CallExpr whose f_name field is the AttributeRef without arguments. This also means that name resoltuion will now correctly work when an attribute-ref is used in place where a reference to a subprogram is expected, such as the target of a subprogram renaming or as the actual of a generic instantiation.

tn:

UB23-012

apis:

all

10.12. Fix find_refs property

Do not expose publicly the origin parameter of the find_refs property anymore. This parameter is only used for internal purposes.

This patch also improves the property by using the canonical part of the name the property is looking for references.

tn:

V822-023

apis:

all

10.13. Change UpdateAttributeRef parent class

UpdateAttributeRef is now a child of Name rather than AttributeRef, because it’s only syntactically similar to other Ada aspects, but is a non standard aspect with non standard arguments.

This allows to narrow the type of the AttributeRef.f_args field to AssocList.

tn:

V726-022

apis:

all

10.14. Improve concatenation operator handling

This change aims to fix the handling of very long strings concatenation which often occurs in practice. Indeed, a few hundreds of concatenations led to a stack overflow when libadalang resolves names. This was due to the fact that concatenation expressions, since & is a binary operator, was represented as a tree. This tree being as deep as the length of the expression, requiring deep recursions, leading to overflows. Libadalang now handles such expression as a list of operands to avoid those deep recursions.

Consequently, a concatenation expression of n operands, is now composed of one single ConcatOp instead of a tree of n-1 BinOp. For example, see below the before/after representation of A & B & C & D & E:

BinOp(
  Binop(
    BinOp(
      BinOp(A, &, B), & , C), &, D), &, E)

This tree is now represented by a single operator (ConcatOp), handling a list of operands that can be processed without having to perform recursions:

ConcatOp(A,
  ConcatOperand(&, B),
  ConcatOperand(&, C),
  ConcatOperand(&, D),
  ConcatOperand(&, E))
tn:

T526-004

apis:

all

10.15. Aspects are associated with defining names

This change reworks the way aspects (aspect associations, pragmas and representation clauses) are exposed in Libadalang. They were previously associated with BasicDecl nodes, but since basic declarations allow multiple defining names and aspects can be defined on a single one of them, the P_Has_Aspect property and other similar properties defined on BasicDecl were not fine-grain enough. This change fixes that by introducing those properties on DefiningName. Their BasicDecl versions now raise an exception when called on declarations with multiple defining names. Moreover, the Pragma.P_Associated_Decls property has been renamed to Pragma.P_Associated_Entities and returns a list of defining names instead of a list of declarations.

tn:

V517-019

apis:

all

10.16. Libadalang.Common API cleanup

The public part of Libadalang.Common used to contain internal entities: GNATCOLL traces and precomputed symbols. They are now no longer part of this package.

tn:

T814-020

apis:

all

10.17. Renaming of values for the RefResultKind enum type

In all APIs, the values of the RefResultKind enumeration type have been renamed. For instance, in the Ada API, Noref was renamed to No_Ref, while in the Python API, it has been renamed to no_ref, for consistency with casing conventions in similar identifiers.

tn:

V126-009

apis:

all

10.18. Defaults for generic formal types (Ada 2022)

This change implements the Ada 2022 feature that allows default subtypes to be specified in generic formal type parameters.

This change breaks the API because of some parsing incompatibilities introduced by the feature. Indeed, this feature allows to set a default type for a generic formal type parameter thanks to the or use keywords. Basic type declarations now differ from the formal type declarations used to declare type parameters within a generic instantiation by the position of their aspects field. To workaround this incompatibilty, we made TypeDecl abstract and introduced some new nodes:

  • ConcreteTypeDecl, which is used in place of TypeDecl, and represents concrete type declarations.

  • FormalTypeDecl represents the type declaration used as generic formal parameters.

  • FormalIncompleteTypeDecl represents the incomplete type declaration used as generic formal parameters.

tn:

V104-012

apis:

all

10.19. API to get the list of sources from a project file

In the Ada API, the Libadalang.Helpers.List_Sources_From_Project function was removed and replaced with Libadalang.Project_Provider.Source_Files, with signature changes to make it more configurable: it is now possible to get sources from externally built projects as well as from the runtime. This API has also been bound to the Python bindings (libadalang.SourceFiles.for_project).

tn:

UB29-005

apis:

all

10.20. Make P_Discriminants_List take origin parameter

This change adds an origin node parameter to the P_Discriminants_List property in the Ada and Python apis. This node is used to filter the output of the property with respect to what is visible from this origin node.

tn:

U928-026

apis:

python, ada

10.21. Discontinue Python2 support

Libadalang’s Python API no longer supports Python2 interpreters. Only Python 3.7 versions and newer are now supported.

tn:

U720-016

apis:

all

10.22. Update PragmaArgumentAssoc’s F_Id field

This change adds support for parsing pragma argument assocs containing attribute refs as in pragma Assertion_Policy (Post'Class => Ignore). Thus we also rename PragmaArgumentAssoc’s F_Id field to F_Name, as the most precise type of this field is now Name.

tn:

U816-006

apis:

all

10.23. Change behavior of TypeDecl.is_record_type

Previous behavior was to return True on private tagged types extending a public tagged type, which did yield unintuitive results when used in conjunction with properties expecting record types, such as shapes.

Now is_record_type simply returns whether the type has publicly directly visible component (eg. directly contains a record definition).

tn:

U812-025

apis:

all

10.24. Improve BasicDecl/DefiningName APIs

Some properties of BasicDecl`, namely ``p_unique_identifying_name, p_fully_qualified_name, p_canonical_fully_qualified_name, make little sense when applied to basic declarations with several names, such as object declarations or parameter specifications.

A, B : Integer;

Those properties will now raise an error when used on declarations declaring several objects as above, and equivalent properties have been exposed on DefiningName, which should from now on be favored.

tn:

U430-027

apis:

all

10.25. Get rid of discriminant/index constraints

DiscriminantConstraint and IndexConstraint nodes are now replaced by a single node type, CompositeConstraint.

This fixes a problem where, due to an ambiguity in the Ada grammar, we would incorrectly parse index constraints as being discriminant constraints.

To know whether a CompositeConstraint is an index or a discriminant constraint, two new properties, p_is_index_constraint and p_is_discriminant_constraint have been exposed.

A new assoc node type, CompositeConstraintAssoc, is introduced. It can store a discriminant constraint assoc, as well as an index constraint.

The consequence is that a CompositeConstraintAssoc can store a construct that is illegal Ada, such as in the code:

A : My_Type (Disc => 12 .. 15)

This currently won’t be caught by LAL, and is in-line with other such decisions where we parse a superset of Ada syntax.

tn:

U526-014

apis:

all

10.26. DefiningName.find_refs origin param is now optional

In the original API, this parameter was mandatory, which was a mistake because it’s only useful in edge cases and internal use.

tn:

U730-029

apis:

all

10.27. Dedicated exception in Libadalang.Project_Provider

When passed an unsupported prject configuration, the `` Libadalang.Project_Provider.Create_Project_Unit_Provider function now raises a dedicated exception (Invalid_Requested_Project_Error) instead of re-using GNATCOLL’s Invalid_Project exception.

tn:

U518-009

apis:

ada

10.28. New with_self argument to the parents node method

What used to be nodes’ parents property is now a method, which takes an optional with_self boolean argument. Uses of that property (.parents) must now be updated to use the call syntax (.parents()).

tn:

U329-073

apis:

python

10.29. Consolidate meaning of RefResultKind values

Until now, the meaning of the different RefResultKind values that could be returned by e.g a P_Failsafe_Referenced_Decl query was a bit chaotic. For example, Precise could be returned together with a null node as value. Error would be sometimes returned for queries made on names that were not referenced instead of NoRef. This change sanitizes the output so that:

  • NoRef is always returned for queries made on names that are not references (e.g. defining names, attribute names) or references to entities that have no declaration (e.g. built-in operators)

  • Error is reserved to cases where Libadalang fails to resolve the name, either because of an internal problem or because of invalid input.

  • Precise is never returned with a null value.

tn:

U322-044

apis:

all

10.30. Use iterators for the p_complete property

Previously, the p_complete property would return its result in an array, which could potentially be huge and cause storage errors. It now returns its result as an iterator.

tn:

T218-020

apis:

all

10.31. Imprecise fallback on navigation properties

From now on, navigation properties (such as p_previous_part, p_body_part & co.) can be invoked in imprecise fallback mode, meaning that an ad-hoc routine will try to carry out the execution if the normal “precise” path fails. This breaks the Python API because adding a boolean parameter imprecise_fallback on those properties means that they must now be called with parentheses all the time.

tn:

T821-007

apis:

python

10.32. Remove Debug_Text APIs

The name of this function was misleading: it had the Debug prefix not because it was “safe for debug” to call it (just like Text, it would crash on a null node), but because it turned the node text into ASCII using escaping for non-ASCII parts of the source, which can be useful for debug or logging. Users should prefer the Image function for debug, which should be familiar to Ada users.

Current uses of Debug_Text can just call Text and transform its Text_Type result into a String using Langkit_Support.Text.Image, which is exactly what Debug_Text did. Or they can of course switch to Image, which is much better for debug/logging.

tn:

T702-025

apis:

ada

10.33. Remove Short_Image APIs

For consistency, the functions called Short_Image or short_image are now either renamed or merged with the equivalent Image/image functions.

tn:

T702-024

apis:

all

10.34. Rename Children_With_Trivia and make it return ghost nodes

For extra clarity, the Children_With_Trivia function in Libadalang.Analysis has been renamed Children_And_Trivia. Moreover, its returned array now includes children ghost nodes, so that the result of the Children function is always a subset of the result of the Children_And_Trivia result.

tn:

T622-015

apis:

ada

10.35. DefiningName.find_all_refs/calls returns RefResult array

DefiningName.find_all_references/calls returns RefResult array, which contains the information of whether the reference was obtained via precise or imprecise resolution.

Additionally, exceptions shouldn’t be raised as part of the normal control flow of those properties, and a name resolution failure won’t make them stop searching.

tn:

TA19-016

apis:

all

10.36. Enhance support for aggregate projects

Unit providers based on projects have been enhanced to better support aggregate projects.

First, the Ada API makes it possible to create multiple unit providers from a single aggregate project so that each unit providers has access to a consistent set of analysis units: see Libadalang.Project_Provider.Create_Project_Unit_Providers. This is useful when you want to analyze an aggregate project that contains alternative implementations of the same unit.

Second, the Ada API no longer provides a direct access to the Project_Unit_Provider type. Since Libadalang.Analysis.Create_Context takes a reference type (Unit_Provider_Reference), exposing the interface derivation is not necessary and just brings confusion.

Third, the C, Python and OCaml APIs now provide the ability to create a project unit provider with a view narrowed to a sub-project (see the project project unit provider constructor argument). If no sub-project is specified, then the constructor fallbacks to the project partition strategy described above: when the loaded project tree contains inconsistent units (i.e. multiple unit providers would be required), an error is raised.

tn:

SA09-018

apis:

all

10.37. Unify naming of *primitive_subp* properties

BasicSubpDecl.primitive_subp_of is now named BasicSubpDecl.primitive_subp_types.

BasicSubpDecl.first_primitive_subp_of is now named BasicSubpDecl.primitive_subp_type.

tn:

SB28-029

apis:

all

10.38. Change the grammar of AcceptStmt and EntryBody

To simplify the matching of those with an EntryDecl, a new intermediate node, EntryCompletionFormalParams has been added, and contains the spec of entry completion parameters.

tn:

S918-035

apis:

all

10.39. Replace Name.p_referenced_id by Name.p_referenced_defining_name

referenced_defining_name doesn’t take any argument, and uses the result of referenced_decl on self.

Existing calls to self.referenced_id(self.referenced_decl) can just be replaced by self.referenced_defining_name.

Calls to self.referenced_id(other_decl) have no simple remplacement, but are considered non-important.

tn:

S828-005

apis:

all

10.40. Get rid of Name.p_xref

Its behavior is considered non intuitive, and is not properly documented, nor tested.

The workaround is to replace calls to p_xref by the equivalent set of navigation property calls, such as p_previous_part/p_next_part for declarations and bodies.

tn:

S821-025

apis:

all

10.41. Rename BasicDecl.p_is_unit_root into p_is_compilation_unit_root

To be closer to common Ada terminology, and disambiguate between compilation and analysis units.

tn:

S821-027

apis:

all

11. Libadalang API new features

11.1. Fixed lower bounds for array types and subtypes

This change adds support for the GNAT experimental feature allowing fixed lower bounds for array types and subtypes.

tn:

libadalang-1034

apis:

all

11.2. Add p_is_limited_type property

This new property returns whether the given BaseTypeDecl node is a limited type or not, either because it is explicitly marked as such, or because it inherits from a limited type or has a component of a limited type.

tn:

1106

apis:

all

11.3. Make BaseSubpSpec’s name property public

This allows retrieving the name of the subprogram from its specification without having to navigate to the subprogram decl itself first.

tn:

1078

apis:

all

11.5. Consider all Image attributes as calls

Until this change, attributes such as Integer'Image (X) were considered calls but not their short form X'Image. It is now the case.

tn:

1051

apis:

all

11.6. Add support for key expression in container aggregates

Libadalang now handles key expression used in the iterated element association of container aggregates. This change adds both parser and name resolution support. Container aggregate is an Ada 2022 feature, see ARM 4.3.5.

tn:

libadalang-1050

apis:

all

11.7. Analysis context constructor from GPR files

All public APIs have a new analysis context constructor, that initializes most context aspects (default charset, unit provider to resolve references to units, file reader for preprocessing, …) from GPR files:

  • in Ada: Libadalang.Analysis.Create_Context_From_Project;

  • in Python: libadalang.GPRproject.create_context.

tn:

libadalang-1043

apis:

all

11.8. Add is_scalar_type property

Added a new BaseTypeDecl.p_is_scalar_type property, that allows users to query whether a type is scalar or not.

tn:

libadalang-1042

apis:

all

11.9. SPARK Initial_Condition contract support

This change adds support for the SPARK contract Initial_Condition.

tn:

libadalang-1021

apis:

all

11.10. Allow Cuts in elsif statement part parser

Improve code completion capabilities by allowing Cuts in elsif statement parts parser.

tn:

libadalang-1014

apis:

all

11.11. Extending the static expression evaluator regarding string support

The static expression evaluator string support has been extended to handle ‘First, ‘Last, ‘Length, and ‘Pos attributes, as well as array indexing and slicing.

‘Pos attribute support has also been extended to all discrete type objects evaluation.

tn:

libadalang-974

apis:

all

11.12. Default charset detection from project file

New functions allow the detection of the default charset to use when decoding source files from a GPR (sub)project: Libadalang.Project_Provider.Default_Charset_From_Project in Ada, libadalang.GPRProject.default_charset in Python.

tn:

libadalang-969

apis:

all

11.13. Add support for ‘First_Valid and ‘Last_Valid

This change adds name resolution support for these two attributes, meaning these expressions will be typed to the subtype designated by the prefix of the attribute.

tn:

W313-022

apis:

all

11.14. Handle Iterable type for .. in iteration

This changes adds support to handle for .. in loop iteration scheme for types defined with the Iterable aspect.

tn:

W220-046

apis:

all

11.15. New Libadalang.Data_Decomposition package

This new package provides routines to decompose composite program data into elementary components, and more generally to query the representation of program data.

tn:

VC16-029

apis:

ada

11.16. New EnumLiteralDecl.p_enum_rep property

The new EnumLiteralDecl.p_enum_rep property returns the universal integer used to encode this enum literal. This is equivalent to GNAT’s Enum_Rep attribute.

tn:

W102-010

apis:

all

11.17. Add missing External_Tag attribute

This change adds support for External_Tag attribute.

tn:

VB09-042

apis:

all

11.18. Add missing attributes of floating point types

This change adds support for Denorm, Signed_Zeros, Model, Model_Emin, Unbiased_Rounding, and, Leading_Part missing attributes, as defined in the ARM, Section A.5.3, about the attributes of floating point types.

tn:

VB09-019

apis:

all

11.19. Add Ada_Node.Equals function

To work-around limitations in the design of our Ada API, a new Ada_Node.Equals function is introduced, meant to be used as an equivalence function in generic containers instantiations.

package Node_Sets is new Ada.Containers.Hashed_Sets
  (Element_Type        => Ada_Node,
   Hash                => Hash,
   Equivalent_Elements => Equals,
   "="                 => Equals);
tn:

U607-013

apis:

ada

11.20. Has_Same_Storage and Overlaps_Storage attributes support

This change adds support for the Has_Same_Storage and Overlaps_Storage attributes.

tn:

VA25-024

apis:

all

11.21. Safe_First and Safe_Last attributes support

This change adds support for the Safe_First and Safe_Last attributes.

tn:

VA25-027

apis:

all

11.22. Error messages from GPR project files

In the Python API, when using the GPRProject class, non-critical error messages emitted by LibGPR system when loading a project file are now by default printed on the standard error stream and are available with the GPRProject.errors property.

tn:

VA14-036

apis:

python

11.23. Support static evaluation of real exponentiation expression

This change adds real exponentiation support to the static expression evaluator - for example: 1.2 ** 3.

tn:

V913-022

apis:

all

11.24. Add name resolution support for Valid_Scalars

This change fixes a bug where name resolution would raise an exception when trying to resolve an expression making use of the Valid_Scalars attribute.

tn:

V831-017

apis:

all

11.25. New property to get the other part of a CompilationUnit

The introduced property Compilation_Unit.P_Other_Part, when called on a compilation unit of kind Unit_Specification, returns its corresponding body unit, and conversely.

tn:

V830-015

apis:

all

11.26. Improve AssignStmt expression completion

The p_complete property now promotes expressions that return a value when called on an AssignStmt expression.

tn:

V620-025

apis:

all

11.27. Preprocessing data extraction from GPR projects

Functions were introduced to create file readers that can preprocess source files based on preprocessor configuration found in GPR projects. In Ada, see the Extract_Preprocessor_Data_From_Project functions in the Libadalang.Preprocessing package; in Python, see the GPRProject.create_preprocessor method.

tn:

V708-022

apis:

all

11.28. Add p_most_visible_part property

Given a declaration and an origin node, this property returns the most most complete part of the declaration that the origin has visibility on according to Ada visibility rules.

tn:

V513-018

apis:

all

11.29. On-demand synthesis of character literals

Since we cannot add all existing character literals in the lexical environments due to their number (think about Wide_Wide_Character), a character literal that is not user defined was resolved to None. This new feature fixes this issue by synthesizing the required literal, on-demand.

tn:

V519-040

apis:

all

11.30. Add P_Is_Subaggregate property

This new property can be invoked on aggregate nodes and returns whether the aggregate actually corresponds to a multidimensional array subaggregate as per RM 4.3.3. Since subaggregates are special (they have no expected type nor actual type), this property can be used to detect them so as to treat them in a specific way.

tn:

V323-006

apis:

all

11.31. Introduce public/documented grammar rules

Thanks to new functions in the Langkit_Support.Generic_API and Langkit_Support.Generic_API.Introspection packages, it is now possible to query whether a grammar rule is “public”, the type of nodes it can create, as well as its documentation.

tn:

V425-014

apis:

all

11.32. Complete implementation of Base_Subp_Declarations

This change adds support for P_Base_Subp_Declarations on subprograms defined in protected types and task types, so that it takes into account subprograms coming from their parent interfaces. Note that this also fixes the behavior of P_Root_Subp_Declarations.

tn:

UA13-010

apis:

all

11.33. Support for Reduce attribute (Ada 2022)

This change adds support for the Reduce attribute introduced by the Ada 2022 standard revision.

tn:

V113-041

apis:

all

11.34. Configuration pragrmas handling

CompilationUnit nodes have new properties: P_All_Config_Pragmas and P_Config_Pragmas. They both allow one to query the list of configuration pragmas that apply to a given compilation unit. In order to use them, one needs to associate configuration pragmas files to analysis units thanks to the subprograms defined in the Libadalang.Config_Pragmas package first.

tn:

U624-007

apis:

ada

11.35. Add support for delta aggregate (Ada 2022)

This change adds support for delta aggregate introduced by the Ada 2022 standard revision.

tn:

V331-013

apis:

all

11.36. Improve error recovery for pragma parsing

This change improves error recovery when parsing incomplete pragma.

tn:

V422-003

apis:

all

11.37. Improve error recovery for extended return statement parsing

This change improves error recovery when parsing incomplete extended return statement.

tn:

S201-022

apis:

all

11.38. Add support for user-defined literals

This change adds support for Ada 2022 user-defined literals. In particular, Libadalang name resolution used to fail on expressions expecting a type defining an Integer_Literal, Real_Literal or String_Literal aspect but for which an integer literal, real literal or string literal was given, respectively.

tn:

V112-030

apis:

all

11.39. Improve error recovery for generic instantiation parsing

This change improves error recovery when parsing incomplete generic instantiation.

tn:

V331-006

apis:

all

11.40. Expected type information in name resolution

Until now, users have been able to query the type of Ada expressions with Libadalang using the P_Expression_Type property. However, the semantics of that proprety where not clearly defined and would sometimes return the expected type of an expression, and sometimes its actual type. This change fixes this issue by providing a new property P_Expected_Expression_Type which can be used to query the expected type of an Ada expression, and by making sure that P_Expression_Type always returns the actual type of the expression. Consider the following snippet of Ada code:

procedure Foo (X : Integer) is null;

...

Foo (2);
--   ^

Calling P_Expression_Type on the node representing 2 will return universal_int_type like it previously did. However invoking the new P_Expected_Expression_Type property on that node will return Integer.

Note that existing user code that uses name resolution may be affected by this change, even code that didn’t use P_Expression_Type. This is because the whole internal name resolution mechanism was reworked to work with both the expected type and actual type information. The overall impact should be positive, in particular with respect to timeouts.

tn:

T218-019

apis:

all

11.41. GNAT.Regexp support in Libadalang.Auto_Provider

Libadalang.Auto_Provider now has a Find_Files_Regexp function. It works eactly like the existing Find_Files function, but takes a GNAT.Regexp.Regexp pattern instead of a GNAT.Regpat.Pattern_Matcher one.

tn:

V307-008

apis:

ada

11.42. Attributes Machine and Abort_Signal

This change adds support for the 'Machine and the 'Abort_Signal attributes which are used in the GNAT runtime but were not resolved by LAL.

tn:

V224-025

apis:

all

11.43. Support for GNATprep-compatible preprocessing

Libadalang now embeds an integrated preprocessor. This makes it possible to transparently use Libadalang services (parsing, navigation, name resolution, etc.) on a project that contains preprocessing directives/symbols.

Ada API users can enable the integrated preprocessor thanks to the Libadalang.Preprocessing package, and Python API users can enable it using the libadalang.FileReader.create_preprocessor_from_file function.

Please refer to the User Manual for more information.

tn:

V117-037

apis:

all

11.44. Add a P_Enclosing_Compilation_Unit property

When invoked a node, returns the compilation unit in which the node belongs. This is different from Unit which returns the corresponding Analysis unit, because there may be several compilation units defined in the same analysis unit.

tn:

V111-050

apis:

all

New properties for associating formal parameters to actual or default expressions. ==================================================================================

Add the new properties Name.call_params, GenericInstantiation.inst_params, BaseAggregate.aggregate_params, SubtypeIndication.subtype_constraints, and EnumRepClause.params. Those properties, when called on a Name denoting a call expression, a generic instantiation, an aggregate, a subtype discriminants list, or an enum representation clause, return an array of parameter-expression pair (the ParamActual struct is used to hold this pair of DefiningName and Expr nodes). They return all the parameters of the function (or generic instantiation/aggregate/discriminants list), even those that are not provided explicitly by the call (the generic instantiation, or the discriminants list). In that case, the expression associated with that parameter is the default expression defined by the function, generic or discriminants specification.

tn:

T622-004

apis:

all

11.45. New property to query the kind of a CallExpr

Add a new property CallExpr.kind to query the kind of a CallExpr (call, array slice, array index, or type conversion). It returns a CallExprKind enum value.

tn:

UC22-030

apis:

all

11.46. Access definition for loop param subtype indication

As stated by the 2022 Ada standard revision, this new feature adds support for access definition in loop parameter subtype indication.

tn:

V104-011

apis:

all

11.47. Most declarations allows aspect specifications

As stated by the 2022 Ada standard revision, this new feature allows aspect specifications on most declarations. It concerns extended return object declarations, discriminant specifications, and entry index specifications.

tn:

V112-052

apis:

all

11.48. Add support for Stable_Properties aspect

This change adds support for the Stable_Properties aspect introduced in Ada 2022.

tn:

V106-012

apis:

all

11.49. Make subtype_mark optional in object renames

The subtype_mark in object renaming declarations is made optional as per AI12-0275 (Ada 2022 feature). To achieve this goal, a new node type has been introduced: NoTypeObjectRenamingDecl, derived from ObjectDecl, it allows to create such an object without type expression.

tn:

UC08-034

apis:

all

11.50. Add p_is_constant* properties.

The properties p_is_constant_object and p_is_constant, when called on an object for the former, and a name for the latter, return whether the object is constant or not.

tn:

U330-040

apis:

all

11.51. Iterator filter support (Ada 2022)

Add support for the iterator filter feature introduced in Ada 2022.

tn:

UB16-009

apis:

all

11.52. Index attribute support (Ada 2022)

Add support for the ‘Index attribute which can be used on a precondition or postcondition expression for an entry family.

tn:

UC02-026

apis:

all

11.53. Add BaseFormalParamHolder.formal_params property

This new property allows the user to get a flat list of parameters (as a DefiningName array), no matter they are declared in the same parameter specification (i.e. packed) or not. When called on a record component list, this property doesn’t return variants nor discriminants.

tn:

T930-043

apis:

all

11.54. Add various grammar rules

We have introduced additional grammar rules to parse partial Ada sources (Libadalang.Common.*_Rule in the Ada API and libadalang.GrammarRule.*_rule in the Python API):

  • while loop specs (while X): While_Loop_Spec_Rule;

  • elsif X then parts in if statements: Elsif_Part_Rule.

tn:

UB17-030

apis:

all

11.55. Source location information for decoding errors

The diagnostic that is emitted for source decoding errors (for instance “Could not decode source as UTF-8”) used to have no source location information, making it hard for Libadalang users to locate where the invalid sequence of bytes is in the source. This diagnostic now is associated to the source location corresponding to the place where source decoding stopped.

tn:

UB12-067

apis:

all

11.56. Add property EntryDecl.p_accept_stmts

When invoked on a task entry declaration, this property returns the array of all its corresponding accept statements.

tn:

S916-015

apis:

all

11.57. Synthesize predefined operators

This work introduces synthesized operators in Libadalang’s lexical scopes, so as to make them available for its name resolution mechanism. This enables resolution of direct references to operators (e.g. Standard."+") used in generic instantiations, subprogram renamings, etc. However, these are not used for resolution of arbitrary binary or unary operations yet.

tn:

UB16-053

apis:

all

11.58. Add P_Get_Formal on AnonymousExprDecl

This adds the P_Get_Formal property on AnonymousExprDecl nodes so that it’s now possible to navigate from the actual value to the formal object in a generic instantiation context.

tn:

UB02-022

apis:

all

11.59. Name resolution for Contract_Cases aspect

This change adds name resolution support for the Contract_Cases aspect which can come in two shapes: as an Ada 2012 aspect, or inside a pragma.

tn:

U928-030

apis:

all

11.60. Name resolution support for Put_Image attribute

This change adds name resolution support for the Ada 2020 Put_Image attribute. In particular, if the attribute is explicitly defined on a type Foo_Type through an aspect specifcation or attribute definition clause, the Put_Image identifier in an expression Foo_Type'Put_Image (...) will correctly reference the subprogram given to the aspect.

tn:

U928-032

apis:

all

11.61. Add P_Corresponding_Entry on AcceptStmt

This change adds a new property named P_Corresponding_Entry on accept statement nodes, which returns the entry associated with it.

tn:

U914-019

apis:

all

11.62. Add support for the To_Address attribute

This change adds name resolution support for the System'To_Address attribute, which resolves to the To_Address subprogram declaration in System.Storage_Elements.

tn:

U914-010

apis:

all

11.63. Implement 'Val attribute evaluation

This change improves LAL’s static expression evaluator to handle the 'Val attribute on discrete types.

tn:

U607-020

apis:

all

11.64. Name resolution for pre/post/test_case pragmas

This change adds name resolution support for the pragmas Pre, Post, their 'Class variants, and Test_Case.

tn:

T724-021

apis:

all

11.65. Add Ada_Node.First_Child/Last_Child methods

Add Ada_Node.First_Child/Last_Child methods, as a shortcut for Node.Child (Node.First_Child_Index) and Node.Child (Node.Last_Child_Index)

tn:

U426-008

apis:

ada

11.66. Enhance expr evaluator with relation operators

This change enhances Libadalang’s expression evaluator such that it can now evaluate expression containing relation operators (=, /=, <, <=, >, >=) on all supported types. Note that only = and /= are supported on enum and string values.

tn:

U813-022

apis:

all

11.67. Add support for “at clauses” in P_Get_Aspect

This change adds support for the Ada 83 “at clause” construct in P_Get_Aspect, as this construct can be used to define the Address aspect on an object. Thus, if the clause for X use at E; appears in the declarative scope of X, calling P_Get_Aspect("Address") on the declaration of X will return it.

This change also adds the P_Get_At_clause property which, given a declaration, returns the “at clause” defined for it if it exists.

tn:

U803-023

apis:

all

11.68. Name resolution support for Standard'Storage_Unit

This change adds name resolution support for the Storage_Unit attribute so that it correctly types to universal integer.

tn:

U804-008

apis:

all

11.69. Implement is_interface_type on classwide types

Previously, is_interface_type would always return false when called on classwide type decls. It now forwards the query to the underlying type in order to be more user-friendly.

tn:

U706-023

apis:

all

11.70. Support for Fixed_Value & Integer_Value

This change adds name resolution support for two the GNAT-specific Fixed_Value and Integer_Value attributes. Statements containing occurrences of those attributes should now resolve correctly.

tn:

U623-002

apis:

all

11.71. Add P_Has_Restriction property

This property allows querying whether a CompilationUnit is subject to a particular restriction, given its name.

tn:

U617-016

apis:

all

11.72. Add p_get_uninstantiated_node property

This new property allows one to navigate from a node coming from an instantiated generic declaration back to its non-instantiated counterpart.

tn:

U507-029

apis:

all

11.73. Generalize p_canonical_text to Name nodes

So far, p_canonical_text was only available on names made of a single token (e.g. Identifier). This change generalizes the implementation to work on simple names (Identifier, DottedName and DefiningName).

tn:

U428-008

apis:

all

11.75. Introduce P_All_Parts property

This property will return all parts of the given entity. For example, when called on a subprogram, it will return its spec, body stub and body, as long as any of these is defined.

tn:

U331-033

apis:

all

11.76. Name resolution for the Update attribute

This change adds name resolution support for the Update attribute, which was previously completely ignored. This means that associations in the aggregate argument are now fully resolved.

tn:

U212-043

apis:

all

11.77. Raise Precondition_Failure exceptions on null arguments

Subprograms in the Ada API now raise Precondition_Failure exceptions when provided null arguments when that is invalid. Previously, the lack of defensive code to raise an exception let built-in Ada checks raise Constraint_Error execptions, which made it harder for users to distinguish invalid uses of Libadalang from Libadalang bugs.

tn:

T707-050

apis:

ada

11.78. Handle renaming clauses in Find_All_* queries

This change adds an optional Through_Renamings parameter to Find_All_References and Find_All_Calls properties, which when set to True will make sure the results of those queries includes references or calls made to entities that rename the original entity (with renaming chains of arbitrary length).

tn:

TB19-024

apis:

all

11.79. Improve Zip_With_Params with formal subps

This change improves the behavior of the Zip_With_Params property when invoked on a generic instantiation in which there are formal subprograms with default values (box expression or explicit name), by matching those with the effectively passed subprogram actuals.

tn:

T717-018

apis:

all

11.80. Allow P_Is_Dispatching_Call on UnOp and Binop

This adds support for the P_Is_Dispatching_Call property on unary and binary operation nodes, as those can also be dynamically dispatching calls. There was no way to compute this information easily previously.

tn:

TB05-025

apis:

all

11.81. Add a SubtypeDecl.get_type property

This new property returns the type of a given subtype decl.

tn:

TB03-026

apis:

all

11.82. Add project file helpers to Libadalang.Helpers

Add Helpers.Load_Project`, ``Helpers.Project_To_Provider, Helpers.List_Sources_From_Project, subprograms to help handling project files in Libadalang applications when needed outside of the context of a command line application based upon Libadalang.Helpers.App.

tn:

TB03-028

apis:

all

11.83. Attributes “Model_Small”, “Delta” and “Caller”.

This change adds name resolution support for the Model_Small floating-point attribute, the Delta fixed-point attribute and the Caller entry attribute.

tn:

T907-012

apis:

all

11.84. Resolve object formals of generic subprograms

This change brings navigation support for generic formal objects of generic subprograms, whereas they were previously only supported on generic packages.

tn:

TA01-045

apis:

all

11.85. Add is_inherited_primitive property

Given a type and a primitive of this type, this property returns true if the primitive is inherited.

tn:

T922-025

apis:

ada, python, ocaml

11.86. Handle the Enum_Val attribute

This adds name resolution support for the Enum_Val attribute, meaning instances should now resolve to the correct expected type.

tn:

T917-026

apis:

all

11.87. Handle Asm_Input/Asm_Output attributes

This adds name resolution support for those two attributes, so that they should now resolve to the correct expected types.

tn:

T917-025

apis:

all

11.88. Resolve references to implicitly derived /=

Until now, references of /= to the subprogram implicitly derived from a user defined = operator would never be resolved, as such subprograms do not exist in the sources. From now on, those will resolve to the user defined = operator.

tn:

T217-006

apis:

all

11.89. New BodyStub.p_syntactic_fully_qualified_name property

The new BodyStub.p_syntactic_fully_qualified_name property allows one to query the name of a body stub purely based on the syntax. Unlike BasicDecl.p_fully_qualified_name, this does not populate lexical environments, and so is more efficient for this restricted use case.

tn:

T827-012

apis:

all

11.90. Static evaluation of string expressions

Add the possibility of evaluating static expressions as strings to the static evaluator.

tn:

T720-014

apis:

ada, python, ocaml

11.91. New abstract class CondExpr

We introduce a new abstract base class, CondExpr, from which IfExpr and CaseExpr derive, to map to the Ada Reference Manual notion of conditional expression. It exposes one property, P_Dependent_Expressions, which returns the list of dependent expressions.

tn:

T803-022

apis:

all

11.92. Add Expr.P_Is_Dynamically_Tagged property

We introduce a new property, P_Is_Dynamically_Tagged, which will return whether an expression is dynamically tagged or not.

tn:

T709-021

apis:

ada

11.93. Implement navigation on entries

It is now possible to call p_body_part on an entry declaration to retrieve its body, and likewise to call p_decl_part on an entry body to retrieve its declaration.

tn:

T706-023

apis:

all

11.94. Add p_private_part_decl property

The current p_public_part_decl property allows one to retrieve the public declaration of a given constant object declaration from its private view. However, there was no equivalent property for the other way around. This adds the p_private_part_decl property, which can be called on the public declaration of a constant object in order to retrieve its completion in the private part.

tn:

T729-020

apis:

all

11.95. Implement name resolution for Test_Case aspect

Names and types inside a Test_Case aspect, in particular in the right-hand side of the Requires and Ensures associations are now resolved as expected.

tn:

T722-027

apis:

all

11.96. Add xref for stream attributes references

From now on, stream attributes in stream attribute references such as in R'Output (S, X) resolve to the declaration of the subprogram used as override for the corresponding attribute, if it has been set with the appropriate attribute def clause. Otherwise, it still resolves to None, indicating that the attribute has not been overridden.

tn:

T716-015

apis:

all

11.97. Name resolution for task and entry attributes

This adds name resolution support for entry attribute 'Count and task attributes 'Terminated.

tn:

T703-010

apis:

all

11.98. New Origin_Filename and Origin_Charset functions

The Libadalang.Common packages defines two new primitives for Token_Reference. The Origin_Filename function returns the name of the file from which the token was extracted, or an empty string if it comes from a memory buffer. The Origin_Charset function returns the name of the encoding used to decode the source buffer from which the token was extracted, or an empty string if the source buffer was already decoded.

tn:

T622-003

apis:

ada

11.99. Expose p_discriminants_list property

This property can be called on any type and will return the list of its discriminants.

tn:

T527-038

apis:

all

11.100. Handle -j0 in the App framework

The App framework (in Libadalang.Helpers) defines a --jobs/-j command-line argument, taking a positive number of jobs to create. This argument nows also accepts zero, to create one job per CPU.

tn:

T217-005

apis:

all

11.101. Add P_Shapes property

This property, when called on the ComponentList of a record definition, will return the list of all possible shapes that a record value of this type can take. Consider the following record definition:

type R (A : Integer; B : Integer) is record
   X : Integer;
   case A is
      when 1 .. 10 =>
         Y_1 : Integer;
         case B is
            when 1 .. 10 =>
               Z_1 : Integer;
            when others => null;
         end case;
      when 11 .. 20 =>
         Y_2 : Integer;
         case B is
            when 1 .. 10 =>
               Z_2 : Integer;
            when others => null;
         end case;
      when others => null;
   end case;
end record;

For this instance, this property will return the following results:

[
    [X, Y_1, Z_1],
    [X, Y_1],
    [X, Y_2, Z_2],
    [X, Y_2],
    [X]
]
tn:

T406-026

apis:

all

11.102. More frequent precise element type in field docs

Up to now, the documentation for node fields that contain list nodes could already include the list of precise types for list elements. For instance, the documentation of the AbortStmt.f_names field, which contains “a list of Names” was:

This field contains a list that itself contains one of the following
nodes:

* Attribute_Ref

* Call_Expr

* ...

While this precise type information is useful, it was not always present. For instance, the GenericSubpInstantiation.f_params field, which contains AssocList nodes, i.e. lists of BasicAssoc nodes, was lacking a documentation that states that these AssocList nodes actually contain only ParamAssoc nodes. This oversight is now fixed, so this information is now in all documentations, where useful.

tn:

T116-038

apis:

all

11.103. Handle others designator in zip_with_params

So far, zip_with_params would completely leave out the others designator in an assoc list, not providing any binding for it in the resulting array. Now, it will return one additional binding per unmatched parameter, from that parameter to the expression associated to others.

tn:

T331-026

apis:

all

11.104. Add failsafe referenced_decl/name properties

Add Name.failsafe_referenced_decl and Name.failsafe_referenced_def_name properties. Those properties act like their non failsafe counterpart, except that they’ll never raise an exception, and they will track in the result whether it was found through precise or imprecise resolution.

Note that for most purposes, those are purely better version of referenced_decl` and referenced_defining_name, should be used in priority, and might replace those in a future version of LAL.

tn:

T402-020

apis:

all

11.105. Resolve generic formal objects

When analyzing generic code from an instantiation, libadalang’s name resolution mechanism now resolves references to generic formal objects to their actual wrapped in a synthetic object declaration, instead of resolving to the declaration of the formal. Take for example:

generic
    X : Integer;
package Foo_G is
    type T is range 1 .. X;
end Foo_G;

package Foo_10 is new Foo_G (X => 10);
subtype U is Foo_10.T;

By calling P_Designated_Type_Decl on node Foo_10.T, you will reach type T is range 1 .. X. Previously, calling P_Referenced_Decl on X, would return the declaration X : Integer from the generic formal part.

Now, it will instead generate a new object decl which contains the expression of the actual used for X, which would be 10 here, thus allowing users to reflect upon the value used in the instantiation.

Thanks to this, the static expression evaluator can now correctly evaluate static expressions inside generic code that refer to static formal objects. As such, calling P_Eval_As_Int on X taken from above will now correctly yield 10 instead of an error.

tn:

T103-024

apis:

all

11.106. Add p_valid_keywords property

When called on any node, This property will return the list of keywords that are admissible at the location of the node.

Note

This is work in progress. It will return all keywords for now, without looking at the context.

tn:

T318-063

apis:

all

11.107. Add p_is_visible property

This property can be called on a BasicDecl to determine if this declaration is visible from the point of view of a given node.

Attention

Only package-level (public or private) declarations are supported for now.

tn:

T212-032

apis:

all

11.108. Preserve casing in fully_qualified_name output

So far, the p_fully_qualified_name would always output the fully qualified name as a string in lower case. This fixes it by reusing the casing of the names that compose the fully qualified name as they appear in the source code.

tn:

T303-005

apis:

all

11.109. Handle membership expr in static evaluator

This adds support for Ada’s membership expression evaluation in libadalang’s static expression evaluator.

tn:

T312-016

apis:

all

11.110. Handle type’s static predicates in nameres

Until now, the name resolution mechanism would not take into account static predicates defined on a type when it should, for example to infer which variant of a record is being initialized by an aggregate, where the case conditions are types with static predicates.

tn:

SC11-029

apis:

all

11.111. Resolve task types’ parent interfaces names

Previously, interface names appearing in the parent list of a task type or a protected type would not be resolved at all, which means cross references where not available on those names. This change fixes that.

tn:

TB28-002

apis:

all

11.112. Add a root_type property

When called on a base type declaration, this property returns the root of the derivation hierarchy.

tn:

T205-043

apis:

all

11.113. Add p_is_interface_type property

Add a p_is_interface_type property on BaseTypeDecl nodes. It returns whether the given type corresponds to an interface type.

tn:

SB13-036

apis:

all

11.114. Add p_is_ghost_code property

Add a p_is_ghost_code property on Stmt, BasicDecl and Pragma nodes. It returns whether the given node is considered ghost code per the SPARK reference manual (6.9).

tn:

U902-020

apis:

all

11.115. Add properties for computing unit dependencies

This change adds three new properties that are about computing the set of units upon with a given one depends.

  • P_Withed_Units returns the set of units that are “with”ed by the given unit.

  • P_Imported_Units returns the set of units that are directly imported by the given unit, which the set of “with”ed units along with the parent unit in case it’s a child unit, etc.

  • P_Unit_Dependencies is like P_Imported_Units but includes transitive dependencies, effectively returning the whole closure of units which the given one depends upon.

tn:

S912-013

apis:

all

11.116. Add built-in AdaNode.full_sloc_image

A new built-in method has been added on nodes, full_sloc_image. It will return a GNU conformant source location in the format file:line:column:, to make it easier to build diagnostics from nodes.

tn:

T102-018

apis:

all

11.117. Add node iterator predicate Kind_In

The new Kind_In node predicate in the Libadalang.Iterators API allows one to filter nodes whose kind is in a given range. This makes it easy to look for nodes that derive from an abstract type.

For instance, the following iterator will return all nodes that derive from Basic_Decl:

Find (Root, Kind_In (Ada_Basic_Decl'First, Ada_Basic_Decl'Last));
tn:

SC19-006

apis:

ada

11.118. Add property p_get_enum_representation_clause

Add the p_get_enum_representation_clause property on BaseTypeDecl, which will return the EnumRepClause associated to the given type if that type designates an enum declaration and such a representation clause exists.

tn:

SC16-020

apis:

all

11.119. Add a base_subp_declarations property

When called on a given subprogram, this property returns a list of all subprograms which are overriden by the given subprogram.

tn:

SC05-029

apis:

all

11.120. Add Python3 compatibility

The Python binding is now compatible with Python3.

tn:

SB13-026

apis:

all

11.121. Implement SingleTokNode.canonical_text

Return the text of a single token node, but canonicalized, e.g. case folded and with GNAT brackets encoding decoded.

tn:

SB28-013

apis:

all

11.122. Introduce BasicSubpDecl.primitive_subp_tagged_type

Introduce a new property, BasicSubpDecl.primitive_subp_tagged_type, that returns the tagged type of which the subprogram is a primitive of, if applicable.

tn:

SB13-037

apis:

all

11.123. More helpful error message for As_* node converters

As_* node conversion functions raise a Constraint_Error when the input value does not fit in the output type. The message attached to this exception has been enhanced to contain input/output type information and mention Libadalang, so that it is easier to investigate complex code raising such Constraint_Error exceptions.

tn:

SB28-011

apis:

ada

11.124. Add a Name.is_operator_name property

The new Name.is_operator_name property returns whether a given name designates an operator.

tn:

SB13-032

apis:

all

11.125. Add a command line app framework for Ada API

Add a new package Libadalang.Helpers, with a generic package App, that allows users to easily create command line applications with default features such as automatic project handling/scenario variables handling. Learn more in Libadalang’s Ada tutorial, or Ada API doc.

tn:

SB06-030

apis:

ada

11.126. Add a p_is_array_slice property

Add a p_is_array_slice property, which tells whether the given CallExpr represents an array slice.

tn:

SA31-049

apis:

all

11.127. Add several utility properties on BaseTypeDecl

Those properties include several predicates, allowing to transparently query aspects of a type, without caring about it’s syntactic/semantic aspects:

  • p_is_record_type returns whether the type is a record type.

  • p_is_char_type returns whether the type is a Character type.

  • p_is_tagged_type returns whether the type is a tagged type.

  • p_is_enum_type returns whether the type is an enum type.

Also included is p_base_types which will return all the base types of a tagged type.

Note that all those properties take an origin optional parameter, which will be used to determine the view that is available to you on the type. By default, the view is from the node you query.

Some existing properties (p_is_float_type and p_is_fixed_point) now take an origin parameter. That means that, in the Python API at least, you now need to put parentheses when you call them:

# Before:
typ.p_is_float_type

# After:
typ.p_is_float_type
typ.p_is_float_type(origin=typ)
tn:

S923-017

apis:

all

11.128. Improved handling of aggregate projects

Until now, project unit providers used to reject all aggregate projects. This is impractical as it is not always possible to load directly aggregated projects. Hence, the goal of this enhancement is to enable Libadalang users to load aggregate projects as long as we can guarantee non-ambiguous resolution of dependencies.

The project unit provider in all APIs now accepts aggregate projects as long as there is only one aggregated project.

Additionally, the project unit provider in the Ada API (Libadalang.Project_Provider) provides two additional constructors (Create_Project_Unit_Provider and Create_Project_Unit_Provider_Reference) which take any project tree (including all aggregate ones) plus one non-aggregate project in that tree. The project provider will then consider only this sub-project to resolve dependencies unambiguously.

tn:

S815-010

apis:

all

11.129. Add a BasicDecl.p_is_formal property

This new property retruns whether a declaration is the nested declaration inside a GenericFormal node.

Given the following Ada code:

generic
   type T is private;
package T is end T;

You’ll get the following output:

>>> u.root.find(lal.TypeDecl).p_is_formal
True

# GenericFormals are not the nested declaration, so it will return false
>>> u.root.find(lal.GenericFormal).p_is_formal
False
tn:

S905-012

apis:

all

11.130. Add a BasicDecl.p_is_preelaborable property

This new property returns whether a declaration is preelaborable. See ARM 10.2.1 for more details.

tn:

S128-004

apis:

all

11.131. Add property BaseTypeDecl.p_discrete_range

Add a property, BaseTypeDecl.p_discrete_range

tn:

SC05-015

apis:

all

12. Libadalang API bug fixes

12.1. Support pragmas in declare expressions

This Ada 2022 feature was not supported by libadalang. Pragmas can now be used in declare expressions as specified by AI22-0045.

tn:

libadalang-1130

apis:

all

12.2. Fix parsing of concatenation expression

This change fixes a bug in the libadalang parser to correctly handle all forms of concatenation expression. In particular, the parser was not able to parse a binary operation as a valid concatenation operand.

tn:

libadalang-1104

apis:

all

12.3. Fix nameres of conditional expressions

This change addresses an issue where name resolution was previously unable to resolve the type of an expression involving a conditional expression (such as an if-expression or case-expression), when the expected type of the conditional expression could not be deduced from the context but had to be inferred from one of the branches of the conditional, as in:

Libadalang is now able to propagate the type of C appearing in the then-branch in order to know which comparison operator is being referred to.

tn:

989

apis:

all

12.4. Support implicit dereference of access attributes

This change fixes a bug where implicit dereferences of access attributes as in X'Unrestricted_Access.Foo (2) were not properly resolved, which could cause property errors to be raised during name resolution.

tn:

1004

apis:

all

12.5. Fix private-with visibility in child units

This change fixes a bug where child units were previously assumed to always have view on private with clauses of their parent unit, which is not the case in their public part. This could cause name resolution to incorrectly resolve names to entities that were not supposed to be visible.

tn:

1030

apis:

all

12.6. Fix is_ghost_code on instantiated generics

This change fixes a bug where the is_ghost_code property would return False when called on an instantiated generic declaration when it was the instantiation itself that was ghost while the generic declaration was not.

tn:

1068

apis:

all

12.7. Fix pragma Warnings name resolution

This change fixes a name resolution bug for the pragma Warnings by not trying to resolve reserved words such as On, Off, GNAT or GNATprove.

tn:

libadalang-1069

apis:

all

12.8. Fix p_fully_qualified_name on generic decls

This change fixes a discrepancy in the behavior of p_fully_qualified_name (and other properties relying on it such as p_unique_identifying_name) where applying it to a GenericDecl node in the context of an instantiation would return the fully qualified name of the generic declaration itself instead of that of the instantiation, whereas calling it on the GenericSubpInternal or GenericPackageInternal nodes (as returned by p_designated_subp for example) would return that of the instantiation.

We decided to make both return that of the instantiation. The non-instantiated name can be returned by first applying the p_get_uninstantiated_node property on the given node.

tn:

1052

apis:

all

12.9. Fix BaseSubpBody environment construction

This change fixes a name resolution bug where some dotted names in a subprogram body were not resolved because the formals part of its corresponding generic declaration was not included in the given body environment.

tn:

libadalang-1060

apis:

all

12.10. Fix IfExpr expressions name resolution

This change fixes a bug where name resolution of some IfExpr then/elsif/else expressions were failing due to the solver testing unsuitable candidates (i.e. subprogram that does not return).

tn:

libadalang-1061

apis:

all

12.11. Fix primitive name resolution for private type with tagged completion

This change fixes a bug where Libadalang was not able to resolve a call using dot notation when the primitive type is private and only the private completion is tagged.

tn:

libadalang-1005

apis:

all

12.12. Fix support for container aggregates

Libadalang now correctly handles name resolution for container aggregates. Container aggregate is an Ada 2022 feature, see ARM 4.3.5.

tn:

libadalang-1046

apis:

all

12.13. Support type predicates self-reference

This change fixes name resolution for type predicates such as in:

procedure Test is
  function F (S : String) return Boolean is (True);

  subtype String_T is String (1 .. 99) with
     Dynamic_Predicate => F (String_T (1 .. 90));
  begin
     null;
  end Test;

where the resolution of the String_T object used in the predicate check was not correctly resolved.

tn:

libadalang-958

apis:

all

12.14. Fix GenericPackageDecl` environment construction

This change fixes a name resolution bug where some dotted names in a generic package declaration were not resolved because its formals part was not included in the given name environment.

tn:

libadalang-986

apis:

all

12.15. Precondition failure with Decl_Defines

Libadalang.Iterators.Decl_Defines predicate used to trigger a precondition failure when evaluated on an Anonymous_Type_Decl node. This is now fixed.

tn:

libadalang-1012

apis:

all

12.16. Fix name resolution of Subunit’s name

This change fixes a bug where Subunit names were not properly resolved by name resolution. All the prefixed names in a subunit name are now correctly referenced.

tn:

libadalang-1006

apis:

all

12.17. Fix GenericInstantiation formals name resolution

This change fixes a bug where GenericInstantiation formals were not properly resolved by name resolution. The reference for incomplete type declarations and generic package instantiations formals is now correctly computed.

tn:

libadalang-998

apis:

all

12.18. Various pragma support improvements

This change improves the aspect/pragma support by correctly handling pragmas associated to components and to enum literals.

Consequently, Libadalang now correctly supports the Independent and Obsolescent (implementation-defined) pragmas.

tn:

libadalang-1001

apis:

all

12.19. Usage of GPR source directories for preprocessing

Libadalang.Preprocessing.Extract_Preprocessor_Data_From_Project used to look for preprocessor data files relative to GPR object directories only. However, when the GPRbuild -x option is present, these files should also be searched in source directories: this is now fixed.

tn:

libadalang-984

apis:

all

12.20. Fix visibility issues with order of decls for stubs

Libadalang’s name resolution now considers that declarations which appear after a subunit stub are not visible inside the corresponding subunit body.

tn:

libadalang-947

apis:

all

12.22. Fix nameres of dot-calls when target is a subp body

There was missing constraints in name resolution that could lead dotted calls to mis-resolve if they were referencing subprogram bodies rather than subprogram declarations. This is now fixed.

tn:

libadalang-953

apis:

all

12.23. Nameres array indexing after access-to-function call

This change fixes a bug where name resolution would fail on expressions involving an array indexing when the array is the result of a call to an access-to-subprogram object, as illustrated by the following example:

type Arr is array (Positive range <>) of Integer;

function Bar
  (F : access function (X : Positive) return Arr) return Integer
is
begin
   return F (2) (1); --  name resolution failure here
end Bar;
tn:

W324-009

apis:

all

12.24. Fix nameres of array concats without expected type

This change fixes a bug where Libadalang could fail to resolve an array concatenation expression in a context where no type is expected, such as the expression inside a type conversion: X: String := String (A & 'b' & C);. The failure used to occur in particular when one of the operands of the concatenation was a subtype of the other.

tn:

W313-040

apis:

all

12.25. Improve performance of sequenced dot calls

This change implements an optimization inside the name resolution mechanism to avoid unnecessary computations when resolving a call with the dot notation. While unnoticeable on small sequences, chaining dozens of them could rapidly become abnormally slow. It should now behave about the same as calls done without the dot notation.

tn:

W302-009

apis:

all

12.26. Fix visibility issue in instantiations actuals

This change fixes a bug where non-visible entities could be considered as legit candidates when resolving the actual of a generic instantiation, potentially causing wrong name resolution results, or even property errors.

tn:

W221-019

apis:

all

12.27. Fix p_get_aspect to take inherited aspect into account

This change fixes an issue where p_get_aspect could return an invalid result by missing inherited aspects. For example, derived or subtype declarations should also consider aspects of their corresponding root type declaration.

tn:

W214-017

apis:

all

12.28. Visibility of child instantiations on their parent

This change fixes a bug where child package or subprogram instantiations would not have correct visibility on their parent if their parent was a package instantiation itself. Consider the following package declarations:

-- pkg_g.ads
generic package Pkg_G is end Pkg_G;

-- pkg_g-child_g.ads
generic package Pkg_G.Child_G is end Pkg_G.Child_G;

-- my_pkg.ads
package My_Pkg is new Pkg_G;

-- my_pkg-my_child.ads
package My_Pkg.My_Child is new Child_G;

Libadalang previously failed to resolve the last instantiation because it did not have visibility on Child_G. (Note however that it correctly resolved it if Child_G was qualified with My_Pkg.Child_G).

tn:

W127-008

apis:

all

12.29. Fix visibility rules inside component decls

This change fixes an issue caused by the previous visibility rules inside component decls being too permissive. For example in the snippet below:

type Rec is record
    Set : access Set.T;
end record;

Libadalang used to be confused when resolving the reference to Set because of the enclosing component having the same name, causing infinite recursions leading to stack overflows. This change fixes that issue by discarding the enclosing component when looking up names from one of its child nodes.

tn:

W126-014

apis:

all

12.30. Handle for Switches ("Ada") in preprocessing

Libadalang was not considering preprocessing directives put inside for Switches ("Ada") attributes of the project file. Those directives are now read.

tn:

W125-022

apis:

all

12.31. Take private visibility into account

This change fixes a bug where private with clauses were previously not considered any different than their non-private counterpart. This could cause ambiguities in some scenarios, such as in:

with A.Foo;
private with B.Foo;

package A.Test is
    use B;

    X : Foo.T;
private
    ...
end A.Test;

In the above code, the identifier Foo in the declaration of X necessarily references A.Foo, because B.Foo is not yet “with”ed. Previously, Libadalang would sometimes resolve to the incorrect package because it would incorrectly consider B.Foo to be visible.

tn:

W111-018

apis:

all

12.32. Nameres taft amendment types in generic contexts

This change fixes a bug where a Taft-amendment type could in certain cases not be resolved to its completion but to its incomplete view. In turn, an expression involving a taft-amendment type (for example X.Field where X’s type is a taft-amendment record type with a component Field) might not be resolved properly because of the incomplete knowledge about that type (in the example, because Libadalang might not see the component Field).

tn:

VC14-009

apis:

all

12.33. Fix object decl navigation in instantiated packages

This change fixes a bug where calling P_Next_Part_For_Decl or P_Previous_Part_For_Decl on an ObjectDecl inside an instantiated generic package would return the correct node but would lose the information about the current instantiation. Thus, further queries on the package would not return the expected results.

tn:

VC14-031

apis:

all

12.34. Fix P_Fully_Qualified_Name on formal decls

On the following snippet:

generic
    Obj : Integer;
package Pkg is
end Pkg;

package My_Pkg is new Pkg (1);

Navigating inside My_Pkg through the instantiation of Pkg and querying the fully qualified name of Obj used to return Pkg.Obj, not taking into account the generic context. It now returns My_Pkg.Obj. Note that in this example Ada does not allow accessing My_Pkg.Obj from the enclosing package, however there are certain scenarios in which this is allowed (e.g. with generic formal packages) and therefore the old behavior would return invalid results for those legal cases.

tn:

VC02-024

apis:

all

12.35. Improve is_constant_object property

This change fixes a bug where is_constant_object raises an exception when called on a non-object declarations.

tn:

VA19-003

apis:

all

12.36. Fix name resolution of ref to generic inside body

When referencing a generic inside its own body, in the context of an instantiation, P_Referenced_Decl wouldn’t return a properly bound node (with the correct generic context corresponding to the instantiation). This is now fixed.

procedure Test_It is
   generic procedure P2_G;

   procedure P2_G is
   begin
      P2_G; -- <- This reference would return a node with no generic context
   end;

   procedure P2 is new P2_G;
begin
   null;
end Test_It;
tn:

V927-031

apis:

all

12.37. Fix packages without unit body handling

This change fixes a bug where a unit specification with no corresponding unit body (the case of pragma No_Body) wrongly raises an exception when looking for the nonexistant unit body. As for example, calling P_Has_Restriction("No_Elaboration_Code") on the following package definition:

  • pkg.ads:

    ..code:: ada

    package Pkg is end Pkg;

  • pkg.adb:

    ..code:: ada

    pragma No_Body;

tn:

V922-007

apis:

all

12.38. Improve get_aspect for pragma Convention

Previously, calling get_aspect("Convention") on the declaration of X in the snippet below would return an Aspect struct whose value field would contain the identifier X:

..code:: ada

X : Integer; pragma Convention (C, X);

It will now return C, because that’s what would have been returned if one had used the Ada 2012 aspect notation instead:

..code:: ada

XInteger

with Convention => C;

tn:

V713-005

apis:

all

12.39. Do not return ancestor’s part components when calling P_Aggregate_Params

This change fixes a bug where P_Aggregate_Params would return ancestor’s part components if called on an extended aggregate using the other designator.

tn:

V829-017

apis:

all

12.40. Component have precedence when using dot notation

This change fixes a bug in LAL name resolution where a dotted name such as X.F for some record X with a component F as well as a subprogram named F callable using the dot notation could in some cases resolve to the subprogram instead of the component, when the inverse was expected.

tn:

V907-019

apis:

all

12.41. Fix inherited primitives equality and hashing

Primitive subprograms inherited from a root primitive would not have correct computation of identity functions such as equality and hashing, and instead, derived primitives would be considered equivalent to the root primitive they were derived from. This is now fixed.

tn:

V825-017

apis:

all

12.42. Improve nameres accuracy of dispatching calls

This change improves name resolution to always return the most precise subprogram declaration for a given dispatching call according to the static type. In the following example:

package Pkg is
    type T is tagged null record;
    procedure Foo (X : T) is null;
end Pkg;

package Der is
    type U is new Pkg.T with null record;
    overriding procedure Foo (X : U) is null;
end Der;

procedure Main is
    use Pkg;
    use Der;

    X : U'Class := ...;
begin
    Foo (X);
end Main;

Using name resolution to find the subprogram referenced by Foo could previously yield the declaration in Pkg instead of that in Der, depending on the order in which the use clauses were written. With this change, the one Der is always returned since it is the most accurate one.

tn:

U922-046

apis:

all

12.43. Fix CallExpr name resolution

This change fixes a bug in the name resolution process where types referencing iterable ones were not correctly resolved.

tn:

V829-022

apis:

all

12.44. Fix P_Is_Dispatching_Call on non-tagged types

This change fixes a bug where LAL could incorrectly flag some calls as dispatching when the callee was a primitive of a non-tagged type. It now makes sure a tagged type is involved before processing the call further.

tn:

V826-022

apis:

all

12.45. Fix find_all_references in generic contexts

This patch fixes the find_all_references property (when used with Follow_Renamings), where internal entities comparison may fail because of the presence of rebindings information. Since rebindings are not relevant in that context, we just compare entities without them now.

tn:

V825-012

apis:

all

12.46. Infinite recursion with use clauses and generics

This change fixes a bug where a use clause appearing in a generic declaration could cause infinite recursions in queries done on the generic declaration’s instantiation.

tn:

V714-016

apis:

all

12.47. Fix resolution of index constraint on access type

This change fixes a name resolution bug where index constraints on access to array types wouldn’t be resolved correctly.

type Int_Array is array (Integer range <>) of Integer;
type Array_Access is access Int_Array;

X : Array_Access (1 .. 10);
--               ^ Wouldn't be resolved correctly
tn:

V628-004

apis:

all

12.48. Fix for in loop name resolution

Name resolution of for in loop checks that the iterator comes from a valid iterable type. The predicate used to do so was only checking for types coming from the Ada Iterator_Interfaces package. This change allows the predicate to take into account user-defined iterable types (ones specified by the Iterable aspect).

tn:

V628-028

apis:

all

12.49. Robustness of top-level subprogram navigation

This change modifies the way the specs of top-level subprograms bodies are resolved so as to minimize the chances of an exception being raised, by exploiting the fact that such subprograms cannot be overloaded and therefore their types need not be resolved. In turn, this improves the robustness of P_Imported_Units and indirectly of P_Find_All_References.

tn:

V629-020

apis:

all

12.50. Improve AttributeRef parsing robustness

This change fixes a bug in the parser where an AttributeRef would be wrongly parsed when followed by a slice.

tn:

V629-007

apis:

all

12.51. Add missing “precise types” field documentations

The documentations associated to following fields were lacking a description of the precise types these fields could contain:

  • BaseAggregate.f_ancestor_expr

  • BaseAggregate.f_assocs

  • AttributeRef.f_args

  • ComponentList.f_components

  • ObjectDecl.f_type_expr

  • ObjectDecl.f_default_expr

  • RaiseExpr.f_exception_name

This is now fixed.

tn:

V622-020

apis:

all

12.52. Fix Primitive_Subp_*Type for inherited primitives

Previous to this change, calling P_Primitive_Subp_Tagged_Type on a subprogram inherited by a type U from a base type T would return T. This now correctly returns U.

tn:

V621-026

apis:

all

12.53. Add SyntheticCharEnumLit missing support

Freshly introduced SyntheticCharEnumLit node, used to synthesize character literals, was missing some support. This change fixes the p_unique_identifying_name property, which was failing when called on a SyntheticDefiningName (representing the synthetic character literal).

tn:

V616-025

apis:

all

12.54. Fix parent_basic_decl in nested generic contexts

This change fixes a bug where calling the p_parent_basic_decl property on a node in a nested generic context (with at least two layers of generics) could return a node in an incoherent state. Further queries on that node could raise a PropertyError Old_Env presents twice in rebindings.

tn:

V608-044

apis:

all

12.55. Fix TypeDecl name resolution

This change fixes a bug where a TypeDecl that has a user-defined indexing aspect could lead to an infinite recursion if one of the indexing functions denoted by the aspect has the same return type as the one for which the aspect is defined. As for example in:

type T (Kind : K) is tagged private
with Constant_Indexing => Fn;

function Fn (P1 : T; P2 : Integer) return T;
tn:

V607-011

apis:

all

12.56. Fix DefiningName name resolution

This change fixes a null pointer dereference by avoiding to recurse on a node that has no parent when resolving names.

tn:

V607-004

apis:

all

12.57. Fix name resolution of RealTypeDef nodes

Run complete name resolution on RealTypeDef nodes in order to correctly reference the variables used by the definition.

tn:

V530-008

apis:

all

12.58. Implement primitives merging in Get_Primitives

This change improves the behavior of the property in the following code pattern:

type I1 is interface;
procedure Foo (X : I1);

type I2 is interface;
procedure Foo (X : I2);

type T is new I1 and I2;

Previously, Get_Primitives invoked on type T would return the two inherited primitives, from I1 and I2. Now, the primitives are “merged” and Get_Primitives will only return the one that is inherited first when multiple primitives are compatible (so, the one from I1 in that case).

tn:

V225-010

apis:

all

12.59. Improve implementation of P_Is_Ghost_Code

This change fixes a number of problems in the previous implementation of P_Is_Ghost_Code:

  • Adds P_Is_Ghost_Code property on aspect associations, which returns True on Ada 2012 contract aspects (Pre, Post, etc).

  • Renamings of ghost entities are now considered ghost themselves.

  • Instantiations of ghost generic entities are now considered ghost themselves.

  • pragma Assert_And_Cut is also a ghost pragma.

tn:

V524-019

apis:

all

12.60. Fix P_Get_Primitives when param names differ

This change fixes a bug where P_Get_Primitives would previously consider that a subprogram does not override its base subprogram when the names of the parameters didn’t match. In those cases, both the base subprogram and its override would appear in the resulting list, whereas we only expect the most overriden one to appear.

tn:

T928-018

apis:

all

12.61. Fix name resolution of subprogam renamed object

This change fixes the name resolution of the subprogram renamed object when the latter is a character literal.

tn:

V503-020

apis:

all

12.62. Fix p_is_constant_object regarding EnumLiteralDecl

This change fixes support for p_is_constant_object property regarding the constancy of the EnumLiteralDecl declarations, which are always constant.

tn:

V504-016

apis:

all

12.63. Fix access-to-subprogram Pre/Post aspects support

This patch fixes incorrect support of access-to-subprogram Pre/Post aspects handling. Aspects were wrongly parsed along with the access-to-subprogram while they should be parsed along with the corresponding declaration. Name resolution has been fixed accordingly too: in Ada 2022, Pre/Post accesses are allowed on access-to-subprogram, therefore it is now part of the resolution.

tn:

V510-008

apis:

all

12.64. Fix navigation on declarations with multiple ids

This change implements proper navigation on basic declarations that have multiple defining identifiers. Previously, navigation properties such as DefiningName.p_next_part or DefiningName.p_previous_part could not handle cases where the target basic declaration could depend on which defining name the navigation property was called on. For example:

package Pkg is
    X, Y : constant Integer;
private
    X : constant Integer := 1;
    Y : constant Integer := 2;
end Pkg;

Calling p_next_part on Y in the public part used to return None, whereas it now correctly returns the completion of Y in the private part. The same problem was identified on subprogram parameters, and was fixed as well.

tn:

UB16-011

apis:

all

12.65. Fix is_write_reference for type conversions

This change fixes a bug where type conversions used as actual for out parameters where not flagged as write references.

tn:

V502-012

apis:

all

12.67. Accept bracket aggregates in all qualified expressions

Bracket aggregates support (Ada 2022) was partially missing. Libadalang now correctly parses any qualified expression using bracket aggregates.

tn:

V415-015

apis:

all

12.68. Fix some properties’ behavior wrt. synthetic types

Some types are synthetized in Libadalang, because they don’t exist in the original source, such as classwide types, base subtypes for discrete types, and some anonymous access types.

Some properties such as BasicDecl.p_parent_basic_decl and BasicDecl.p_fully_qualified_name wouldn’t work correctly on them.

Now BasicDecl.p_parent_basic_decl works as expected, and returns the parent basic declaration of the linked type for the synthetic type, and BasicDecl.p_fully_qualified_name returns the name of the linked type with a relevant suffix which allows the unique identification of the type (A'Class, A'Base, etc.)

tn:

V208-004

apis:

all

12.69. Assignments with Implicit_Dereference aspect

This change fixes a bug where name resolution would fail when resolving an assignment of the form X := (E => ...); where X is implicitly deferenced and the right-hand side is an aggregate expression matching the dereferenced type.

tn:

V420-012

apis:

all

12.70. Fix parsing of pragma in a case statement

Libadalang used to reject pragma statements that appeared before the first alternative:

case Foo is
    pragma Assert (True);
    when A => null;
    when B => null;
end case;

This is valid Ada, so it is now accepted.

tn:

V414-004

apis:

all

12.71. Fix Enum_Rep attribute name resolution

This patch fixes the name resolution of the Enum_Rep attribute.

tn:

V405-037

apis:

all

12.72. Fix exponentiation in Ada integer literal decoding

Libadalang’s decoder for integer literals (the Libadalang.Sources.Decode_Integer_Literal procedure) applied the exponent in base 10 regardless of the base of the literal being evaluated. This is wrong, as the ARM (2.4.2) states:

An exponent indicates the power of the base by which the value of the based_literal without the exponent is to be multiplied to obtain the value of the based_literal with the exponent.

tn:

V325-006

apis:

all

12.73. Spurious “missing file” event for generic package instantiations

Calling the BasicDecl.p_next_part_for_basic_decl property on a generic package instantiation raised a “missing file” event, pretending that this is an error. This is not correct, as generic package instantiations do not have bodies. This is no longer tagged as an error.

tn:

V322-014

apis:

all

12.74. Fix the default filename pattern in Libadalang.Auto_Provider

The default filename pattern for the Find_Files function in Libadalang.Auto_Provider used to be too lax: it used to accept for instance foo.adbx whereas only the .adb extensions were meant to match. This pattern is now stricter and rejects the former.

tn:

V308-026

apis:

ada

12.75. Node primitives raise Constraint_Error on null nodes

The following node primitives (defined in Libadalang.Analysis) used to raise Constraint_Error exceptions when called on null nodes:

  • Children_Count

  • First_Child_Index

  • Last_Child_Index

  • First_Child

  • Last_Child

  • Get_Child

  • Child

  • Sloc_Range

  • Compare

  • Lookup

  • Token_Range

  • PP_Trivia

  • Traverse

  • Assign_Names_To_Logic_Vars

  • Children_And_Trivia

In addition, Text used to raise a Property_Error exception.

PP_Trivia now accepts null nodes (and prints None for them), and all the other primitives listed above now raise a Precondition_Failure exception, which more clearly state that the primitives are called with invalid arguments.

tn:

V311-030

apis:

ada

12.76. Filter out SyntheticSubpDecl nodes for completion

SyntheticSubpDecl nodes are useless in the scope of completion, this patch simply filters them out.

tn:

V218-006

apis:

all

12.77. Enhance discovery of inherited primitives

This change fixes a bug where subprograms declared in a non package scope next to a derived type would be tagged as primitive of this type as soon as the signature allowed it. The correct behavior is now implemented, which is that those subprograms are tagged as primitives only if they override an inherited primitive of the derived type’s base type.

tn:

V110-018

apis:

all

12.78. Fix SingleTaskTypeDecl.next_part_for_decl

This change fixes a bug where next_part_for_decl, when called on a SingleTaskTypeDecl returns None instead of the next part of its SingleTaskDecl parent.

tn:

SB08-025

apis:

all

12.79. Fix P_Is_Derived_Type on subtypes with interfaces

This change fixes a bug where calling P_Is_Derived_Type could incorrectly return False in the following situation:

Note

ada

type I1 is interface; type I2 is interface and I1; subtype S_I2 is I2; subtype S_I2_CW is S_I2’Class;

Previously, invoking P_Is_Derived_Type to find out if S_I2_CW deived from I1 would return False. It now correctly returns True.

tn:

V106-022

apis:

all

12.80. Fix P_Get_Primitives with interfaces

This change fixes a bug where the P_Get_Primitives property would miss some primitives in the following pattern:

type I is interface
procedure Foo (X : I) is abstract;   -- (1)

type R is tagged null record;
procedure Foo (X : T) is null;       -- (2)

type T is new R and I with null record;
--  Calling `P_Get_Primitives` on T used to return an empty result,
--  it now correctly returns Foo (2).
tn:

V126-032

apis:

all

12.81. Fix behavior of P_Base_Subp_Declarations

This property would previously misbehave when called on a subprogram node that was retrieved through a previous call to P_Base_Subp_Declarations.

tn:

V117-001

apis:

all

12.82. Fix get_primitives with generic base types

This change fixes a bug where calling p_get_primitives on a type inheriting from a type defined in an instantiaged generic package would behave wrongly, as it would in some cases completely omit the primitives associated with such base types.

tn:

V106-029

apis:

all

12.83. Fix resolution of pragma Assert statements

Name resolution of pragma Assert was previously incomplete: the second argument of the pragma, describing the message to be associated with the raised exception was not resolved although it can contain an arbitrary expression returning a String.

tn:

V106-26

apis:

all

12.84. Resolve references to entry families.

This change fixes a bug where references to entry families were missing from name resolution.

tn:

UC02-047

apis:

all

12.85. Fix P_Next_Part_For_decl on GenericDecl nodes

This change fixes a bug where calling P_Next_Part_For_decl on a GenericDecl node would return None. This would impact all properties based on it such as P_Body_Part_For_Decl. It would only return the expected result when called on the internal declaration (GenericPackageInternal or GenericSubpInternal).

tn:

UC02-034

apis:

all

12.86. Fix nameres in stubs of generic subprograms

This change fixes a name resolution bug in specifications of subprogram stubs which complete a generic subprogram declaration: the references to generic formal types in the stub’s parameters would fail to be resolved.

tn:

UA19-038

apis:

all

12.87. Implement evaluation of fixed point defs’ ranges

This change improves Libadalang’s static expression evaluator to handle the T'First and T'Last attributes where T is a fixed point type definition. The evaluator will now return a real value corresponding to the types’s low or high bound. It supports Ordinary_Fixed_Point definition where the range is given explicitly, as well as Decimal_Fixed_Point_Def where the range is computed from the type’s delta and digits parameters.

tn:

UB25-024

apis:

all

12.88. Fix visibility issue when resolving types

This change fixes a bug where Libadalang could wrongly resolve a type to a library-level package with the same name, as if the package was “with”ed.

tn:

UB19-048

apis:

all

12.89. Full name resolution of character literals

This change completes the implementation of name resolution for character literals which was previously lacking one of the behaviors described in Ada RM 4.2 (3), which is that the expected type of the character literal can be used to determine which EnumLiteralDecl it refers to.

tn:

UB22-028

apis:

all

12.90. Name resolution of BinOp on universal types

This change fixes a bug where binary operations with operands of universal types would be wrongly handled, because Libadalang was missing the concept of root types.

tn:

UA05-020

apis:

all

12.91. Consider aggregate designators write references

We now consider that names in designators of aggregate associations are write references, so P_Is_Write_Reference on such a name will now return True.

tn:

UB04-005

apis:

all

12.92. Improve support for delta and digits constraints

This change improves the support for delta constraints and digits constraints in two ways: calling is_static_decl on a SubtypeDecl having one of these two constraints now works as expected instead of always returning False. This also fixed a bug where name resolution would fail when processing a SubtypeDecl with a delta constraint or digits constraint without a range constraint, as in:

subtype My_Fixed_Subtype is My_Fixed_Type delta 0.2;

subtype My_Float_subtype is My_Float_Type digits 4;

These declarations now resolve correctly.

tn:

UA22-019

apis:

all

12.93. Nameres end names of homonym packages

This change fixes a bug where the end name of a child package Pkg.Foo could be incorrectly resolved in case a child package Pkg.Foo.Pkg was also defined: the prefix Pkg in Pkg.Foo would be incorrectly bound to the Pkg definition of the child package of Foo instead of the root package.

tn:

UA18-022

apis:

all

12.94. Name resolution of limited with clauses

This change fixes a bug where calling P_Referenced_Decl on any part of a limited with clause importing a child unit of the current unit would yield None. The declaration inside the designated CompilationUnit is now correctly returned.

tn:

TB01-005

apis:

all

12.95. Wrong documentation for the Is_Ghost property

The documentation of the Is_Ghost property mentionned Token_First instead of Token_Start and Token_Last instead of Token_End, and used to state that for ghost nodes, the former returned no token, whereas it is supposed to return the same as Token_Start. Both issues are fixed in the documentation.

tn:

UA12-003

apis:

all

12.96. Libadalang.Analysis.Print crash on null nodes

Calling the Print procedure from the Libadalang.Analysis package used to raise a Contraint_Error exception when called on a null node (e.g. No_Ada_Node). It now just prints “None”.

tn:

UA12-001

apis:

ada

12.97. Resolve references to parent units in end names

This change fixes a bug where references to parent units in the end name of a library-level child subprogram would not be resolved. For example, in:

procedure Pkg.Foo is
begin
    null;
end Pkg.Foo;

Calling P_Referenced_Decl on the identifier Pkg in end Pkg.Foo; used to return None, whereas it will now correctly return the declaration of the package Pkg.

tn:

UA11-033

apis:

all

12.98. Make end names always refer to their body

This change fixes a discrepancy in the behavior of name resolution on end names: an end name of a subprogram body would resolve to the body itself, whereas for a package body it would resolve to the package declaration. It now always resolve to the body.

As a side-effect, this change fixes a bug where the end name of an entity X could be wrongly resolved to an entity declared inside X in case that entity was also named X. The following snippet illustrates the error case:

package body Foo is
    procedure Foo is
    begin
        null;
    end Foo;
end Foo;

In this example, the identifier Foo in the end name of the package would resolve to the procedure body instead of its corresponding package body.

tn:

UA05-045

apis:

all

12.99. Fix Is_Static_Expr for character literals

Calling the P_Is_Static_Expr property on a character literal that references a declaration in standard would make LAL crash instead of returning True.

tn:

U928-019

apis:

all

12.100. Fix navigation on homonym packages

This change fixes a bug where calling P_Previous_Part_For_Decl on the body of a child package X would fail if any of its parent packages was also named X.

tn:

U923-017

apis:

all

12.101. Nameres 'Access on overloaded subprograms

This change fixes name resolution of Foo'Access attribute nodes when Foo designates an overloaded subprogram: LAL would not always resolve Foo to the correct variant.

tn:

U920-028

apis:

all

12.102. Fix P_Get_Pragma on generic instantiations

This change fixes a bug where the P_Get_Pragma property and all properties using it (P_Has_Aspect, etc.) would not behave properly on generic instantiation nodes: a pragma associated to such node would never be recognized by these properties.

tn:

U915-001

apis:

all

12.103. Behavior of Is_Dispatching_Call on Op nodes

This change fixes the behavior of the P_Is_Dispatching_Call property on nodes of kind Op (appearing inside an UnOp or BinOp node). It now ensures that the result of this property is the same as if it was called on the underlying UnOp or BinOp node.

tn:

U904-002

apis:

all

12.104. Fix visibility of library level generic subps

This change fixes the visibility that library level generic subprograms have on their parent package, so that, may they be private, they would have visibilty on the private part of the parent.

tn:

U823-021

apis:

all

12.105. Fix visibility issue of overriden subprogram

This change fixes a visibility issue arising when resolving a reference to a subprogram overriden in the public part of a package if the type has a refined declaration in its private part, in which case the inherited subprogram would incorrectly take precedence over the overriden one (see testcase precise_override_2).

tn:

U817-024

apis:

all

12.106. Improve resolution of Access attribute

In some cases where the accessed entity was ambiguous, Libadalang would resolve wrongly because the constraints in name resolution were not strong enough.

tn:

U423-046

apis:

all

12.107. Fix withing child packages of renamed packages

Withing a child unit of a library level package renaming would not work, as in:

package Foo is
end Foo;

package Foo.Bar is
end Bar;

package Foo_Renaming renames Foo;

with Foo_Renaming.Bar; --  Would not work

This is now solved.

tn:

TC02-042

apis:

all

12.108. Fix stack overflow in P_Is_Dispatching_Call

This change fixes a bug where a stack overflow could occur when calling the P_Is_Dispatching_Call property on the left-hand side of an assign statement due to an erroneous handling of return type dispatching.

tn:

U824-046

apis:

all

12.109. Nameres calls to paramless entries with family

This change fixes a name resolution crash that would occur when trying to analyze a call to an entry declaration, if that entry does not take conventional parameters but has an associated family type.

tn:

T703-023

apis:

all

12.110. Consistent behavior of P_Next_Part_For_Decl

This change improves the consistency of P_Next_Part_For_Decl. In particular, the default result when no next part is found is None, whereas previously it could either return None, return itself or raise an exception.

tn:

U818-018

apis:

all

12.111. Fix p_is_dispatching_call on abstract subps

This change fixes a bug where calling is_dispatching_call on a call expression with a statically known target could erroneously return True if the root subprogram was marked abstract.

tn:

U812-028

apis:

all

12.112. Fix P_Base_Subp_Declarations for derived types

This change fixes a bug where calling P_Base_Subp_Declarations on an overriding subprogram declared in a non-package scope for a derived type T would not have the subprogram itself in the returned array, not matching what is stated in the documentation.

tn:

U812-023

apis:

all

12.113. Fix P_Imported_Units for library-level subps

This change fixes a bug where the result of calling P_Imported_Units on a unit declaring the body of a library-level subprogram would never contain the unit declaring its specification.

tn:

U812-030

apis:

all

12.114. Fix rebindings on generic instantiations

This change fixes a bug where a generic instantiation node returned by a property such as P_Referenced_Decl could contain invalid rebindings in some scenarios, leading further queries on that node (such as P_Designated_Subp) to crash with an old_env present twice in rebindings error.

tn:

U714-004

apis:

all

12.115. Fix is_static_expr on array attributes

This change fixes a bug where calling is_static_expr on an expression involving an AttributeRef without arguments on an array (e.g. Str'Length) would cause a crash.

tn:

U729-010

apis:

all

12.116. Fix type resolution for array range constraints

This change fixes a bug where index bounds inside array range constraints could be resolved inaccurately when containing operands of universal types.

tn:

U716-006

apis:

all

12.117. Fix type navigation in presence of use clauses

This change fixes a bug where a use clause could impact the navigation (in particular, when finding the previous part) of a type declaration when the used package would contain a matching type declaration, as that declaration could be returned when there is really no previous part.

tn:

TC28-004

apis:

all

12.118. Fix subprogram navigation in presence of use clauses

This change fixes a bug where a use clause could impact the navigation (in particular, when finding the previous part) of a subprogram when the used package would contain a matching subprogram declaration, as that declaration could be returned when there is really no previous part.

tn:

U323-012

apis:

all

12.119. Fix support of 'Base attribute

This patch fixes a bug where using the 'Base attribute as the prefix of another attribute (as in Float'Base'Write (...) would trigger a name resolution failure.

tn:

U624-010

apis:

all

12.120. Fix exponential complexity with failed resolution of use clauses

This change fixes the bug that made Libadalang take an exponential amount of time to resolve the names in use clauses when source files are missing to provide declarations for the corresponding entities.

tn:

U512-020

apis:

all

12.121. Fix resolution of generic subprogram actuals

This change fixes a bug where resolving a generic subprogram reference when inside a generic context could trigger a Property_Error.

tn:

U601-009

apis:

all

12.122. Nameres of Fixed-Point/Integer binary operations

This change incorporates the name resolution and typing rules described in Ada RM 4.5.5 for multiplication and division operations over one fixed point operand and one Integer operand.

tn:

T220-030

apis:

all

12.123. Fix name resolution crash on 'Base attribute

This change fixes a bug where name resolution could crash when invoked on expressions involving a 'Base attribute, in particular when its result was used as an operand of another expression (e.g. a binary operation).

tn:

U517-023

apis:

all

12.124. Crash on pragma nodes’ P_Associated_Decls

This change fixes a crash that could occur when calling the P_Associated_Decls property on a pragma node in a body unit if the target was an entity first declared in the corresponding spec unit.

tn:

U517-015

apis:

all

12.125. Crash with Range_Length attribute

This change fixes a bug where the use the Range_Length attribute would cause Libadalang’s name resolution mechanism to crash when trying to process an expression involving it.

tn:

U517-001

apis:

all

12.126. Resolve Interrupt_Handler & Attach_Handler

This change adds support for the Interrupt_Handler and Attach_Handler pragmas, meaning that the P_Has_Aspect property and related functions will now work when invoked with those aspect names.

tn:

U510-025

apis:

all

12.127. Fix P_Is_Call for user-defined operators

This change fixes a bug where calling P_Is_Call on the operator of an unary or binary operation would always return False, even when the operator referred to user-defined operations. This is now fixed.

tn:

U507-005

apis:

all

12.128. Reparsing of the Standard unit

It is now impossible to reparse Libadalang’s internal analysis unit that is used to implement Ada’s Standard built-in package. It used to be possible to get this unit from name resolution primitives, and then call Get_From_File on it with the Reparse flag set, which would destroy its tree and completely break name resolution for the whole analysis context. This is no longer possible.

tn:

U422-030

apis:

all

12.129. Add support for 'Machine_Radix & 'Exponent

This change adds name resolution support for the Machine_Radix and Exponent attributes.

tn:

U402-031

apis:

all

12.130. Fix nameres of CallExprs to predefined operators

This change fixes a bug where resolving a call to a predefined operator made with call expression (as in "and" (A, B)) would not fail.

tn:

U426-002

apis:

all

12.131. Fix p_has_aspect property on generic decls

This change fixes a bug where p_has_aspect would always return False for aspects defined via aspect associations on generic declarations.

tn:

U426-012

apis:

all

12.132. Fully qualified name in exit statements

This change fixes a bug where libadalang would fail to parse fully qualified names in exit statements.

tn:

U402-030

apis:

all

12.133. Make Next_Sibling and Previous_Sibling work on root nodes

The Next_Sibling and Previous_Sibling properties used to raise a Property_Error exception when called on root nodes. They now just return a null node, and their documentation has been updated to make this explicit.

tn:

U415-014

apis:

all

12.134. Fix navigation of protected bodies

This change fixes a bug where calling P_Decl_Part on a protected body which corresponding declaration was a SingleProtectedDecl would fail.

tn:

U409-026

apis:

all

12.135. Add Long_Long_Long_Integer to standard unit

This change adds the Long_Long_Long_Integer declaration to Libadalang’s standard unit, so that it is available during name resolution. This fixes name resolution failures in the GNAT runtime library.

tn:

U409-023

apis:

all

12.136. Add nameres support for more pragmas

This change adds name resolution support for the following pragmas:

- ``Atomic``
- ``Atomic_Components``
- ``No_Return``
tn:

U330-018

apis:

all

12.137. Fix P_Has_Aspect property for Pre/Post aspects

This change fixes a bug where evaluating this property on a subprogram with a precondition or a postcondition using Pre or Post as argument would crash due to Libadalang trying to evaluate the expression in the contract.

tn:

U328-004

apis:

all

12.138. Fix P_[Get/Has]_Aspect for the Inline aspect

When called with the Inline aspect, those properties will check for this aspect on all parts of the given entity.

tn:

U331-032

apis:

all

12.139. Fix P_Fully_Qualified_Name on GenericSubpInternal

This change fixes a bug where calling the P_Fully_Qualified_Name property on a GenericSubpInternal node would yield a non-sensical result. It will now yield the fully qualified name of the underlying generic declaration.

tn:

U322-006

apis:

all

12.140. Subtypes with inherited user-defined indexing

This change fixes a bug in Libadalang’s name resolution mechanism where user-defined indexing on a type would not be propagated to its subtypes, which in turn would make name resolution fail on expressions involving indexing of an instance of such a subtype.

tn:

U317-049

apis:

all

12.141. Fix p_is_call on qualified subprogram name

This change fixes a bug where a qualified subprogram name could be wrongly tagged as a call, as in the following example:

function Foo (X : Integer) return Integer is
begin
    return Foo.X;  -- `Foo` was wrongly considered a call
end Foo;
tn:

TC15-033

apis:

all

12.142. Wrong memoization of generic instantiation

Due to the way memoization of name resolution results works (on a per-node basis, not on a per-entity basis), results would be cached once for any generic entity, hence causing wrong results when multiple instantiations were involved.

tn:

TC09-047

apis:

all

12.143. Generic subprograms and primitive_subp_types

This change fixes a bug where calling the primitive_subp_types and similar properties on the subprogram specification of a generic subprogram declaration would crash with a null dereference error. It will now return empty results instead.

tn:

U104-021

apis:

all

12.144. Access types and primitive_subp_types

This change fixes a bug where calling the primitive_subp_types and similar properties on the subprogram specification part of an access to subprogram type declaration would crash with a null dereference error.

tn:

U104-020

apis:

all

12.145. Fix Base_Subp_Declarations on incomplete types

This changes fixes a bug where calling the Base_Subp_Declarations property on a subprogram declared in a package body and defining a primitive over an incomplete type which completion is declared in that same package body would always return an empty list.

tn:

TB14-004

apis:

all

12.146. Crash with 'Wide[_Wide]_Value attributes

This change addresses a crash that would systematically occur when trying to resolve expressions containing the 'Wide_Value' or 'Wide_Wide_Value attributes.

tn:

TB06-015

apis:

all

12.147. Resolve Machine_Rounding attribute

This change fixes a crash that would occur when trying to resolve expressions containing the Machine_Rounding attribute.

tn:

TB04-024

apis:

all

12.148. SubtypeDecl.base_types doesn’t return all base types

When a subtype is of a type that inherit from interfaces, those would not be returned. This is now fixed.

tn:

TB03-029

apis:

all

12.149. Propagate use clauses from generic formal part

Previously, use clauses appearing inside the formal part of a generic declaration were not taken into account by Libadalang when resolving names inside the body of the generic. This change fixes that.

tn:

TA29-032

apis:

all

12.150. Nameres crash upon Test_Case aspect assoc

This change fixes a crash that would previously occur while trying to resolve names within a Test_Case aspect, in case the arguments were written without a left-hand side designator.

tn:

TA30-040

apis:

all

12.151. P_Is_Dispatching_Call crash on generic subp calls

This change fixes a crash that could occur when calling the P_Is_Dispatching_Call on a node representing a call to a generic subprogram.

tn:

TA29-020

apis:

all

12.152. Invalid object cast with P_Is_Dispatching_Call

Calling the P_Is_Dispatching_Call property could sometimes crash with an Invalid object cast error, which was due to an erroneous assumption made in the implementation of that property. This change fixes it.

tn:

TA30-018

apis:

all

12.153. Load implicitly-withed runtime units when needed

Some runtime units such as Ada.Exceptions, Ada.Tags, Ada.Task_Identification, and a few others need to be loaded in order for libadalang to provide correct name resolution on constructs that refer or type to declarations from those units, which was not done beforehand. This change fixes that by loading those units as soon as it’s necessary.

tn:

T117-027

apis:

all

12.154. Fix precedence of fields over subprograms

In the scenario of a tagged record type having a field Foo as well as a method Foo with a profile such that X.Foo could be seen as ambiguous, Ada resolves the ambiguity by always choosing the field access. This was not implemented by Libadalang, meaning it could in such cases resolve to the subprogram instead of the field. This change implements the correct behavior.

tn:

TA05-019

apis:

all

12.155. Nameres bug of Identity attribute on tasks

The Identity attribute applied to a task (single task decl or object decl of a task type) should type to Ada.Task_Identification.Task_Id, which this change implements.

tn:

TA20-018

apis:

all

12.156. Fully resolve operator actuals of generic formals

Until now, a fully qualified reference to an operator used as an actual for a generic formal would not be resolved, meaning navigation would fail on the prefix of the qualified name. This change addresses this.

tn:

T917-014

apis:

all

12.157. Fix output of P_Base/Root_Subp_Declarations

Until now, those properties could return several subprogram declarations denoting the same entity (for example its specification and its body), and sometimes even twice the same subprogram specification or body. This change homogenizes the output of those property to prevent duplicate entries. As such, the canonical part of each subprogram is returned, after having removed duplicates.

tn:

T925-015

apis:

all

12.158. CW types and P_Base_Subp_Declarations

The P_Base_Subp_Declarations property could return incorrect results when called on a subprogram which signature involved the classwide type of the tagged type of which the subprogram is a primitive. In such cases, P_Base_Subp_Declarations would always return the singleton list only containing the subprogram on which the property was called.

tn:

T925-013

apis:

all

12.159. Fix GenericSubpInst.subp_spec_or_null

The subp_spec_or_null property would not work correctly on generic subprogram instantiations, and hence some other calls relying on that would also fail, such as is_dispatching_call on a call to a generic subprogram instantiation. This is now fixed.

tn:

T925-008

apis:

all

12.160. Fix parsing of Wide_*Image attributes

Until now, such attributes would be parsed differently that the basic Image attribute. For example, Type'Image (X) would be parsed as a simple AttributeRef node with arguments, whereas Type'Wide_Image (X) would be parsed as a call to Type'Wide_Image. Since we don’t currently support function attributes, this change unifies the representations by making the second case behave like the first one.

tn:

T917-027

apis:

all

12.161. Nameres of CallExpr when name is an attribute

Until now, libadalang would fail to resolve most CallExpr expressions when the name of such CallExpr would be an AttributeRef, typically meaning that the CallExpr represents a subscript operation over the array returned by the AttributeRef (as in X'Image (2 .. 3)). This is now correctly handled.

tn:

T915-006

apis:

all

12.162. Fix name resolution of Mod attribute

Until now, the Mod attribute would take an incorrect code path during name resolution, which could make some expressions involving it fail to resolve. In particular in expressions where the mod attribute is used as one of the operand of an arithmetic operation.

tn:

T915-004

apis:

all

12.163. Fix navigation on child subprograms

Until now, some navigation properties such as p_previous_part would return None when invoked on a child subprogram body defined in the library-level. This will now correctly return its spec, if it exists.

tn:

T728-034

apis:

all

12.164. Fix semantic_parent/parent_basic_decl on EnumSubpSpec

Until now, semantic_parent/parent_basic_decl on EnumSubpSpec would return the parent enum type declaration, rather than the parent enum literal declaration. This is now fixed.

tn:

T903-012

apis:

all

12.165. Nameres bug with error message of raise stmt

Libadalang would sometimes fail to nameres a raise statement/expression that comes with an error message, if the expression for the error message would involve a string concatenation between calls to overloaded functions.

tn:

T909-028

apis:

all

12.166. Bug with qualified expr used as prefix of call

Until now, Libadalang would fail to nameres an expression containing a qualified expression being the prefix of a call. This is now correctly handled.

tn:

T909-024

apis:

all

12.167. Crash on dotted name with ambiguous suffix

This changes fixes a bug where name resolution could crash when resolving the suffix of a dotted name, if that suffix taken out of context could designate both an access type component of a tagged record type, or a procedure of that same tagged record type. In particular, this bug would trigger when such a dotted name would be used in the context of a comparison with the Null literal.

tn:

T904-008

apis:

all

12.168. Add support for the Enum_Rep attribute

Previously, name resolution would crash when trying to resolve an expression containing the Enum_Rep attribute. This is now fixed, by typing the result of this attribute to universal integer.

tn:

T904-009

apis:

all

12.169. Crash on renaming of Ada.Wide_*Text_IO package

This fixes an issue where Libadalang would fail to do any kind of name analysis on a source that would “use” a package renaming an instantiation of the Ada.Wide_Text_IO or Ada.Wide_Wide_Text_IO packages, such as Ada.Integer_Wide_Text_IO.

tn:

T903-029

apis:

all

12.170. Imprecise fallback on suffix of dotted names

Until now, the imprecise fallback of nameres queries such as p_referenced_decl would never behave correctly when called on the suffix of dotted names (e.g. Subprogram in Pkg.Subprogram). The fallback should now provide better results.

tn:

T812-006

apis:

all

12.171. Name resolution for Standard’Max_Integer_Size

This change adds support for the Standard'Max_Integer_Size attribute, as well as the ‘Default_Bit_Order’ in libadalang’s name resolution mechanism.

tn:

T814-028

apis:

all

12.172. Name resolution for float attributes

This change adds name resolution support for new floating-point attributes, such as Copy_Sign, Remainder and Adjacent. It also adds support for the GNAT-specific Invalid_Value attribute.

tn:

T811-023

apis:

all

12.173. Interface primitive visibility and use clause

This fixes a bug where obtaining visibility through a use clause of a primitive for a type T inherited from an interface I would not work.

tn:

T811-022

apis:

all

12.174. Fix P_Is_Defining on dotted defining names

Previously, P_Is_Defining would always return True for the suffix of any dotted name appearing inside a defining name. For example, for the declaration of an unit A.B.C, P_Is_Defining would incorrectly return True on B. Now, only the outermost dotted name and its suffix will be considered defining (here, A.B.C and C).

tn:

T804-016

apis:

all

12.175. Name resolution robustness of if/case stmts

Previously, the entire name resolution of an if stmt or case stmt would fail whenever any of their alternatives’ resolution would fail. Each alternative is now resolved independently, so that a failing one does not impact the others. Note that this change does not impact resolution of if/case expressions.

tn:

T729-016

apis:

all

12.176. Handle library-level use all type clauses

Previously, such clauses appearing at the library-level of a unit would be totally ignored, which could cause name resolution failures on nodes using this construct to gain visibility on a type’s operations, including the case where the clause is used to make direct references to the literals of an enum type. This is now fixed.

tn:

T730-018

apis:

all

12.177. Nameres failure on generic instantiations

Some generic instantiations could previously cause name resolution to crash, in particular when another generic declaration having the same name as one intended to be instantiated would be available to the resolution mechanism. The fix was to specifically filter out those declarations by only keeping those that are visible in the Ada sense.

tn:

T429-037

apis:

all

12.178. Nameres crash on instantiations of Modular_IO

Previously, name resolution would crash when trying to resolve names in a package instantiation whose designated generic package was Modular_IO from Ada.Text_IO. This was because the special handling of child units of Ada.Text_IO was missing a case for the Modular_IO package.

tn:

T717-023

apis:

all

12.179. Nameres call to incomplete types’ primitives

Name resolution could crash when trying to resolve a call to a primitive of a type when a primitive of the same name but defined on a different incomplete type is visible. In that case, the first visible primitive would always be chosen, which is erroneous if a call to the second one was intended.

tn:

T715-013

apis:

all

12.180. Fix Is_Write_Reference for dot calls

Previously, calling the Is_Write_Reference property on the prefix of a dot call would always yield False. This is now fixed, by correctly identifying dot calls and checking that the first paremeter is out/in out.

tn:

T713-013

apis:

all

12.181. Fix name resolution crash on runtime files

Name resolution would crash when trying to analyze the following files from the runtime: a-stzfix.ads a-stzhas.ads a-szfzha.ads. The pattern leading to the crash was identified and was fixed altogether, thus name resolution will not be affected by new occurrences of it.

tn:

T708-024

apis:

all

12.182. Fix name resolution in type contracts

Previously, name resolution could fail in type contracts (inside aspect associations such as Type_Invariant, Predicate, etc.) when references were made to entities defined after the entity on which the contract applies. This now behaves as expected.

tn:

T708-002

apis:

all

12.183. Prevent name resolution in Convention aspect

The convention used for an entity, such as C in the Convention => C aspect association was incorrectly resolved to the first visible entity named C. This now behaves correctly, meaning the identifier used as the convention is never resolved to anything.

tn:

T708-003

apis:

all

12.184. Fix P_Get_Aspect ("unchecked_union")

Previously, calling P_Get_Aspect ("unchecked_union") on a type would always return an empty result, even when a Pragma Unchecked_Union was associated to it.

tn:

T706-009

apis:

all

12.185. Name resolution on separate (X) clause

Previously, libadalang would crash when calling P_Referenced_Decl on X of a separate (X) ... clause. It will now correctly return the entity in which the subunit is rooted.

tn:

T703-024

apis:

all

12.186. Implement name resolution for entry barriers

Previously, entry barriers were not resolved at all, meaning any xref or navigation inside the expression of the barrier would fail. It is now working as expected.

tn:

T706-017

apis:

all

12.187. Name resolution of use at clauses

Implement name resolution of address clauses (for .. use at ..), which were previously not resolved at all.

tn:

T702-057

apis:

all

12.188. Name resolution for generic renaming decls

Implements name resolution for generic renaming declarations, which were previously not resolved at all. Properties such as P_Referenced_Decl will now work as expected on those.

tn:

T703-002

apis:

all

12.189. Do not consider Subp'Address a call

Previously, the mentionned pattern would be resolved as a call to Subp, meaning that P_Is_Call would return True when invoked on Subp.

tn:

T703-009

apis:

all

12.190. Fix zip_with_params on incomplete type decls

This fixes an issue with calling P_Zip_With_Params on an discriminant constraint that constrains the incomplete view of a discriminated type would yield an empty result.

tn:

T701-019

apis:

all

12.191. Fix exception message for invalid conversions in As_* functions

On attempts to run invalid node conversions, such as:

D : constant Subp_Decl := ...;
P : constant Pragma := D.As_Pragma;

The As_* functions used to raise Constraint_Error exceptions with a wrong message:

invalid type conversion from Pragma to SubpDecl

This is now fixed and sends the correct message:

invalid type conversion from SubpDecl to Pragma
tn:

T622-019

apis:

ada

12.192. Libadalang.Analysis.*_Text raise a Constraint_Error

When called on null nodes, Libadalang.Analysis.Text and Libadalang.Analysis.Debug_Text raise a Constraint_Error exception. These functions now raise Property_Error exception instead, clearly showing that calling them on null nodes is not valid.

tn:

T622-008

apis:

all

12.193. Name resolution bug with custom string literals

String literals for custom string types were inaccurately typed and could make name resolution involving such literals imprecise as well.

tn:

T610-034

apis:

all

12.194. Inconsistent results of navigation properties

This fixes a bug where navigation properties such as P_Previous_Part, P_Canonical_Part and so on could yield different results across calls on a same Body node retrieved in different ways. This should not happen because the previous part of a node is predetermined and must not depend on the path taken to reach said node.

tn:

T610-028

apis:

all

12.195. Fix name resolution for Access attribute

A bug in the resolution of the Access attribute would trigger resolution failures on valid expressions.

tn:

T609-035

apis:

all

12.196. Name resolution for Storage_Size attribute.

The attribute Storage_Size applied to an access type reference is now correctly recognized and does not trigger a Property_Error anymore.

tn:

T609-023

apis:

all

12.197. Fix name resolution for some attributes

Some expressions involving attributes such as 'First would not be entirely resolved. In particular, when the expression is of the form X.Y'First, X would not be resolved at all.

tn:

T608-074

apis:

all

12.198. Fix type conversion of explicit dereference

This fixes a bug in libadalang’s name resolution mechanism, where we would not check in certain cases that a type was indeed dereferencable before assigning it to the prefix of an explicit dereference.

tn:

T529-014

apis:

all

12.199. Missed child units during find_all_references

Until now, child units defining a subprogram body at the top-level without a corresponding specification unit would be “forgotten” in calls to find_all_references & co. This is now fixed.

tn:

T510-001

apis:

all

12.200. Fix defining name’s navigation queries crash

Previously, any navigation property (next_part, previous_part, etc.) called on a defining name would crash whenever its associated basic decl would not have the requested part. As such, calling p_next_part on the defining name of an abstract subprogram would always crash.

tn:

T410-017

apis:

all

12.201. Fix is_static_decl for array types

Previously, calling is_static_decl on the declaration of an array type would always yield False. This now returns True when all array indices are static.

tn:

T416-026

apis:

all

12.202. Nameres bug for subp defined in a declare block

This fixes a bug where libadalang would fail to retrieve the body part of a subprogram declaration made in a declare block.

tn:

T327-046

apis:

all

12.203. Fix navigation for subps inside of separate pkg

Navigation would previously not work when trying to go to the body of a subprogram declared in a package whose body was separate.

tn:

T108-060

apis:

all

12.204. Resolve Truncation attribute

The Truncation attribute was not resolved correctly.

tn:

T110-038

apis:

all

12.205. Fix nameres of quantifier expressions

So far, resolving any name or type inside a quantifier expression could result in a invalid equation for logic resolution error. This is now fixed.

tn:

T407-009

apis:

all

12.206. Zip_with_params bug on variant record access

Until now, zip_with_params would not yield any result when trying to match an actual from a discriminant constraint with the discriminant when the constraint type was an access on the variant record. This is now fixed.

tn:

S625-016

apis:

all

12.207. Resolve formal in discriminant constraint

Libadalang now correctly resolves references to the discriminant inside discriminant constraints, as in:

type R (X : Integer) is null record;
type R_Access is access T;

subtype T is R_Access (X => 12);
--                     ^ This reference is now resolved
tn:

T320-016

apis:

all

12.208. Make relative_name work on decls with no name

Some declarations (like exception handlers that don’t declare an object) have no defining name. Make sure the relative_name property works correctly on those.

tn:

T907-010

apis:

all

12.209. Handle static object renamings.

Previously, LAL would never consider an object renaming a static declaration, even when its renamed entity was static. This fix changes the behavior of p_is_static_decl (and transitively that of p_is_static_expr) to take this case into account, and also updates the static expression evaluator accordingly.

tn:

T401-019

apis:

all

12.210. Missing Numeric_Error declaration from standard

This change adds the missing Numeric_Error exception declaration into Libadalang’s standard package so that it is available in every analysis unit. This fixes bugs where references to Numeric_Error would not be resolved correctly.

tn:

U322-025

apis:

all

12.211. Use clause applied to a generic formal package

This change fixes a bug in Libadalang where use package clauses would not be handled correctly when the designated packages were generic formal packages.

tn:

TB18-010

apis:

all

12.212. Various bug fixes in name resolution

This fixes various bugs in libadalang’s name resolution mechanism, including:

  • A bug related to the use of a package renaming as an actual for a generic formal package.

  • A bug related to visibility on a generic package’s formals when using a qualified name to access it.

  • A crash when trying to resolve a subprogram renaming a built-in attribute.

tn:

T304-008

apis:

all

12.213. Various bug fixes in name resolution

This fixes various bugs in libadalang’s name resolution mechanism, including:

  • A crash when trying to resolve a formal subprogram’s default value being a built-in attribute reference.

  • A bug where library-level subprogram would not have visibility on the private part of their parent package.

tn:

T304-010

apis:

all

12.214. Resolve range constraints in case constructs.

Until now, Libadalang would not even try to resolve names appearing in a range constraint of a subtype indication used in a case statement or expression. Such constraints should now be correctly resolved.

tn:

T302-029

apis:

all

12.215. Fix visibility issue for binary operators

This change fixes a bug where an operator could previously be considered by libadalang as referring to a declaration appearing after the usage of the operator, which is not legal.

tn:

T604-022

apis:

all

12.216. Fix name resolution of builtin concat operator

Previously, Libadalang would generate too weak constraints when resolving the concatenation operator, which in turn could make its LHS and RHS refer to erroneous entities. This change fixes that.

tn:

U219-012

apis:

all

12.217. Fix the p_primitive_subp_* properties for subp body specs

Previously, calling one of the p_primitive_subp_* properties (e.g. p_primitive_subp_tagged_type) on the subprogram spec of the body of a subprogram would always yield a null node instead of the expected result.

tn:

T214-020

apis:

all

12.218. Add support for additional SPARK aspects.

This change adds support for the Abstract_State, Refined_State, Refined_Depends and Refined_Global aspects.

tn:

U212-042

apis:

all

12.219. Derived type with discriminant constraints

This changes fixes a name resolution failure that would occur on aggregate of a derived type constraining the discriminants of its parent type, as in the following example:

type T (X : Boolean) is record
    case X is
        when True =>
            F : Integer;
        when others =>
            null;
    end case;
end record;
type U is new T (True);

V : U := (X => True, F => 42);  -- Libadalang would crash here

Libadalang now correctly handles such patterns.

tn:

U212-044

apis:

all

12.220. Fix name resolution of index constraints.

Consider the following subtype declaration:

type Arr_Type is (Character range <>) of Integer;
subtype Arr_A_E of Arr_Type ('A' .. 'E');

Previously, the literals 'A' and 'E' would be assigned incorrect types because we did not take into account the expected index type (here Character) of the constraint array type.

tn:

T211-029

apis:

all

12.221. Fix name resolution of binary operations when at least one operand has a universal type

Libadalang would often wrongly assume that both operands of a binary operation have the same type, overlooking the case where one of the operands has an universal type, in which case it can get implicitly converted to the type of the other operand.

tn:

T203-023

apis:

all

12.222. Fix name resolution on AttributeDefClause nodes

Libadalang would previously crash when resolving names on AttributeDefClause nodes of the form for X'Address use Y'Address when the System package was not visible from the clause.

tn:

T214-014

apis:

all

12.223. Invalid xref for overloaded enclosing subprogram

This change fixes a bug in the following code pattern:

procedure Foo is null;
procedure Foo (X : Integer) is
begin
    Foo;  -- this used to resolve to the enclosing subprogram
end Foo;

The call to Foo now correctly resolve to the first subprogram declaration.

tn:

TC18-015

apis:

all

12.224. Fix P_Base_Subp_Declarations on incomplete types

This change fixes the behavior of the P_Base_Subp_Declarations property when called on a primitive subprogram of an incomplete type which full view is a tagged type with a possible base type. Before this patch, it was not possible to find base declarations of such subprograms because Libadalang would always work from the view of the subprogram, thus missing information about the base type. This change fixes that issue.

tn:

U104-009

apis:

all

12.225. Crash in the P_Doc property

Using the P_Doc property on files that contain carriage return characters trigger assertion failures. This is now fixed, and carriage returns that are the last line characters are now discarded from P_Doc’s result.

tn:

T205-050

apis:

all

12.226. Fix static evaluator on character literals

The static evaluator was wrongly evaluating a character literal whose type derives Standard.Character.

tn:

SB14-019

apis:

all

12.227. Crash when resolving exception renaming clause

Until now, name resolution would crash when attempting to resolve any name appearing on the right-hand side of an exception renaming clause.

tn:

T124-016

apis:

all

12.228. Fix crash on top-level subprogram renamings

Libadalang used to crash when the nameres mechanism encountered an analysis unit containing a single subprogram renaming at the top-level.

tn:

T122-020

apis:

all

12.229. Fix fully_qualified_name for generic decls

Consider the following snippet:

package Foo is
    generic
    package Bar is
        X : Integer;
    end Bar;

    package My_Bar is new Bar;
end Foo;

Previously, calling fully_qualified_name on the declaration of X would return Foo.Bar.X no matter how X was retrieved.

With this change, when the declaration of X is reached from an instantiation of Bar (e.g. through My_Bar.X), fully_qualified_name will return the qualified name to that particular instance of X, i.e. Foo.My_Bar.X.

tn:

SB29-001

apis:

all

12.230. Exception when calling property via introspection

When calling a property via the Libadalang.Introspection API, if the self parameter was null, it would raise a Constraint_Error exception.

tn:

SB14-036

apis:

all

12.231. Memory leak in properties to find-all-references

All calls to the find-all-references properties (p_find_all_references, p_find_all_overrides, p_find_all_calls, p_find_all_derived_types) used to trigger memory leaks. This is now fixed.

tn:

SC13-001

apis:

all

12.232. Resolve defaults for generic formal subprograms

Defaults for generic formal subprograms were not correctly resolved, and would cause crashes when trying to find the referenced declaration.

procedure Foo;

generic
    with procedure Bar is Foo;
    --                    ^ Not resolved
package Baz is
end Baz;
tn:

SB29-014

apis:

all

12.233. Fix nameres involving generic instantiations with formal objects

In some complex name resolution situations, we would try to resolve a formal object in an instance. That would cause a crash if the formal object was completed by a literal.

tn:

SB22-060

apis:

all

12.234. Fix static evaluation of range attributes

Before this fix, static evaluation of range attributes on derived type definitions would not evaluate the constraints on the base type, only the explicit constraints on the derived type, such evaluating the range of type B in the following code would crash:

type A is range 1 .. 10;
type B is new A;

Similarly, subtypes would not be handled at all, so the evaluation of the range of any subtypes would crash.

type A is range 1 .. 10;
subtype B is A;  --  CRASH
subtype B is A range 1 .. 5;  --  CRASH
tn:

SC04-024

apis:

all

12.235. Resolution of calls to primitives

So far for calls of the form X.Foo, libadalang would always resolve Foo to the base-most declaration of the subprogram Foo. This is not accurate in case the type of X is statically known to be a child type which provides an override of Foo. After this change, Foo in X.Foo now correctly resolves to the most precise override available of Foo for X.

tn:

SC04-030

apis:

all

12.236. Package navigation in presence of homonyms

Before this change, the p_package_previous_part private property would return a wrong result when applied on given package if this package contained a entity with the same name as the package itself. These wrong results would then propagate to common navigation properties such as p_decl_part.

tn:

S916-024

apis:

all

12.238. Fix behavior of BasicDecl.has_aspect

The behavior of the BasicDecl.has_aspect property was invalid when the aspect was non boolean-valued. It is now fixed.

tn:

SB14-045

apis:

all

12.239. P_syntactic_fully_qualified_name can crash in presence of parsing errors

The p_syntactic_fully_qualified_name property could crash when called on a unit with parsing errors because we didn’t handle the case where its body would be an ErrorDecl. This is now fixed.

tn:

SB04-032

apis:

all

12.240. Crash when resolving ambiguous case stmts

Consider the following code pattern:

function Foo return Integer;
procedure Foo;

...

case Foo is
    when ... => ...
end case;

Name resolution would crash here while attempting to construct the xref equation for the case statement due to the presence of procedure Foo, which by definition has no return type and therefore would provoke a null dereference. This is now fixed.

tn:

SB13-013

apis:

all

12.241. Nameres crash with calls on shadowed types

In case a type was shadowed by an object, resolving a call on that object could crash because the construction of the xref equation would assume the type was a possible target for the call. This was fixed by early discarding types when resolving calls in which the context does not allow a type.

tn:

SA24-055

apis:

all

12.242. Find_all_references crash with empty files

Find_all_references could crash if one or several source files in the project was empty. This is because those are parsed as empty lists of compilation units which was unexpected. This is now correctly handled.

tn:

SB05-054

apis:

all

12.243. Fix BasicDecl.doc not working on generic packages

The BasicDecl.doc property was not working correctly on generic packages, returning wrong or no documentation.

tn:

SB08-016

apis:

all

12.244. Resolution of array slices

So far name resolution would fail on complex array accesses involving slices. That was because those were not taken into account at all in our many parts of our name resolution mechanism. This patch adds support for them in the bottom-up name resolution mechanism.

tn:

SA24-035

apis:

all

12.245. Fix doc’s leading whitespace stripping

The p_doc property previously stripped leading whitespace according to the leading whitespace of the first line, and raised a Property_Error if that caused stripping non whitespace characters on subsequent lines. Now, it takes the least indented line as a reference for stripping.

tn:

SA15-023

apis:

all

12.246. Resolution of calls to entries of SingleTaskTypeDecl

So far name resolution was failing on calls to an entry defined in a Task declaration (not a task type declaration). This was because SingleTaskTypeDecl would not reimplement the defining_env primitive which we use to retrieve names defined by this type. This change provides the implementation of this primitive for a SingleTaskTypeDecl node.

tn:

SA22-011

apis:

all

12.247. Resolution of top-level child generic subp bodies

So far name resolution could fail in certain cases when trying to resolve references inside a top-level generic child subprogram body, in particular those that would refer to names declared in the private part of the parent unit, because the body would not have full visibility on the parent. This change fixes this by adjusting the env spec of generic subp decls to rectify the parent env.

tn:

SA22-010

apis:

all

12.248. Duplicates in the output of p_find_all_overrides

The output of the p_find_all_overrides property could in certain cases contain multiple instances of the same override. This change makes sure it does not anymore.

tn:

SA22-009

apis:

all

12.249. Resolution of separate generic subprograms

So far name resolution would fail when trying to resolve references to generic parameters in the body of separate generic subprogram. That was because the lexical env containing the generic parameters was not accessible from within the separate. This change fixes this by weakening the condition necessary to add a referenced_env to the generic formal part, which separate bodies now satisfy.

tn:

SA08-022

apis:

all

12.250. Handle parsing errors in with clauses

When working on incomplete with clauses (for instance due to a parsing error), name resolution used to raise a Constraint_Error. This is now fixed.

tn:

SA08-038

apis:

all

12.251. Handle Pred/Succ attributes in static evaluator

So far, the static evaluator wouldn’t properly evaluate Pred and Succ attributes, which could in turn cause failures in name resolution. This is now handled.

tn:

SA04-042

apis:

all

12.252. Handle full type view resolution correctly for operators

So far, when using user defined operators, the full view of the type might not be correctly resolved. This is now fixed.

tn:

SA04-044

apis:

all

12.253. Handle missing standard & implementation defined attributes

We implemented name resolution for a lot of attributes that were missing, both standard and implementation defined. The common characteristic is being supported by GNAT.

Here is the full list: Ceiling, Floor, Rounding, Callable, Type_Class, Storage_Pool, Width, Component_Size, Position, Mantissa, Model_Mantissa, Machine_Mantissa, Fore, Aft, Digits, Modulus, Epsilon, Model_Epsilon, Safe_Large, Safe_Small.

In addition, resolution for unhandled attributes now fails explicitly.

tn:

SA04-043

apis:

all

12.254. Fix association of pragma Volatile

pragma Volatile is now correctly associated with the declaration referenced by the first argument.

tn:

SB25-043

apis:

all

12.255. Handle full type view resolution correctly in case of hiding

In some complex situations where an entity similarly caused hiding, full view of a type might not be resolved correctly, causing name resolution failures.

tn:

SA04-045

apis:

all

12.256. Resolution of binop for private types with scalar completion

So far name resolution did fail on some very simple cases where a type is private but is a scalar type in the private view, such as:

procedure Test_Binop_Res is
   package P is
      type A is private;
   private
      type A is range 1 .. 20;
   end P;

   package body P is
      C : A := 12;
      B : A := 12 * C;
      pragma Test_Statement;
   end P;
begin
   null;
end Test_Binop_Res;

This is because the resolution of built-in operators resolved to the canonical type to get the base subtype, which is wrong. This is now fixed.

tn:

SA02-027

apis:

all

12.257. Resolve more SPARK specific attributes and pragmas

Some SPARK specific pragmas and attributes were not yet resolved. The Loop_Invariant pragma and the Loop_Entry attribute were not resolved correctly. In addition, some bugs wrt. indexing the result of some attributes, such as 'Old/'Loop_Invariant have been fixed.

tn:

S906-013

apis:

all