Duplicate definitions after refactor
Starting from a vanilla Spoofax project, you get
Duplicate definition
errors for entities and properties after doing arename-entity
(or any other) refactor.
It may be the index library that has changed quite a bit lately.Not sure if this is related, but I’m also getting the following error with each refactor:
Internal error: strategy does not exist or is defined in a module that is not imported: Definition 'parenthesize-EntityLang' not found
And sometimes:
Submitted by Oskar van Rest on 16 May 2012 at 03:39[ EntityLang | error ] Unable to open file: "D:/workspace4/EntityLang" EntityLang: rewriting failed, trace: editor_parallel_analyze_0_0 index_parallel_analyze_files_1_0 index_parallel_analyze_1_0 map_1_0 parse_file_0_0 parse_entitylang_file_0_0 parse_file_2_1 parse_file_2_3 [ EntityLang | critical ] Internal error: with clause failed unexpectedly in rule 'index-parse-file' "D:/workspace4/EntityLang"
Issue Log
Hmm, I haven’t thoroughly tested the index with refactoring. Does refactoring just change text and queue a re-analysis of the file or does it some stuff internally?
The last error you show might indicate that the index is being used from multiple threads without thread-safeness. You need to wrap strategies that access or change the index from multiple threads with an index-transaction(s) strategy.
I believe it just changes the actual file and then triggers a re-analysis as follows:
//Queue analysis for affected asts, //dyn rules may be out of sync after re-analysis asts + abort refactoring) private static void queueAnalysisAffectedFiles(IRefactoring refactoring, EditorState editor) { IProject project = editor.getProject().getRawProject(); for (IPath projectRelativePath : refactoring.getRelativePathsOfAffectedFiles()) { StrategoAnalysisQueueFactory.getInstance().queueAnalysis(projectRelativePath, project, true); } }
Not sure what goes wrong there. My
example.ent
does get queued in that for-loop.
What is happening is that the refactor code is invoking editor-analyze with both the path and project-path set to the empty string. This messes up the index since it relies on the path to be a correct path.
Is fixed now.
this bug is back
(in the nightly)
Never mind. http://spoofax.org/update/nightly redirects to an old build. Bug is fixed in the newest build.
Log in to post comments