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

Reverted internal prefix for every backend except Dafny #5538

Merged
merged 6 commits into from
Jun 10, 2024

Conversation

MikaelMayer
Copy link
Member

Description

Some clients using Smithy-Dafny were stuck because we changed the internal field prefix. We revert it in this PR by convenience for them as we don't have an immediate need for this enhanced prefix.

How has this been tested?

All tests should pass.

By submitting this pull request, I confirm that my contribution is made under the terms of the MIT license.

robin-aws
robin-aws previously approved these changes Jun 7, 2024
Copy link
Member

@robin-aws robin-aws left a comment

Choose a reason for hiding this comment

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

LGTM, although where is the second definition of this prefix that the Dafny-based backends are still using?

@@ -29,7 +29,7 @@ public abstract partial class SinglePassCodeGenerator {
// we can prefix it with "_".
// However, for backends such as Rust which need special internal fields, we want to clearly
// disambiguate between compiler-generated names and user-defined names, hence this prefix.
Copy link
Member

Choose a reason for hiding this comment

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

Not worth extra CI runs to fix, but sounds like this comment isn't accurate any more?

Copy link
Member Author

Choose a reason for hiding this comment

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

Not completely accurate, but still indicates why this prefix isn't hard-coded at least.

@MikaelMayer
Copy link
Member Author

LGTM, although where is the second definition of this prefix that the Dafny-based backends are still using?

It's here

protected virtual string InternalFieldPrefix => "_i_";

It's used here:

return new DafnyCodeGenerator(Options, Reporter, InternalFieldPrefix, PreventShadowing, CanEmitUncompilableCode);

and it's overriden in the Dafny code generator using this assigned private variabe

protected override string InternalFieldPrefix => internalFieldPrefix;

@robin-aws robin-aws enabled auto-merge (squash) June 7, 2024 17:10
// However, for backends such as Rust which need special internal fields, we want to clearly
// disambiguate between compiler-generated names and user-defined names, hence this prefix.
protected virtual string InternalFieldPrefix => "_i_";
// This prefix can be overridden as necessary by backends.
Copy link
Member

Choose a reason for hiding this comment

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

Thanks :)

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.

None yet

2 participants