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

module_disambiguation: module identifier is also substituted in body #27

Closed
Emoun opened this issue Jun 1, 2021 · 1 comment
Closed
Labels
D-discussion A decision (D) has not been made yet and is open to discussion I-bug This issue (I) regards a (potential) bug in the project T-accepted Triage (T): Initial review accepted issue/PR as valid

Comments

@Emoun
Copy link
Owner

Emoun commented Jun 1, 2021

Situation:

When using module disambiguation, the module identifier is also substituted if found anywhere in the module body.
This is a problems, since that might not be the desired behavior all the time.
E.g. we might have a struct using the same identifier that we wouldn't want to substitute.

In essence, the feature should disambiguate the module declaration and nothing else.
If users want to use the final modules' names, then they should need to use explicit substitutions.

Reproduction:

#[duplicate(
	value; [value1]; [value2]
)]
mod StructIdent {
	fn some_fn() -> StructIdent {
		StructIdent(value)
	}
}

Expected Behavior:

mod StructIdent_value1 {
    fn some_fn() -> StructIdent_value1 {
        StructIdent(value1)
    }
}
mod StructIdent_value2 {
    fn some_fn() -> StructIdent_value2 {
        StructIdent(value2)
    }
}

Actual Behavior:

mod StructIdent_value1 {
    fn some_fn() -> StructIdent_value1 {
        StructIdent_value1(value1)
    }
}
mod StructIdent_value2 {
    fn some_fn() -> StructIdent_value2 {
        StructIdent_value2(value2)
    }
}

Affected Versions:

Local Environment:

Miscellaneous:

@Emoun Emoun added D-discussion A decision (D) has not been made yet and is open to discussion I-bug This issue (I) regards a (potential) bug in the project T-accepted Triage (T): Initial review accepted issue/PR as valid labels Jun 1, 2021
@Emoun Emoun changed the title module_disambiguation: module name is substituted in body too module_disambiguation: module identifier is also substituted in body Jun 1, 2021
@Emoun
Copy link
Owner Author

Emoun commented Jun 8, 2021

Implemented to be released in next version

@Emoun Emoun closed this as completed Jun 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
D-discussion A decision (D) has not been made yet and is open to discussion I-bug This issue (I) regards a (potential) bug in the project T-accepted Triage (T): Initial review accepted issue/PR as valid
Projects
None yet
Development

No branches or pull requests

1 participant