mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Actor inheritance was removed in the second revision of SE-0306. Remove the ability to inherit actors. Note that this doesn't fully eliminate all vestigates of inheritance from actors. There are simplifications that need to be performed still, e.g., there's no need to distinguish designated/convenience/required initializers. That will follow.
29 lines
1.2 KiB
Swift
29 lines
1.2 KiB
Swift
// RUN: %target-typecheck-verify-swift -enable-experimental-concurrency
|
|
|
|
// REQUIRES: concurrency
|
|
|
|
actor MyActor { }
|
|
|
|
class MyActorSubclass1: MyActor { } // expected-error{{actor types do not support inheritance}}
|
|
// expected-error@-1{{non-final class 'MyActorSubclass1' cannot conform to `Sendable`; use `UnsafeSendable`}}
|
|
|
|
actor MyActorSubclass2: MyActor { } // expected-error{{actor types do not support inheritance}}
|
|
|
|
// expected-warning@+1{{'actor class' has been renamed to 'actor'}}{{7-13=}}
|
|
actor class MyActorClass { }
|
|
|
|
class NonActor { }
|
|
|
|
actor NonActorSubclass : NonActor { } // expected-error{{actor types do not support inheritance}}
|
|
|
|
// expected-warning@+1{{'actor class' has been renamed to 'actor'}}{{14-20=}}
|
|
public actor class BobHope {}
|
|
// expected-warning@+1{{'actor class' has been renamed to 'actor'}}{{14-19=actor}}{{1-7=}}
|
|
actor public class BarbraStreisand {}
|
|
// expected-warning@+2{{'actor class' has been renamed to 'actor'}}{{14-21=}}
|
|
// expected-error@+1{{'actor' may only be used on 'class' declarations}}
|
|
public actor struct JulieAndrews {}
|
|
// expected-warning@+2{{'actor class' has been renamed to 'actor'}}{{14-18=actor}}{{1-7=}}
|
|
// expected-error@+1{{'actor' may only be used on 'class' declarations}}
|
|
actor public enum TomHanks {}
|