You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It seems like that `StringInterpolationExpr` doesn't have syntax info of raw strings literal(#). Is this expected behavior? If so, formatter/rewriter tools might have an issue because generated swift code from libSyntax/SwiftSyntax would be a bit different from input swift code.
Examples
As you can see below example, raw strings literal `#` is eliminated in syntax tree.
// sample.swift
#"foo \#(bar)"#
// swift -frontend -emit-syntax sample.swift
{"id":18,"kind":"SourceFile","layout":[{"id":17,"kind":"CodeBlockItemList","layout":[{"id":14,"kind":"CodeBlockItem","layout":[{"id":13,"kind":"StringInterpolationExpr","layout":[{"id":1,"tokenKind":{"kind":"string_quote"},"leadingTrivia":[],"trailingTrivia":[],"presence":"Present"},{"id":12,"kind":"StringInterpolationSegments","layout":[{"id":3,"kind":"StringSegment","layout":[{"id":2,"tokenKind":{"kind":"string_segment","text":"foo "},"leadingTrivia":[],"trailingTrivia":[],"presence":"Present"}],"presence":"Present"},{"id":9,"kind":"ExpressionSegment","layout":[{"id":4,"tokenKind":{"kind":"backslash"},"leadingTrivia":[],"trailingTrivia":[],"presence":"Present"},{"id":5,"tokenKind":{"kind":"l_paren"},"leadingTrivia":[],"trailingTrivia":[],"presence":"Present"},{"id":7,"kind":"IdentifierExpr","layout":[{"id":6,"tokenKind":{"kind":"identifier","text":"bar"},"leadingTrivia":[],"trailingTrivia":[],"presence":"Present"},null],"presence":"Present"},{"id":8,"tokenKind":{"kind":"string_interpolation_anchor"},"leadingTrivia":[],"trailingTrivia":[],"presence":"Present"}],"presence":"Present"},{"id":11,"kind":"StringSegment","layout":[{"id":10,"tokenKind":{"kind":"string_segment","text":""},"leadingTrivia":[],"trailingTrivia":[],"presence":"Present"}],"presence":"Present"}],"presence":"Present"},{"id":1,"tokenKind":{"kind":"string_quote"},"leadingTrivia":[],"trailingTrivia":[],"presence":"Present"}],"presence":"Present"},null,null],"presence":"Present"}],"presence":"Present"},{"id":16,"tokenKind":{"kind":"eof","text":""},"leadingTrivia":[{"kind":"Newline","value":1}],"trailingTrivia":[],"presence":"Present"}],"presence":"Present"}
Qestions
Can we have the raw strings literal as token kind like pound in syntax tree? This can be eliminated in AST as it is.
The text was updated successfully, but these errors were encountered:
Additional Detail from JIRA
md5: 2bdc43d7872ae8b293a7b2cc41926345
Issue Description:
Overview
It seems like that `StringInterpolationExpr` doesn't have syntax info of raw strings literal(#). Is this expected behavior? If so, formatter/rewriter tools might have an issue because generated swift code from libSyntax/SwiftSyntax would be a bit different from input swift code.
Examples
As you can see below example, raw strings literal `#` is eliminated in syntax tree.
Qestions
Can we have the raw strings literal as token kind like pound in syntax tree? This can be eliminated in AST as it is.
The text was updated successfully, but these errors were encountered: