code |
// This code makes version 2.1.4 of scalac crash
// It's a simplified version of an attempt at making my encoding of lightweight PolyP
// extensible using a virtual class encoding -- the code isn't really meaningful anymore, but
// it's the simplest piece of code I've been able to construct that still exhibits the crash.
// There's a type error (due to the piece of code I commented out), but I'd prefer a nice
// "types do not match" error over a long stack trace ;-)
trait CrashDueToTypeError {
def id[a](x :a) :a = x
trait Bifunctor {
type a; // content
type s <: Bifunctor
// uncomment this-vvvvvvvvvvvvvvvvvvvvvvvvvvvv, and it compiles
def bimap[c](f :a=>c) :s{/*type s=Bifunctor.this.s;*/type a=c; }
}
def hylo[hs <: Bifunctor,ha,hb,hc]
(f :hb=>hs{type s=hs; type a=ha},
g :hs{type s=hs; type a=ha}=>hc)(x :hb)
:hc
= g(f(x).bimap(id))
} |