Skip to content

Correctly set the parent DeclContext of ParamDecls in EnumElementDecls #27583

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

Merged
merged 2 commits into from
Oct 9, 2019

Conversation

slavapestov
Copy link
Contributor

The parent used to be the EnumDecl itself. When EnumElementDecls were refactored to themselves be DeclContexts we never updated this part. It's not really important right now, but my validateDecl() request-ification changes require that the parent DeclContext of a ParamDecl is correctly set.

When an EnumElementDecl is parsed, we create the parameter list before
creating the EnumElementDecl itself, so we have to re-parent those
ParamDecls just like we do for functions and subscripts.
@slavapestov
Copy link
Contributor Author

@swift-ci Please smoke test

@slavapestov
Copy link
Contributor Author

@swift-ci Please test source compatibility

Copy link
Contributor

@CodaFi CodaFi left a comment

Choose a reason for hiding this comment

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

Thanks Slava!

// Read payload parameter list, if it exists.
if (hasPayload) {
auto *paramList = MF.readParameterList();
elem->setParameterList(paramList);
Copy link
Contributor

Choose a reason for hiding this comment

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

Instead of delaying this, would it make more sense to serialize ParamDecls without a DeclContext?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That sounds sensible. I'll take a crack at it.

@slavapestov slavapestov merged commit f5dd971 into swiftlang:master Oct 9, 2019
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.

3 participants