Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

internal: SCIP: Qualify parameters by the containing function #15393

Merged
merged 1 commit into from Aug 5, 2023

Conversation

Wilfred
Copy link
Contributor

@Wilfred Wilfred commented Aug 4, 2023

SCIP requires symbols to be unique, but multiple functions may have a parameter with the same name. Qualify parameters according to the containing function.

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Aug 4, 2023
SCIP requires symbols to be unique, but multiple functions may have a
parameter with the same name. Qualify parameters according to the
containing function.
@Veykril
Copy link
Member

Veykril commented Aug 5, 2023

Hmm, that makes me wonder what should be done with the following snippet:

fn f() {
	let x = 0;
	let x = 1;
}

?
@bors r+

@bors
Copy link
Collaborator

bors commented Aug 5, 2023

📌 Commit edabffb has been approved by Veykril

It is now in the queue for this repository.

@bors
Copy link
Collaborator

bors commented Aug 5, 2023

⌛ Testing commit edabffb with merge 27e2eea...

@bors
Copy link
Collaborator

bors commented Aug 5, 2023

☀️ Test successful - checks-actions
Approved by: Veykril
Pushing 27e2eea to master...

@bors bors merged commit 27e2eea into rust-lang:master Aug 5, 2023
10 checks passed
@lnicola lnicola changed the title SCIP: Qualify parameters by the containing function internal: SCIP: Qualify parameters by the containing function Aug 5, 2023
@Wilfred Wilfred deleted the full_moniker_param branch August 8, 2023 17:10
@Wilfred
Copy link
Contributor Author

Wilfred commented Aug 8, 2023

@Veykril for locals specifically, they get a unique number, so that case works:

let mut new_local_symbol = || {
let new_symbol = scip::types::Symbol::new_local(local_count);
local_count += 1;
new_symbol
};

However, you can still get name clashes for parameters, if you have nested functions or lambdas.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-review Status: Awaiting review from the assignee but also interested parties.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants