metaborg / nabl

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

Incremental analysis gives errors when language id is interpolated #95

Open MeAmAnUsername opened 2 years ago

MeAmAnUsername commented 2 years ago

Bug description The incremental analysis gives an error when the Statix specification is for a language that uses yaml interpolation for its id

Versions Eclipse: org.eclipse.platform.ide 4.16.0.I20200604-0540 Spoofax: org.metaborg.spoofax.eclipse 2.6.0.20220405-144549-master System: Mac OS X x86_64 10.14.6 Statix setup: multi-file

Steps to reproduce the behavior

  1. Check out the PIE DSL language project in eclipse (metaborg/pie/lang/lang)
  2. Create a normal project and add metaborg.yaml with a compile dependency on PIE.
  3. Create an example test.pie file in the normal project
  4. Add
    statix:
    mode: incremental

    in metaborg/pie>metaborg.yaml (before language.stratego)

  5. Restart eclipse and rebuild the PIE project

Observed behavior Error:

18:00 | ERROR | .m.s.c.s.p.AResourcesPrimitive - Could not find lib/stxlibs
18:00 | ERROR | o.m.c.b.p.LanguagePathService  - Getting source paths from provider org.metaborg.core.build.paths.DependencyPathProvider@22277482 failed unexpectedly, skipping this provider
org.metaborg.core.build.dependency.MissingDependencyException: Language for dependency org.metaborg:pie.lang:${pie.version} does not exist

See buildLog.txt for full log. This always happens, immediately after building and also after every edit to the pie file (if the edit triggers an analysis). The file is correctly analyzed though, the error does not seem to break anything. This error does not occur in PIE files in the PIE project itself, only in the project that imports the PIE language.

Expected behavior No error

Additional context I have tried to create a minimal project, but I could not reproduce it. This issue is made in the hope that you go "ah, should have used a different method to resolve those interpolations".

AZWN commented 2 years ago

To me, this seems not so much a Statix issue as well as a Spoofax issue. Two questions:

MeAmAnUsername commented 2 years ago

To me, this seems not so much a Statix issue as well as a Spoofax issue.

Certainly possible, although this is the first time I have seen this error, so I assume that it is something specific to Statix.

Does pie.version also exist in the new sandbox project you made.

Yes

Are you aware that in 'example projects', the language name (perhaps PieLang) should be used, not mode? See the config for details.

Yes. Also, I have two projects for my minimum example:

  1. bugStatixYamlInterpolation, which defines the language and sets the solver mode
  2. bugStatixYamlInterpolation2, which depends on bugStatixYamlInterpolation using a compile dependency in metaborg.yaml and does not set the statix solver (i.e. inherits from bugStatixYamlInterpolation)

bugStatixYamlInterpolation/metaborg.yaml:

statixBug:
  version: 0.1.0-SNAPSHOT
id: org.example:bugStatixYamlInterpolation:${statixBug.version}
name: bugStatixYamlInterpolation
[...]
language:
  [...]
  statix:
    mode: incremental
[...]

bugStatixYamlInterpolation2/metaborg.yaml:

statixBug.version: 0.1.0-SNAPSHOT

dependencies:
  compile:
#  - org.example:bugStatixYamlInterpolation:${statixBug.version} using this works without issue, but the equivalent in the PIE sandbox project does not work
  - org.example:bugStatixYamlInterpolation:0.1.0-SNAPSHOT
runtime:
  statix:
    message-trace-length: 10 # default: 0, full trace: -1
    message-term-depth: 5 # -1 = max