mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
This is something I noticed by inspection while working on <https://bugs.swift.org/browse/SR-75>. Inside a static method, 'self' is a metatype value, so 'self.instanceMethod' produces an unbound reference of type (Self) -> (Args...) -> Results. You might guess that 'super.instanceMethod' can similarly be used to produce an unbound method reference that calls the superclass method given any 'self' value, but unfortunately it doesn't work. Instead, 'super.instanceMethod' would produce the same result as 'self.instanceMethod'. Maybe we can implement this later, but for now, let's just diagnose the problem. Note that partially-applied method references with 'super.' -- namely, 'self.staticMethod' inside a static context, or 'self.instanceMethod' inside an instance context, continue to work as before. They have the type (Args...) -> Result; since the self value has already been applied we don't hit the representational issue.
158 KiB
158 KiB