Open
Description
Description
In classes the type of Self is dynamic like this:
class C {
func f() { self /* self is a C */ }
func f() -> Self { self /* self is a Self */ }
}
this is because of inheritance.
Inside an actor this causes perhaps surprising errors like this:
dy.swift:3:22: error: cannot convert value of type 'C' to expected argument type 'Self'
{ (x: Self) in }(self)
^
as! Self
Actors do not allow inheritance, and therefore we could say that self
is always Self
.
This would set in stone that actors cannot have inheritance though.
Additional information
Radar: rdar://121091417