Skip to content

Rename genericParameters to genericParameterClause for consistency. #1686

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

Conversation

TTOzzi
Copy link
Member

@TTOzzi TTOzzi commented May 21, 2023

Resolve #1678

Rename genericParameters to genericParameterClause for consistency.
Since the existing genericParameters was declared public, we left it with the deprecated attributes. (If we don't need to keep it, I'll remove it.)

@TTOzzi TTOzzi requested a review from ahoppen as a code owner May 21, 2023 12:06
@TTOzzi TTOzzi marked this pull request as draft May 21, 2023 12:29
@TTOzzi TTOzzi changed the title Rename genericParameters of EnumDeclSyntax Rename genericParameters to genericParameterClause for consistency. May 21, 2023
@TTOzzi TTOzzi marked this pull request as ready for review May 21, 2023 13:01
@TTOzzi
Copy link
Member Author

TTOzzi commented May 21, 2023

While working on this, I found a few more types that use genericParameters.
I renamed them all at once, if any further modifications are needed, please let me know.

@TTOzzi TTOzzi force-pushed the rename-genericParameters-of-EnumDeclSyntax branch from be4c17a to 5387d3e Compare May 21, 2023 13:07
Copy link
Member

@ahoppen ahoppen left a comment

Choose a reason for hiding this comment

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

