Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Address review comments
  • Loading branch information
odersky committed Jan 15, 2020
commit 91cf80d825d8c03fa16a9cdeea5302c23fa38032
2 changes: 1 addition & 1 deletion compiler/src/dotty/tools/dotc/core/TypeOps.scala
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ trait TypeOps { this: Context => // TODO: Make standalone object.
tp2 match {
case tp2 @ TypeRef(pre2, _) if tp1.name eq tp2.name =>
tp1.derivedSelect(pre1 | pre2)
case _ => fail
case _ => fallback
}
case AndType(tp11, tp12) =>
mergeRefinedOrApplied(tp11, tp2) & mergeRefinedOrApplied(tp12, tp2)
Expand Down
20 changes: 19 additions & 1 deletion tests/pos/i7965.scala
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ abstract class Test {
foo(x)
}

// -------------------------------------------

trait ZLayer[-RIn, +E, +ROut <: Has[_]] {
def >>>[E1 >: E, ROut2 <: Has[_]](that: ZLayer[ROut, E1, ROut2]): ZLayer[RIn, E1, ROut2]
def ++[E1 >: E, RIn2, ROut1 >: ROut <: Has[_], ROut2 <: Has[_]](that: ZLayer[RIn2, E1, ROut2]): ZLayer[RIn with RIn2, E1, ROut1 with ROut2]
Expand Down Expand Up @@ -45,4 +47,20 @@ object ServiceD {

val combined =
ServiceA.live >>>
(ServiceB.live ++ (ServiceC.live >>> ServiceD.live))
(ServiceB.live ++ (ServiceC.live >>> ServiceD.live))

// -------------------------------------------

class Outer {
class Elem
}

abstract class Test2 {
val o1: Outer = ???
val o2: Outer = ???
val o3: Outer = ???

val x: o1.Elem | (o2.Elem & o3.Elem)
def foo[T <: Outer#Elem](has: T): T = ???
foo(x)
}