Open
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
A deviation from expected or documented behavior. Also: expected but undesirable behavior.Feature → type declarations: Class declarationsThe Swift compiler itselfFeature: declarationsFeature → type declarations: Type inheritance clausesArea → compiler: Semantic analysisFeature → declarations: Type declarationsBug: Unexpected error