fix: refuse to generate code for imported parsers to avoid duplicate declarations

This commit is contained in:
Sebastian Ullrich 2020-10-16 17:52:18 +02:00
parent 9f6821d685
commit 73065860f3

View file

@ -68,6 +68,8 @@ match e with
-- synthesize a new `[combinatorAttr c]`
some value ← pure cinfo.value?
| throwError $ "don't know how to generate " ++ ctx.varName ++ " for non-definition '" ++ toString e ++ "'";
none ← pure $ env.getModuleIdxFor? c
| throwError $ "refusing to generate code for imported parser declaration '" ++ c ++ "'; use `@[runParserAttributeHooks]` on its definition instead.";
value ← compileParserBody $ preprocessParserBody ctx value;
ty ← forallTelescope cinfo.type fun params _ =>
params.foldrM (fun param ty => do