Skip to content

Make ExprBuildable expressible as InitializerClause #526

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 3 commits into from
Jul 27, 2022

Conversation

fwcd
Copy link
Member

@fwcd fwcd commented Jul 27, 2022

This generalizes #523 slightly, letting the DSL accept expressions anywhere an InitializerClause is required (e.g. also in OptionalBindingCondition or PatternBinding):

// let x: String = "abc"
OptionalBindingCondition(
  letOrVarKeyword: .let,
  pattern: "x",
  typeAnnotation: "String",
  initializer: StringLiteralExpr("abc") // <- no longer needs an explicit InitializerClause wrap
)

fwcd added 3 commits July 27, 2022 18:15
With the new ExpressibleAsExprBuildable: ExpressibleAsInitializerClause
conformance we can simplify this convenience initializer and
simultaneously make it more expressible by allowing arbitrary
initializer clauses.
@fwcd fwcd requested a review from ahoppen as a code owner July 27, 2022 16:24
@fwcd
Copy link
Member Author

fwcd commented Jul 27, 2022

@swift-ci please test

@fwcd fwcd merged commit 441a8c9 into swiftlang:main Jul 27, 2022
@fwcd fwcd deleted the expr-buildable-initializer-clause branch July 27, 2022 21:27
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.

2 participants