metaborg / nabl

Spoofax' Name Binding Language
Apache License 2.0
7 stars 12 forks source link

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

Open jochembroekhoff opened 2 years ago

jochembroekhoff commented 2 years ago

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

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 commented 2 years ago

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