-
-
Notifications
You must be signed in to change notification settings - Fork 206
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix GenLens issue with evidence shadowing (#1265)
Will (mostly) solve #1259 for Scala 2.13.
- Loading branch information
Showing
2 changed files
with
32 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
macro/src/test/scala-2.x/monocle/macros/internal/ContextBoundCompilationIssueSpec.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package monocle.macros.internal | ||
|
||
import monocle.Lens | ||
import monocle.macros.GenLens | ||
import munit.DisciplineSuite | ||
|
||
class ContextBoundCompilationIssueSpec extends DisciplineSuite { | ||
|
||
private trait Foo[T] | ||
private trait Bar[T] | ||
|
||
private case class A[T: Foo](s: A.S[T]) { | ||
val lens: Lens[A.S[T], Bar[T]] = GenLens[A.S[T]](_.bar) | ||
} | ||
|
||
private object A { | ||
case class S[T: Foo](bar: Bar[T]) | ||
} | ||
|
||
private case object FooImpl extends Foo[Unit] | ||
private case object BarImpl extends Bar[Unit] | ||
|
||
private val a: A[Unit] = A(A.S(BarImpl)(FooImpl))(FooImpl) | ||
|
||
test("context.bound.compilation") { | ||
assertEquals(a.lens.get(a.s), BarImpl) | ||
} | ||
|
||
} |