Skip to content

(SymbolGraphGen) AnyObject constraints are always dropped #64550

Open
@tayloraswift

Description

@tayloraswift

SymbolGraphGen always drops generic constraints if they are conforms(to: AnyObject):

public
enum Enum<T>
{
}

extension Enum where T:AnyObject
{
    var member:Void { return }
}
extension Enum where T:Sendable
{
    var other:Void { return }
}

other constraints, including Sendable obviously do not exhibit this behavior.

    {
      "kind": {
        "identifier": "swift.property",
        "displayName": "Instance Property"
      },
      "identifier": {
        "precise": "s:20AnyObjectConstraints4EnumOAARlzClE6memberytvp",
        "interfaceLanguage": "swift"
      },
      "pathComponents": [
        "Enum",
        "member"
      ],
      "names": {
        "title": "member",
        "subHeading": [
          {
            "kind": "keyword",
            "spelling": "var"
          },
          {
            "kind": "text",
            "spelling": " "
          },
          {
            "kind": "identifier",
            "spelling": "member"
          },
          {
            "kind": "text",
            "spelling": ": "
          },
          {
            "kind": "typeIdentifier",
            "spelling": "Void",
            "preciseIdentifier": "s:s4Voida"
          }
        ]
      },
      "swiftExtension": {
        "extendedModule": "AnyObjectConstraints",
        "typeKind": "swift.enum"
      },
      "declarationFragments": [
        {
          "kind": "keyword",
          "spelling": "var"
        },
        {
          "kind": "text",
          "spelling": " "
        },
        {
          "kind": "identifier",
          "spelling": "member"
        },
        {
          "kind": "text",
          "spelling": ": "
        },
        {
          "kind": "typeIdentifier",
          "spelling": "Void",
          "preciseIdentifier": "s:s4Voida"
        },
        {
          "kind": "text",
          "spelling": " { "
        },
        {
          "kind": "keyword",
          "spelling": "get"
        },
        {
          "kind": "text",
          "spelling": " }"
        }
      ],
      "accessLevel": "internal",
      "location": {
        "uri": "file:///swift/swift-unidoc/TestModules/Snippets/AnyObjectConstraints.swift",
        "position": {
          "line": 7,
          "character": 8
        }
      }
    },
    {
      "kind": {
        "identifier": "swift.property",
        "displayName": "Instance Property"
      },
      "identifier": {
        "precise": "s:20AnyObjectConstraints4EnumOAAs8SendableRzlE5otherytvp",
        "interfaceLanguage": "swift"
      },
      "pathComponents": [
        "Enum",
        "other"
      ],
      "names": {
        "title": "other",
        "subHeading": [
          {
            "kind": "keyword",
            "spelling": "var"
          },
          {
            "kind": "text",
            "spelling": " "
          },
          {
            "kind": "identifier",
            "spelling": "other"
          },
          {
            "kind": "text",
            "spelling": ": "
          },
          {
            "kind": "typeIdentifier",
            "spelling": "Void",
            "preciseIdentifier": "s:s4Voida"
          }
        ]
      },
      "swiftExtension": {
        "extendedModule": "AnyObjectConstraints",
        "typeKind": "swift.enum",
        "constraints": [
          {
            "kind": "conformance",
            "lhs": "T",
            "rhs": "Sendable",
            "rhsPrecise": "s:s8SendableP"
          }
        ]
      },
      "declarationFragments": [
        {
          "kind": "keyword",
          "spelling": "var"
        },
        {
          "kind": "text",
          "spelling": " "
        },
        {
          "kind": "identifier",
          "spelling": "other"
        },
        {
          "kind": "text",
          "spelling": ": "
        },
        {
          "kind": "typeIdentifier",
          "spelling": "Void",
          "preciseIdentifier": "s:s4Voida"
        },
        {
          "kind": "text",
          "spelling": " { "
        },
        {
          "kind": "keyword",
          "spelling": "get"
        },
        {
          "kind": "text",
          "spelling": " }"
        }
      ],
      "accessLevel": "internal",
      "location": {
        "uri": "file:///swift/swift-unidoc/TestModules/Snippets/AnyObjectConstraints.swift",
        "position": {
          "line": 11,
          "character": 8
        }
      }
    },

Metadata

Metadata

Assignees

No one assigned

    Labels

    SymbolGraphGenThe swiftSymbolGraphGen library, responsible for gathering and emitting symbol graphs.bugA deviation from expected or documented behavior. Also: expected but undesirable behavior.compilerThe Swift compiler itselfgeneric constraintsFeature → generics: generic constraintsgenericsFeature: generic declarations and typessource toolingArea: IDE support, SourceKit, and other source toolingswift 5.8unexpected behaviorBug: Unexpected behavior or incorrect output

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions