carbon-language / carbon-lang

Carbon Language's main repository: documents, design, implementation, and related tools. (NOTE: Carbon Language is experimental; see README)
http://docs.carbon-lang.dev/
Other
32.24k stars 1.48k forks source link

Implement syntactic merge checks for parameters. #4149

Closed jonmeow closed 2 months ago

jonmeow commented 2 months ago

Note this isn't implementing checking through imports. The parse node there is harder to access through the context, so would require examining the entity in order to get the import declaration, to get at the ImportIR. We also don't have a parse tree attached in that case, and would need to add one to SemIR::File. But I believe we do want to add that, so it's explicitly a TODO.

Note GetTokenText re-lexes literal values, so there's a bit of potential overhead there. Not sure if we want a more efficient manner for comparing in cases like this.

josh11b commented 2 months ago

Please find another reviewer, as I'll be on vacation for the next two weeks.

jonmeow commented 2 months ago

Another edge case that would be useful to explicitly test (mostly because we've had discussions about using a different rule) is grouping parentheses differing between declarations.

Added test

Also, made me realize I wasn't testing deduced params explicitly, so added that too.

jonmeow commented 2 months ago

Per discussion, added a test for r# identifiers (because you'd mentioned them in a comment), and made them a TODO