swiftlang / swiftlang/swift-syntax

Adds explicit overload for `ExpressibleByStringLiteral` syntax types

Open
#1,507 5 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
Swift
Stars
3.7k
Forks
553
Avg merge
5d 13h
Merged PRs (30d)
16

Description

### Description

Nowadays we have `DeclSyntax`, `ExprSyntax`, `StmtSyntax`, `TokenSyntax`, `TypeSyntax`... with `ExpressibleByStringLiteral` conformance. If an initializer takes a concrete-typed parameter of one of these types, string literal syntax works perfectly, reducing lots of boilerplate codes.

However, for initializers with generic parameters like ``, such syntax won't work and we need to explicitly express out `ExprSyntax("...")` or `"..." as ExprSyntax`. Adding an overload with concrete type `ExprSyntax` can solve the problem, making `SwiftSyntaxBuilder` easier to use.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.