The Slang frontend reports every diagnostic as an error, including warnings

Open Beginner friendly
#714 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
88/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
solidity
Domain
compilers

Research direction

Start in solx-slang/src/slang/mod.rs:134-150 and inspect the diagnostic mapping, then check the bail at line 162 and the DiagnosticExtensions trait usage. Run the affected solx-mlir/tests/lit/ fixtures, including the missing-version-pragma case; done means warnings are emitted without stopping compilation, while errors still do.

Written by the indexing model from the issue text.

Description

solx-slang/src/slang/mod.rs:134-150 maps every entry of unit.diagnostics() through OutputError::new_error_with_data without consulting diagnostic.severity(), and :162 then bails on output.has_errors(). So a Slang warning stops compilation and emits nothing.

The instance that surfaced it is syntax/missing-version-pragma, which Slang declares as DiagnosticSeverity::Warning and legacy solc also reports as a warning — Source file does not specify required compiler version!, compiling to bytecode with exit 0. Under Ground truth 1 solc defines behavior here, so solx should warn and carry on.

  • DiagnosticExtensions is already imported at mod.rs:13 for .message(); .severity() is on the same trait and is never called.
  • Every LIT fixture is affected: none of the 158 under solx-mlir/tests/lit/ declares a pragma, so 141 of them fail against a Slang revision that emits this diagnostic.
  • The tester corpus is mostly unaffected — 1236 of 1265 sources already declare one.
Dominant language
Solidity
Stars
186
Forks
20
Avg merge
2d 11h
Merged PRs (30d)
31

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from NomicFoundation/solx

All issues in NomicFoundation/solx

Similar issues

More Compilers issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.