-
Notifications
You must be signed in to change notification settings - Fork 21
dealiasing broken where abstract types are involved #8046
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Imported From: https://issues.scala-lang.org/browse/SI-8046?orig=1 |
@paulp said: trait One {
type Op[A]
type Alias[A] = Op[A]
}
trait Two extends One {
trait Op[A] extends (A => A)
override type Alias[A] = Op[A]
class View2 extends Alias[Int] { def apply(xs: Int) = xs }
} I guess there's a use for "override type" after all. |
@retronym said (edited on Dec 7, 2013 10:14:29 PM UTC):
|
@retronym said: https://github.com/retronym/scala/compare/ticket;8046?expand=1 |
@retronym said: Both changes in the branch are needed; I was hoping the second would subsume the first. Still feels a bit ad hoc, so I'd appreciate if you could try to poke holes in it, Paul. |
@paulp said: So sure, it looks a bit ad hoc, and think how garishly it would stand out from everything else if it weren't. |
@retronym said (edited on Dec 9, 2013 7:41:56 AM UTC): |
@retronym said: |
In the situation where you have
a) an abstract type
b) a type alias which dealiases to the abstract type
c) an environment where the abstract type has been implemented concretely
Then the type alias should be equivalent to the concrete class which implements the abstract type. It isn't because substitution is broken. Observe the unimplemented type includes T1 and R, which are Function1's type parameters completely escaping.
If the type alias definition is moved from One into Two, then this compiles as given.
Here is another angle on it. f1, f2, f3 all compile. The fact that f2 compiles tells you some trivial substitution is taking place, but it is missing (at least) parents and bounds.
The text was updated successfully, but these errors were encountered: