-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Open
Labels
bugA deviation from expected or documented behavior. Also: expected but undesirable behavior.A deviation from expected or documented behavior. Also: expected but undesirable behavior.classFeature → type declarations: Class declarationsFeature → type declarations: Class declarationscompilerThe Swift compiler itselfThe Swift compiler itselfdeclarationsFeature: declarationsFeature: declarationsinheritance clausesFeature → type declarations: Type inheritance clausesFeature → type declarations: Type inheritance clausesswift 6.0type checkerArea → compiler: Semantic analysisArea → compiler: Semantic analysistype declarationsFeature → declarations: Type declarationsFeature → declarations: Type declarationsunexpected errorBug: Unexpected errorBug: Unexpected error
Description
Description
No response
Reproduction
final class C: C.Foo {
class Foo {}
}
<source>:1:13: error: 'C' inherits from itself
1 │ final class C: C.Foo {
│ │ ╰─ note: through reference here
│ ├─ error: 'C' inherits from itself
│ ╰─ note: through reference here
2 │ class Foo {}
3 │ }
Compiler returned: 1
Expected behavior
In the given example, C
does not actually inherit from itself, so I think this should be allowed.
C.Foo
is an independent type, which just so happens to be nested within C
; in other words C.Foo is C
would be false
.
Environment
Swift version 6.0-dev (LLVM 87789f04c6598f1, Swift 52e8fbc)
Target: x86_64-unknown-linux-gnu
Additional information
Metadata
Metadata
Assignees
Labels
bugA deviation from expected or documented behavior. Also: expected but undesirable behavior.A deviation from expected or documented behavior. Also: expected but undesirable behavior.classFeature → type declarations: Class declarationsFeature → type declarations: Class declarationscompilerThe Swift compiler itselfThe Swift compiler itselfdeclarationsFeature: declarationsFeature: declarationsinheritance clausesFeature → type declarations: Type inheritance clausesFeature → type declarations: Type inheritance clausesswift 6.0type checkerArea → compiler: Semantic analysisArea → compiler: Semantic analysistype declarationsFeature → declarations: Type declarationsFeature → declarations: Type declarationsunexpected errorBug: Unexpected errorBug: Unexpected error