mirror of
https://github.com/apple/swift.git
synced 2026-06-20 15:42:51 +02:00
33bc1be125
**Explanation**: Provides an error diagnostic that notifies the user that recursive generics are not supported in Embedded Swift. This prevents current OOM behavior in `swift-frontend`. **Scope**: limited to a rarely used pattern in Embedded Swift **Risk**: low due to limited scope. **Testing**: added new lit test **Issue**: rdar://174011486
11 lines
610 B
Swift
11 lines
610 B
Swift
// RUN: %target-swift-frontend -typecheck %s -enable-experimental-feature Embedded -verify
|
|
// REQUIRES: swift_in_compiler
|
|
// REQUIRES: swift_feature_Embedded
|
|
|
|
// Self-referential generic superclass should be diagnosed in Embedded Swift
|
|
// because it creates a circular metadata dependency.
|
|
|
|
final class Tree: ManagedBuffer<Int, Tree> { // expected-error {{class 'Tree' cannot inherit from 'ManagedBuffer<Int, Tree>' in Embedded Swift because a generic argument of the superclass refers to the subclass itself, creating a circular metadata dependency}}
|
|
var children: AnySequence<Tree> { AnySequence([]) }
|
|
}
|