@TTOzzi, you modified a lot of files that are generated using CodeGeneration. These changes will be reverted if you run CodeGeneration again (see https://github.com/apple/swift-syntax/blob/main/CodeGeneration/README.md).

What you need to do instead, is to modify the declaration of these types in the CodeGeneration package (in the CodeGeneration folder) and then run CodeGeneration as linked in the README I linked above.

As for the deprecated compatibility functions, can you add them to SyntaxCompatibility.swift?

@TTOzzi
Copy link
Member Author

TTOzzi commented May 23, 2023

@TTOzzi, you modified a lot of files that are generated using CodeGeneration. These changes will be reverted if you run CodeGeneration again (see https://github.com/apple/swift-syntax/blob/main/CodeGeneration/README.md).

What you need to do instead, is to modify the declaration of these types in the CodeGeneration package (in the CodeGeneration folder) and then run CodeGeneration as linked in the README I linked above.

As for the deprecated compatibility functions, can you add them to SyntaxCompatibility.swift?

Ah, I see! I didn't know there was such a convenient script!
I will make the changes again. Thank you for letting me know 🙇‍♂️

@TTOzzi TTOzzi requested a review from ahoppen May 23, 2023 11:05
@TTOzzi TTOzzi force-pushed the rename-genericParameters-of-EnumDeclSyntax branch from a7fbafe to 7e90576 Compare May 23, 2023 12:39
Copy link
Member

@ahoppen ahoppen left a comment

Choose a reason for hiding this comment

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

Thanks. This looks good to me. One minor comment: You don’t need to provide a compatibility layer for the RawSyntax nodes.

Also, in case you haven’t done so already: Can you please make sure that swift-syntax builds without warnings locally?

Comment on lines 31 to 114

public extension RawNamedOpaqueReturnTypeSyntax {
@available(*, deprecated, renamed: "unexpectedBeforeGenericParameterClause")
var unexpectedBeforeGenericParameters: RawUnexpectedNodesSyntax? { unexpectedBeforeGenericParameterClause }

@available(*, deprecated, renamed: "genericParameterClause")
var genericParameters: RawGenericParameterClauseSyntax? { genericParameterClause }

@available(*, deprecated, renamed: "unexpectedBetweenGenericParameterClauseAndBaseType")
var unexpectedBetweenGenericParametersAndBaseType: RawUnexpectedNodesSyntax? { unexpectedBetweenGenericParameterClauseAndBaseType }

@available(*, deprecated, message: "Use an initializer with a genericParameterClause argument.")
init(
_ unexpectedBeforeGenericParameters: RawUnexpectedNodesSyntax? = nil,
genericParameters: RawGenericParameterClauseSyntax,
_ unexpectedBetweenGenericParametersAndBaseType: RawUnexpectedNodesSyntax? = nil,
baseType: RawTypeSyntax,
_ unexpectedAfterBaseType: RawUnexpectedNodesSyntax? = nil,
arena: __shared SyntaxArena
) {
self.init(
unexpectedBeforeGenericParameters,
genericParameterClause: genericParameters,
unexpectedBetweenGenericParametersAndBaseType,
baseType: baseType,
unexpectedAfterBaseType,
arena: arena
)
}
}

public extension RawEnumDeclSyntax {
@available(*, deprecated, renamed: "unexpectedBetweenIdentifierAndGenericParameterClause")
var unexpectedBetweenIdentifierAndGenericParameters: RawUnexpectedNodesSyntax? { unexpectedBetweenIdentifierAndGenericParameterClause }

@available(*, deprecated, renamed: "genericParameterClause")
var genericParameters: RawGenericParameterClauseSyntax? { genericParameterClause }

@available(*, deprecated, renamed: "unexpectedBetweenGenericParameterClauseAndInheritanceClause")
var unexpectedBetweenGenericParametersAndInheritanceClause: RawUnexpectedNodesSyntax? { unexpectedBetweenGenericParameterClauseAndInheritanceClause }

@available(*, deprecated, message: "Use an initializer with a genericParameterClause argument.")
init(
_ unexpectedBeforeAttributes: RawUnexpectedNodesSyntax? = nil,
attributes: RawAttributeListSyntax?,
_ unexpectedBetweenAttributesAndModifiers: RawUnexpectedNodesSyntax? = nil,
modifiers: RawModifierListSyntax?,
_ unexpectedBetweenModifiersAndEnumKeyword: RawUnexpectedNodesSyntax? = nil,
enumKeyword: RawTokenSyntax,
_ unexpectedBetweenEnumKeywordAndIdentifier: RawUnexpectedNodesSyntax? = nil,
identifier: RawTokenSyntax,
_ unexpectedBetweenIdentifierAndGenericParameters: RawUnexpectedNodesSyntax? = nil,
genericParameters: RawGenericParameterClauseSyntax?,
_ unexpectedBetweenGenericParametersAndInheritanceClause: RawUnexpectedNodesSyntax? = nil,
inheritanceClause: RawTypeInheritanceClauseSyntax?,
_ unexpectedBetweenInheritanceClauseAndGenericWhereClause: RawUnexpectedNodesSyntax? = nil,
genericWhereClause: RawGenericWhereClauseSyntax?,
_ unexpectedBetweenGenericWhereClauseAndMemberBlock: RawUnexpectedNodesSyntax? = nil,
memberBlock: RawMemberDeclBlockSyntax,
_ unexpectedAfterMemberBlock: RawUnexpectedNodesSyntax? = nil,
arena: __shared SyntaxArena
) {
self.init(
unexpectedBeforeAttributes,
attributes: attributes,
unexpectedBetweenAttributesAndModifiers,
modifiers: modifiers,
unexpectedBetweenModifiersAndEnumKeyword,
enumKeyword: enumKeyword,
unexpectedBetweenEnumKeywordAndIdentifier,
identifier: identifier,
unexpectedBetweenIdentifierAndGenericParameters,
genericParameterClause: genericParameters,
unexpectedBetweenGenericParametersAndInheritanceClause,
inheritanceClause: inheritanceClause,
unexpectedBetweenInheritanceClauseAndGenericWhereClause,
genericWhereClause: genericWhereClause,
unexpectedBetweenGenericWhereClauseAndMemberBlock,
memberBlock: memberBlock,
unexpectedAfterMemberBlock,
arena: arena
)
}
}
Copy link
Member

Choose a reason for hiding this comment

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

The Raw don’t need to be stable. I’m adding some documentation about that in #1696

Copy link
Member Author

Choose a reason for hiding this comment

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

I have read the SPI.md document and removed the code intended for preserving the Raw type initializer 🙂

@TTOzzi TTOzzi force-pushed the rename-genericParameters-of-EnumDeclSyntax branch from 7e90576 to 5c39a2d Compare May 23, 2023 20:14
@TTOzzi
Copy link
Member Author

TTOzzi commented May 23, 2023

Also, in case you haven’t done so already: Can you please make sure that swift-syntax builds without warnings locally?

The build is being successful without any warnings on my local. Is there anything else I should check?

@TTOzzi TTOzzi requested a review from ahoppen May 23, 2023 20:17
Copy link
Member

@ahoppen ahoppen left a comment

Choose a reason for hiding this comment

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

Thank you

@ahoppen
Copy link
Member

ahoppen commented May 23, 2023

@swift-ci Please test

@ahoppen
Copy link
Member

ahoppen commented May 23, 2023

@swift-ci Please test Windows

@ahoppen ahoppen enabled auto-merge May 23, 2023 21:03
@ahoppen
Copy link
Member

ahoppen commented May 23, 2023

@swift-ci Please test Windows

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.

Inconsistent naming of properties for retrieving a generic parameter clause on decl nodes
2 participants