[v2] feat(diagnostics): Check double override across definitions#1843
Conversation
|
There was a problem hiding this comment.
Pull request overview
Adds a new v2 syntax diagnostic that rejects repeated override specifiers on a single definition, aligning Slang v2 diagnostics with solc behavior for this parse-time error class.
Changes:
- Introduces
MultipleOverrideSpecifiersdiagnostic kind undersyntax/*. - Updates the v2 CST→IR builder to extract the first
overridespecifier and emit diagnostics for any subsequent ones (functions, fallback/receive functions, modifiers, state variables). - Adds diagnostics snapshot fixtures and generated test wiring to cover the new cases.
Reviewed changes
Copilot reviewed 9 out of 20 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| crates/solidity-v2/outputs/cargo/ir/src/ir/builder/mod.rs | Emits MultipleOverrideSpecifiers when more than one override specifier appears in attributes. |
| crates/solidity-v2/outputs/cargo/common/src/diagnostics/kinds/syntax/multiple_override_specifiers.rs | Defines the new syntax diagnostic (code, severity, message). |
| crates/solidity-v2/outputs/cargo/common/src/diagnostics/kinds/syntax/mod.rs | Registers and re-exports the new diagnostic kind in the syntax diagnostics enum. |
| crates/solidity-v2/outputs/cargo/tests/src/diagnostics_output/snapshots.generated.rs | Adds snapshot test entries for the new multiple_override_specifiers fixtures. |
| crates/solidity-v2/testing/snapshots/diagnostics_output/syntax/multiple_override_specifiers/** | Adds new snapshot inputs and expected solc/slang outputs for functions, fallback/receive, modifiers, and state variables. |
| crates/solidity-v2/outputs/cargo/common/generated/public_api.txt | Updates public API surface to include the new diagnostic kind. |
|
| Branch | teofr/validate-multiple-override-specifier |
| Testbed | ci |
⚠️ WARNING: Truncated view!The full continuous benchmarking report exceeds the maximum length allowed on this platform.
⚠️ WARNING: No Threshold found!Without a Threshold, no Alerts will ever be generated.
🚨 3 Alerts
🐰 View full continuous benchmarking report in BencherReject functions, fallback/receive functions, modifiers, and state variables that carry more than one `override` specifier, matching solc's ParserError 1827/9125/9102. Closes the SDR[9] and SDR[12] validation TODOs and the `override` part of SDR[1730] in the IR builder.
c99bda4 to
5614c7e
Compare
Reject functions, fallback/receive functions, modifiers, and state variables that carry more than one
overridespecifier.Note: It doesn't check if the
overridespecifier is legal, that's a typechecker responsibility.Fixes https://github.com/NomicFoundation/slang-diagnostics-research/issues/1730
Fixes https://github.com/NomicFoundation/slang-diagnostics-research/issues/1638
Fixes https://github.com/NomicFoundation/slang-diagnostics-research/issues/786
Fixes https://github.com/NomicFoundation/slang-diagnostics-research/issues/1635
Fixes https://github.com/NomicFoundation/slang-diagnostics-research/issues/9
Fixes https://github.com/NomicFoundation/slang-diagnostics-research/issues/12