Closed jonmeow closed 1 month ago
Note an alternative here is to just stop validating so much, removing ReusingLoc
and just provide the LocId
constructor.
I'm hoping @zygoloid has time to review before vanishing, but @josh11b I thought you might make a good backup since you added a lot of the NodeId restrictions.
(I'm not merging because I can't tell whether @zygoloid's concerns have been addressed)
FWIW, while I'm not sure they have either, I do think they've been captured in a TODO and we should be able to revisit this in the future. I don't think we need to block this PR, especially with vacation.
I don't think we need to block this PR, especially with vacation.
Just to be clear, I didn't intend to block this (hence my approval), I just intended to let @jonmeow make the decision about whether it was ready to merge.
The TODO for switching to ReusingLoc (previously Untyped) had been there for a while, so I'm trying to address it here. The intent had been to be clearer about when the construction is validated, particularly so that we aren't accidentally accepting an incorrect NodeId. Note, this does fix an incorrect use of InvalidNodeId where NoLoc should've been called.
Since this changes the semantics of when
Parse::NodeId
is helpful intyped_nodes.h
, I'm doing a pass to either refine or switch toParse::InvalidNodeId
where it compiles. I think most remainingParse::NodeId
examples are things we should be able to refine with a little more work (versus before whereParse::NodeId
also indicatedLocId
construction might be used).I'm also changing context.h to use
requires
that match whatLocIdAndInst
has, I think it makes the diagnostics a little better. And note I do add an overload forImportIRInstId
, also matchingLocIdAndInst
, and widely used for import refs.