swiftlang/swift-syntax

Disallow multiline strings in `#sourceLocation` filename

Closed this issue · 3 comments

kimdv commented

Issue Kind

Bad Diagnostic Produced

Source Code

      #sourceLocation(file: """
      test.swift
      other.swift
      """, line: 10)

Is accepted and shouldn't be allowed

Description

No response

The same applies to almost all other syntax nodes that contain a StringLiteralExprSyntax.

  • AttributeSyntax.arguments (used for @_cdecl and @_semantics)
  • AvailabilityLabeledArgumentSyntax.value
  • ConventionAttributeArgumentsSyntax.cTypeString
  • DocumentationAttributeArgumentSyntax.value
  • ExposeAttributeArgumentsSyntax.cxxName
  • OpaqueReturnTypeOfAttributeArgumentsSyntax.mangledName
  • OriginallyDefinedInAttributeArgumentsSyntax.moduleName
  • PoundSourceLocationArgumentsSyntax.fileName
  • UnavailableFromAsyncAttributeArgumentsSyntax.message
  • UnderscorePrivateAttributeArgumentsSyntax.filename

Tracked in Apple’s issue tracker as rdar://113567646

Decided that we should allow multi-line string literals here. See swiftlang/swift#71366