Skip to content

Fix broken string interpolation in LlvmIrInstructions error messages#11431

Open
Copilot wants to merge 3 commits into
mainfrom
copilot/fix-broken-string-interpolation
Open

Fix broken string interpolation in LlvmIrInstructions error messages#11431
Copilot wants to merge 3 commits into
mainfrom
copilot/fix-broken-string-interpolation

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 21, 2026

Two error messages in LlvmIrInstructions.cs have broken string interpolation:

  • Line 163: Missing {} around cond.Type — prints literal text instead of the variable value
  • Line 221: Missing closing ' after {function.Signature.ReturnType} interpolation
// Before
$"... was 'cond.Type' instead"
$"... returns '{function.Signature.ReturnType} and thus ..."

// After
$"... was '{cond.Type}' instead"
$"... returns '{function.Signature.ReturnType}' and thus ..."

Agent-Logs-Url: https://github.com/dotnet/android/sessions/b8dbee6b-c452-44fd-a586-1d0010f4a375

Co-authored-by: jonathanpeppers <840039+jonathanpeppers@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix broken string interpolation in LlvmIrInstructions error messages Fix broken string interpolation in LlvmIrInstructions error messages May 21, 2026
Copilot AI requested a review from jonathanpeppers May 21, 2026 02:53
@jonathanpeppers jonathanpeppers marked this pull request as ready for review May 21, 2026 13:24
Copilot AI review requested due to automatic review settings May 21, 2026 13:24
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes two internal error message strings in the LLVM IR generator so they correctly interpolate values (and have balanced quotes), improving diagnosability of generator failures.

Changes:

  • Corrected string interpolation for cond.Type in Br validation error.
  • Fixed missing closing quote around {function.Signature.ReturnType} in Call validation error.

Comment on lines 219 to 222
if (function.Signature.ReturnType != typeof(void)) {
if (result == null) {
throw new ArgumentNullException ($"Internal error: function '{function.Signature.Name}' returns '{function.Signature.ReturnType} and thus requires a result variable", nameof (result));
throw new ArgumentNullException ($"Internal error: function '{function.Signature.Name}' returns '{function.Signature.ReturnType}' and thus requires a result variable", nameof (result));
}
The ArgumentNullException(string? paramName, string? message) constructor takes paramName first and message second. Both call sites had them swapped, which would produce confusing exceptions where ParamName was the full English sentence.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[fix-finder] Fix broken string interpolation in LlvmIrInstructions error messages

3 participants