Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot retrieve scope data from scopes outside of the current analysis context with concurrent solver enabled #94

Open
jochembroekhoff opened this issue Apr 11, 2022 · 1 comment

Comments

@jochembroekhoff
Copy link
Contributor

Bug description
The stx-get-scopegraph-data API method returns the empty list if the given scope is not part of the current analysis context.

Versions
Spoofax version: 2.5.16.
Statix setup: multi-file, concurrent solver enabled.

Steps to reproduce the behavior

  • Create two files where the second file somehow references a scope of the first file.
  • The scope must be declared in the first file and have some data on it declared.
  • When transforming the second file, retrieve this particular Scope/2 instance.
  • Retrieve the analysis context using stx-get-ast-analysis, for a term of the second file.
  • Call the API method, e.g. <stx-get-scopegraph-data(|a, "identifier/of!relation")> s.
  • Observe that the result is always [].

Observed behavior
The result is the empty list.

Expected behavior
The result is not necessarily the empty list, but the actual relevant members.

Additional context
Original Slack thread: https://slde.slack.com/archives/C7254SF60/p1649660409194699.

Workaround

stx-get-scopegraph-data-ext(|a, rel) = ?s
; stx-get-scopegraph-data(|a, rel)
; try(
    ?[]; !s
    // extract the resource identifier from the scope and drop the "/./" prefix
  ; where(Scope(string-as-chars(drop(|3)) => resource, id))
    // attempt to retrieve the analysis state from the external scope
  ; where(a' := <stx-get-ast-analysis> (){TermIndex(resource, -1)})
    // re-execute in the external context
  ; stx-get-scopegraph-data(|a', rel)
  )
@AZWN
Copy link
Contributor

AZWN commented Apr 19, 2022

As discussed, this is an important issue to solve. Thanks for reporting!

@AZWN AZWN changed the title Cannot retrieve scope data from scopes outside of the current alaysis context with concurrent solver enabled Cannot retrieve scope data from scopes outside of the current analysis context with concurrent solver enabled May 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants