Files
swift-mirror/test/Frontend/fileid-raw-identifier-module-name.swift
Tony Allevato 0844e274b0 Ensure that #fileID wraps raw identifier module names in backticks.
`#fileID` never accounted for the possibility that someone one have
a module alias _itself_, so it always generated the module's real
(physical) name. This _technically_ changes the behavior of `#fileID`
for self-aliased modules, but since nobody would have ever had a reason
to do that before raw identifiers, it's unlikely that this change would
affect anyone in practice.
2025-03-11 17:18:44 -04:00

10 lines
572 B
Swift

// Tests that `#fileID` has the correct module name when a module aliases
// itself (to internally refer to itself a raw identifier name instead of the
// -module-name, which must be filesystem-friendly).
// RUN: %target-swift-frontend -module-name Original -module-alias "^raw*identifier^=Original" %s -emit-silgen | %FileCheck %s
print("#fileID = \(#fileID)")
// CHECK: %{{[0-9]+}} = string_literal utf8 "`^raw*identifier^`/fileid-raw-identifier-module-name.swift"
// CHECK-NOT: %{{[0-9]+}} = string_literal utf8 "Original/fileid-raw-identifier-module-name.swift"