Files
swift-mirror/test/decl/class/actor/basic.swift
Doug Gregor b88e678694 [SE-0306] Disable actor inheritance.
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.
2021-04-23 15:08:57 -07:00

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 {}