Assertion failed in SourceAttachment when using custom disambiguator
Hit this assert:
public static void putSource(ISimpleTerm term, IResource resource, IParseController controller) {
ISimpleTerm root = ParentAttachment.getRoot(term);
assert term == root;
root.putAttachment(new SourceAttachment(resource, controller));
}
when using a custom disambiguator.I think that is relevant, because:
term == File(None,Chunk(…))
root == amb([ Chunk(…),
File(None,Chunk(…)) ])
which exactly matches the custom disambiguation step I perform.Stack:
SourceAttachment.putSource(ISimpleTerm, IResource, IParseController) line: 77
CustomDisambiguator.transferAttachments(IStrategoTerm, IStrategoTerm) line: 86
CustomDisambiguator.disambiguate(IStrategoTerm) line: 72
SGLRParseController.parse(String, IProgressMonitor) line: 291
SGLRParseController.parse(String, IProgressMonitor) line: 1
DynamicParseController.parse(String, IProgressMonitor) line: 169
ParserScheduler.run(IProgressMonitor) line: 86
Worker.run() line: 54Spoofax r23335
Submitted by Tobi Vollebregt on 14 September 2011 at 22:32
Issue Log
SourceAttachments should only appear at the very top of an AST. That assertion checks if you’re not accidentally trying to assign one to a node that is not at the top. I guess the CustomDisambiguator should remove the parent of the result so it’s the new root.
Yeah, I just figured that out. With a bit of luck I have this one fixed tonight.
Log in to post comments