"run strategy" expectation fails if there is no analysis
Create a new Spoofax Language project with Project name: dummy, Analysis type: None, create x.spt with the following contents:
module x language dummy test foo [[ ]] run id
The error log shows the following exception:
org.metaborg.core.analysis.AnalysisException: Analysis for eclipse:///dummy/x.spt failed at org.metaborg.spoofax.core.analysis.legacy.StrategoAnalyzer.analyze(StrategoAnalyzer.java:179) at org.metaborg.spoofax.core.analysis.legacy.StrategoAnalyzer.analyze(StrategoAnalyzer.java:100) at org.metaborg.spoofax.core.analysis.legacy.StrategoAnalyzer.analyze(StrategoAnalyzer.java:1) at org.metaborg.core.analysis.AnalysisService.analyze(AnalysisService.java:30) at org.metaborg.spoofax.core.analysis.SpoofaxAnalysisService.analyze(SpoofaxAnalysisService.java:20) at org.metaborg.spoofax.core.analysis.SpoofaxAnalysisService.analyze(SpoofaxAnalysisService.java:1) at org.metaborg.spoofax.eclipse.editor.EditorUpdateJob.analyze(EditorUpdateJob.java:362) at org.metaborg.spoofax.eclipse.editor.EditorUpdateJob.update(EditorUpdateJob.java:289) at org.metaborg.spoofax.eclipse.editor.EditorUpdateJob.run(EditorUpdateJob.java:144) at org.eclipse.core.internal.jobs.Worker.run(Worker.java:56) Caused by: org.metaborg.core.MetaborgException: Invoking Stratego strategy editor-analyze failed unexpectedly Stratego trace: editor_analyze_0_0 org.spoofax.interpreter.core.InterpreterException: Exception during evaluation: null at org.metaborg.spoofax.core.stratego.StrategoCommon.handleException(StrategoCommon.java:150) at org.metaborg.spoofax.core.stratego.StrategoCommon.invoke(StrategoCommon.java:111) at org.metaborg.spoofax.core.analysis.legacy.StrategoAnalyzer.analyze(StrategoAnalyzer.java:155) ... 9 more
It looks like the “run strategy” test expectation forces analysis, even if the project has no analysis.
Submitted by Martijn on 16 November 2018 at 12:29
Issue Log
It would seem that all Spoofax internals around running no analysis are wonky :(
If you have time, can you investigate what Spoofax APIs are currently used by SPT for “run strategy”? I assume something more low-level than the Builder API, but then I wouldn’t expect any issues because you need to handle analysis yourself… Unless it doesn’t check the project settings to see if analysis is available :|
If I have time I will do some exploring. For now, I worked around this by adding a dummy legacy analyzer. Might be useful in case anyone finds this through Google.
Main.esv
module Analysis language observer : editor-analyze context : legacy
language.str
rules // Add analysis to prevent SPT from crashing (https://yellowgrass.org/issue/SPTWithCore/41) editor-analyze: (ast, path, project-path) -> (ast, [], [], [])
Log in to post comments