Fix MATLAB in-out parameter semantics when input and output share a name#217
Open
Fix MATLAB in-out parameter semantics when input and output share a name#217
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
Description
fn lookup_current_scope(&self, name: &str) -> Option<VarId>and reusing thatVarIdinstead of defining a new one duringAstStmt::Functionlowering incrates/runmat-hir/src/lib.rs.function_output_reuses_param_binding_when_names_matchincrates/runmat-hir/tests/coverage.rsthat asserts the output reuses the parameterVarIdand that body references resolve to the shared binding.shared_input_output_name_behaves_like_in_out_parameterandshared_input_output_name_preserves_input_value_for_other_outputsincrates/runmat-ignition/tests/functions.rsto verify single-output and multi-output shared-name behaviors at execution time.Testing
cargo test -p runmat-hir function_output_reuses_param_binding_when_names_match -- --nocapture, which passed.cargo test -p runmat-ignition shared_input_output_name -- --nocapture, which passed both added runtime tests.cargo fmt --allto format changes.Codex Task
Note
Medium Risk
Changes core function-lowering symbol binding semantics, which can affect variable resolution across many functions; scope is small and covered by new HIR and runtime regression tests.
Overview
Fixes MATLAB in/out parameter semantics during HIR lowering by reusing the existing parameter
VarIdwhen a function output name matches an already-defined binding in the current function scope (via newlookup_current_scope).Adds regression coverage at both the HIR level (verifying shared param/output IDs and body variable resolution) and runtime level in
runmat-ignition(verifying single- and multi-output shared-name behavior).Written by Cursor Bugbot for commit aa92e53. This will update automatically on new commits. Configure here.