Skip to content

Bad diagnostic overriding method returning opaque type #70853

@NachoSoto

Description

@NachoSoto

Description

I imagine this is a limitation and these methods can't be overridden, but it's hard to tell with the bad diagnostic message.

Reproduction

protocol P {} struct A1: P {} struct A2: P {} class C { func f() -> some P { A1() } } class D: C { // Error: Method does not override any method from its superclass override func f() -> some P { A2() } }

Expected behavior

An actual error explaining why this isn't possible.

Environment

swift-driver version: 1.87.3 Apple Swift version 5.9.2 (swiftlang-5.9.2.2.56 clang-1500.1.0.2.5)
Target: arm64-apple-macosx14.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugA deviation from expected or documented behavior. Also: expected but undesirable behavior.compilerThe Swift compiler itselfdiagnostics QoIBug: Diagnostics Quality of Implementationopaque result typesFeature → types → opaque types: opaque result typesopaque typesFeature → types: opaque typesoverrideFeature: Overriding in classesswift 6.0type checkerArea → compiler: Semantic analysis

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions