Skip to content

Commit bae4196

Browse files
committed
A test case for a recent LUB progression.
A test distilled from a Lift example that compiles correctly under 2.10.1, but not under 2.10.0. I pinpointed the progression to: a06d31f6#L0R6611 Chalk up another win for `dealiasWiden`.
1 parent 7691423 commit bae4196

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
import scala.language.higherKinds
2+
3+
sealed trait Path {
4+
type EncodeFunc
5+
type Route[R] = List[String] => R
6+
7+
def >>(f: Route[Int]): Sitelet[EncodeFunc] = ???
8+
}
9+
10+
case object PAny extends Path {
11+
type EncodeFunc = List[String] => String
12+
}
13+
14+
case class PLit[Next <: Path]() extends Path {
15+
type EncodeFunc = Next#EncodeFunc
16+
}
17+
18+
trait Sitelet[EncodeFunc] { self =>
19+
def &[G <: H, H >: EncodeFunc](that: Sitelet[G]): Sitelet[H] = ???
20+
}
21+
22+
object Test {
23+
val r: Sitelet[Int => (Int => String)] = ???
24+
25+
val p2: PLit[PAny.type] = ???
26+
val r2 /*: Sitelet[List[String] => String] */ // annotate type and it compiles with 2.10.0
27+
= p2 >> { (xs: List[String]) => 0 }
28+
29+
// This works after https://github.com/scala/scala/commit/a06d31f6a
30+
// Before: error: inferred type arguments [List[String] => String,List[String] => String]
31+
// do not conform to method &'s type parameter bounds
32+
// [G <: H,H >: Int => (Int => String)]
33+
val s = r & r2
34+
}

0 commit comments

Comments
 (0)