diff options
author | Jason Zaugg <jzaugg@gmail.com> | 2015-07-13 08:42:11 +1000 |
---|---|---|
committer | Jason Zaugg <jzaugg@gmail.com> | 2015-07-13 11:45:02 +1000 |
commit | 18e3e61778918e4e802b8fb75789635409523372 (patch) | |
tree | 18d67da301f0b63667e9393d3e336b1fcb5e1875 /test/files/neg/t6895b.scala | |
parent | b92c3aff1ab8c76c4816bd7b1a82a0f87d787837 (diff) | |
parent | 52fde52920d93325310e5544991feeea03e5c763 (diff) | |
download | scala-18e3e61778918e4e802b8fb75789635409523372.tar.gz scala-18e3e61778918e4e802b8fb75789635409523372.tar.bz2 scala-18e3e61778918e4e802b8fb75789635409523372.zip |
Merge remote-tracking branch 'origin/2.11.x' into merge/2.11.x-to-2.12.x-20150713
Conflicts:
src/eclipse/partest/.classpath
src/eclipse/repl/.classpath
test/files/run/nothingTypeNoFramesNoDce.scala
test/files/run/repl-javap-app.check
Also fixup two .classpath files with updated partest, xml and
parser combinators JARs.
Diffstat (limited to 'test/files/neg/t6895b.scala')
-rw-r--r-- | test/files/neg/t6895b.scala | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/test/files/neg/t6895b.scala b/test/files/neg/t6895b.scala new file mode 100644 index 0000000000..c465065011 --- /dev/null +++ b/test/files/neg/t6895b.scala @@ -0,0 +1,39 @@ +trait Foo[F[_]] +trait Bar[F[_], A] + +trait Or[A, B] + +class Test { + implicit def orFoo[A]: Foo[({type L[X] = Or[A, X]})#L] = ??? + implicit def barFoo[F[_]](implicit f: Foo[F]): Foo[({type L[X] = Bar[F, X]})#L] = ??? + + // Now we can define a couple of type aliases: + type StringOr[X] = Or[String, X] + type BarStringOr[X] = Bar[StringOr, X] + + // ok + implicitly[Foo[BarStringOr]] + barFoo[StringOr](null) : Foo[BarStringOr] + barFoo(null) : Foo[BarStringOr] + + // nok + implicitly[Foo[({type L[X] = Bar[StringOr, X]})#L]] + // Let's write the application explicitly, and then + // compile with just this line enabled and -explaintypes. + barFoo(null) : Foo[({type L[X] = Bar[StringOr, X]})#L] + + // Foo[[X]Bar[F,X]] <: Foo[[X]Bar[[X]Or[String,X],X]]? + // Bar[[X]Or[String,X],X] <: Bar[F,X]? + // F[_] <: Or[String,_]? + // false + // false + // false + + // Note that the type annotation above is typechecked as + // Foo[[X]Bar[[X]Or[String,X],X]], ie the type alias `L` + // is eta expanded. + // + // This is done so that it does not escape its defining scope. + // However, one this is done, higher kinded inference + // no longer is able to unify F with `StringOr` (SI-2712) +} |