Skip to content

Conversation

DougGregor
Copy link
Member

Somehow, we forgot to implement this here, even though the compiler has supported it for a long time.

Fixes #1742 / rdar://110418242.

Somehow, we forgot to implement this here, even though the compiler has
supported it for a long time.

Fixes swiftlang#1742 / rdar://110418242.
@DougGregor
Copy link
Member Author

@swift-ci please test

extension \(raw: identifier): \(type) { }
"""
if let whereClause {
ext = DeclSyntax((ext.as(ExtensionDeclSyntax.self))!.with(\.genericWhereClause, whereClause))
Copy link
Member

Choose a reason for hiding this comment

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

Slightly nicer version in my opinion would be

Suggested change
ext = DeclSyntax((ext.as(ExtensionDeclSyntax.self))!.with(\.genericWhereClause, whereClause))
ext = DeclSyntax((ext.cast(ExtensionDeclSyntax.self)).with(\.genericWhereClause, whereClause))

Copy link
Member Author

Choose a reason for hiding this comment

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

Thank you, I've pulled this in!

// refer to conformance macros, expand them and return the resulting
// set of extension declarations.
private func expandConformances(of decl: DeclGroupSyntax) -> [DeclSyntax] {
let identifier: String
Copy link
Member

Choose a reason for hiding this comment

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

Why not make identifier: Syntax and then you don’t need to convert to strings or use the raw interpolation below. Also identifier isn’t correct because ext.extendedType is not an identifier.

Copy link
Member Author

Choose a reason for hiding this comment

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

Great point, I've updated this code.

@DougGregor
Copy link
Member Author

@swift-ci please test

@DougGregor
Copy link
Member Author

@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.

SyntaxProtocol.expand() does not expand conformance macros
2 participants