AdaCore / AdaCore/libadalang

errors on file-not-found

Open
#532 1 comment 0 reactions 1 assignee View on GitHub

@raph-amiard is already working on this.

Since Jun 22, 2020.

enhancement
Dominant language
Ada
Stars
171
Forks
48
PR merge metrics
No merged PRs in 30d

Description

In the context of a code generator, I am analyzing existing Ada package via python scripts, using libadalang.
The Context is built via UnitProvider.for_project()

It happens that users feed non-compiling Ada units to the code generator (because the generator runs before the compiler). One case of error is a with clause that points to an Ada package not found in the loaded project (missing a with clause in the project itself for instance).

In this case, libadalang reports no error that I can see, and soldiers on with whatever semantic analysis it can perform despite this missing file. This is a nice behavior in some contexts (an IDE), but not for a code generator. As a result, I end up with None types in the generator, and have to handle all such cases explicitly.

It would be much better if I could get an error (or a callback that let's me handle those errors and decide) when a with clause cannot be resolved.

Did I miss something in the API ?

If not, can this be added as an enhancement request please ?

Thanks

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.