SE-0451 vs `renamed`-attributes

SE-0451 has introduced "raw identifiers", which I believe is very convenient.
While I was thinking that some legacy identifiers should be renamed to raw identifiers, I noticed there were some obstacles(?) when trying to add @available-attributes:

public enum MyNumber {
  case newNumber

  @available(*, deprecated, renamed: "newNumber") // ✅
  public static let oldNumber: MyNumber = .newNumber

  case `123`

  @available(*, deprecated, renamed: "123") // ❌
  // `- error: 'renamed' argument of 'available' attribute must be an operator, identifier, or full function name, optionally prefixed by a type name
  public static let a123: MyNumber = .`123`

  @available(*, deprecated, renamed: "`123`") // ❌
  // `- error: 'renamed' argument of 'available' attribute must be an operator, identifier, or full function name, optionally prefixed by a type name
  public static let b123: MyNumber = .`123`

  @available(*, deprecated, renamed: "MyNumber.123") // ❌
  // `- error: 'renamed' argument of 'available' attribute must be an operator, identifier, or full function name, optionally prefixed by a type name
  public static let c123: MyNumber = .`123`

  @available(*, deprecated, renamed: "MyNumber.`123`") // ❌
  // `- error: 'renamed' argument of 'available' attribute must be an operator, identifier, or full function name, optionally prefixed by a type name
  public static let d123: MyNumber = .`123`

  @available(*, deprecated, message: "'e123' is deprecated: renamed to '123'; use '123' instead.") // ✅ but, auto-fix isn't available...
  public static let e123: MyNumber = .`123`
}

The last one could be a workaround, but it's just a message which doesn't necessarily mean renamed.
Are there any other appropriate ways to warn about deprecation in such situation?

2 Likes