Open UnkindPartition opened 10 years ago
Note that this is partially addressed by 9de7622334027eb07bb6e979e48d6fdf1fef7788.
But since we're continuing to use fail
, we don't get locations for fixity errors.
Does applyFixities
(the annotated version) have to take ASTs annotated with SrcSpanInfo
, or would other annotations also work?
Good question.
One reason why applyFixities
requires SrcSpanInfo
annotations is because it constructs new AST nodes and has to come up with annotations for them. And it's not just a matter of using some default annotation — e.g. with SrcSpanInfo
it has to merge the annotations of the children to compute the right span, see here.
The other reason is to be able to report the location of fixity errors, according to the plan above.
So, yes, it needs to be more or less SrcSpanInfo
.
applyFixities
must returnParseResult
and report the location of the fixity errorAppFixity Exp
instance,fail
should be replaced withParseFailure
InternalParser
, use monadic composition when applying fixities.