Skip to content

Support optional initializer expression in VariableDecl convenience inititializer #523

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 1 commit into from
Jul 27, 2022

Conversation

fwcd
Copy link
Member

@fwcd fwcd commented Jul 27, 2022

As proposed in #506 (comment), this is a small QoL change that extends the existing convenience initializer for VariableDecl to support optional initializer expressions (and also makes the type annotation optional):

// let x = y
VariableDecl(.let, name: "x", initializer: "y")

// var x: String = "abc"
VariableDecl(
  .var,
  name: "x",
  type: "String",
  initializer: StringLiteralExpr("abc")
)

@fwcd fwcd requested a review from ahoppen as a code owner July 27, 2022 14:25
@fwcd
Copy link
Member Author

fwcd commented Jul 27, 2022

@swift-ci please test

@fwcd fwcd merged commit fe98838 into swiftlang:main Jul 27, 2022
@fwcd fwcd deleted the variabledecl-convenience-init-initializer branch July 27, 2022 15:39
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