Skip to content

Add convenience initializers function call expr #330

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

Conversation

kimdv
Copy link
Contributor

@kimdv kimdv commented Oct 27, 2021

A simple and small one that makes it a bit cleaner

@ahoppen
Copy link
Member

ahoppen commented Oct 28, 2021

Can’t we make IdentifierExpr conform to ExpressibleByStringLiteral for a more generic fix?

@ahoppen ahoppen self-assigned this Oct 28, 2021
@kimdv
Copy link
Contributor Author

kimdv commented Oct 28, 2021

It already is https://github.com/apple/swift-syntax/blob/3ea358da538c8c879d23a6b91f3e5f6edaac663f/Sources/SwiftSyntaxBuilder/IdentifierExprConvenienceInitializers.swift#L19

But FunctionCallExpr.calledExpression is a ExprBuildable and not a IdentifierExpr.
So it' can't make the correct type.

Or am I missing something?
We could also use IdentifierExpr instead of the String. That might do it?

Update:
A quick test: Changing calledExpression: String -> calledExpression: IdentifierExpr works.
I think that's a better solution.

@ahoppen
Copy link
Member

ahoppen commented Oct 28, 2021

Ah, sorry. I should have looked more closely, I thought FunctionCallExpr.calledExpression is an IdentifierExpr. Adding a convenience that takes an IdentifierExpr sounds good to me. Thanks

@kimdv kimdv force-pushed the kimdv/add-convenience-initializers-function-call-expr branch from 6f1ccd2 to c1b3007 Compare October 28, 2021 09:20
@kimdv
Copy link
Contributor Author

kimdv commented Oct 28, 2021

No worries! I happens 😁

I have changed.
Would you mind to trigger the CI?

@ahoppen
Copy link
Member

ahoppen commented Oct 28, 2021

@swift-ci Please test

@swift-ci
Copy link
Contributor

Build failed
Swift Test Linux Platform
Git Sha - 6f1ccd2

@swift-ci
Copy link
Contributor

Build failed
Swift Test OS X Platform
Git Sha - 6f1ccd2

@ahoppen ahoppen merged commit d59aea8 into swiftlang:main Oct 28, 2021
@kimdv kimdv deleted the kimdv/add-convenience-initializers-function-call-expr branch October 30, 2021 22:16
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