-
Notifications
You must be signed in to change notification settings - Fork 21
lost type information after two type projections #3443
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-3443?orig=1 |
@odersky said: A # B is now equivalent to (x.B forSome x: A) |
@harrah said: Using TFn1 from above: trait TFn1[I, O] {
type app[i <: I] <: O
} B and B2 below should be equivalent, right? trait Test {
type a
type b
type f = TFn1[a, b]
// compiles,
// browsing the tree shows TypeRefs only
type B = f#app[a]
// should be equivalent to B?
// does not compile though,
// tree shows Existential as expected
type B2 = x.app[a] forSome { val x: f }
} The compile error related to B2 is the same as in the original report: type arguments [Test.this.a] do not conform to type app's type parameter bounds [i <: I]
type B = x.app[a] forSome { val x: f }
^ |
@adriaanm said: motivation:
uncurry has been relying on an ugly hack to distinguish these cases based on ad-hoc kind inference anonymous type functions are being used more often (see #2741, #4017, #4079, #3443, #3106), which makes a proper treatment of PolyTypes more pressing change to type representation: PolyType(Nil, tp) is now invalid the kind of a PolyType is * iff its resulttype is a NullaryMethodType or a MethodType (i.e., it's a polymorphic value) NullaryMethodType is eliminated during uncurry pickling: the rewrite probably isn't complete, but was validated by compiling against the old scalacheck jar (which has plenty of polymorphic nullary methods) summary of the refactoring:
TODO: scalap and eclipse review by odersky, rytz |
I have a trait for a type-level function:
and I'm trying to write bind/flatMap for it. The following is a simplified example that gives me the error I'm getting:
The error is:
I think the error message is for the
app[s]
part despite where^
points. It looks like scalac doesn't know that:which should mean that
s <: I
sinceI is T and s <: T
.It seems to me that the code should be accepted but maybe some type information gets lost with the second projection.
This is in 2.8.0.RC2. As Eric Willigers pointed out on the mailing list, this code is accepted in 2.7.x
The text was updated successfully, but these errors were encountered: