Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(SymbolGraphGen) AnyObject constraints are always dropped #64550

Open
tayloraswift opened this issue Mar 22, 2023 · 3 comments
Open

(SymbolGraphGen) AnyObject constraints are always dropped #64550

tayloraswift opened this issue Mar 22, 2023 · 3 comments
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler itself generic constraints Feature → generics: generic constraints generics Feature: generic declarations and types source tooling Area: IDE support, SourceKit, and other source tooling swift 5.8 SymbolGraphGen The swiftSymbolGraphGen library, responsible for gathering and emitting symbol graphs. unexpected behavior Bug: Unexpected behavior or incorrect output

Comments

@tayloraswift
Copy link
Member

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
        }
      }
    },
@tayloraswift tayloraswift added bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. triage needed This issue needs more specific labels labels Mar 22, 2023
@AnthonyLatsis AnthonyLatsis added compiler The Swift compiler itself generics Feature: generic declarations and types source tooling Area: IDE support, SourceKit, and other source tooling SymbolGraphGen The swiftSymbolGraphGen library, responsible for gathering and emitting symbol graphs. generic constraints Feature → generics: generic constraints unexpected behavior Bug: Unexpected behavior or incorrect output and removed triage needed This issue needs more specific labels labels Mar 23, 2023
@AnthonyLatsis
Copy link
Collaborator

Which Swift version?

@tayloraswift
Copy link
Member Author

5.8 March 17th snapshot

@tayloraswift
Copy link
Member Author

tayloraswift commented Dec 5, 2023

this bug appears to still be present as of 5.9.1

this might be related to the issue described in this forums thread

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler itself generic constraints Feature → generics: generic constraints generics Feature: generic declarations and types source tooling Area: IDE support, SourceKit, and other source tooling swift 5.8 SymbolGraphGen The swiftSymbolGraphGen library, responsible for gathering and emitting symbol graphs. unexpected behavior Bug: Unexpected behavior or incorrect output
Projects
None yet
Development

No branches or pull requests

2 participants