You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We run into problems when referring to a member of a self type of a
class that it not also a member of the class from outside via an
asSeenFrom.
One example is in 11226.scala where we see:
```scala
trait ManagedActorClassification { this: ActorEventBus =>
def unsubscribe(subscriber: Subscriber): Unit
}
class Unsubscriber(bus: ManagedActorClassification) {
def test(a: ActorRef): Unit = bus.unsubscribe(a) // error
}
```
The problem is that `unsubscribe` refers to the type `Subscriber` which
is not resolvable as a member of `bus`. one idea could be to rule out
type signatures like `unsubscribe`, similar how we rule out public
signatures referring to private members. But this could rule out
existing valid programs. For instance, the `unsubscribe` signature is
unproblematic if it gets only called with prefixes that inherit
`ActorEventBus`. You could say that the problem was instead that the
type of `bus` was not specific enough.
In the long term, maybe restricting the signature is the right move. But
for now, we just try to give better error messages in the case of
existing failures.
Fixes#11226
deftoMessage(usingContext) =em"malformed type: $pre is not a legal prefix for $denot because it contains abstract type member${if (absMembers.size ==1) ""else"s"}${absMembers.mkString(", ")}"
0 commit comments