Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix 1177 where Focus could not operate on type aliases #1178

Merged
merged 5 commits into from
Jul 20, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -16,6 +16,6 @@ private[focus] trait ParserBase {
}

def getType(code: Term): TypeRepr =
code.tpe.widen
code.tpe.widen.dealias

}
Original file line number Diff line number Diff line change
@@ -114,16 +114,25 @@ final class FocusFieldSelectTest extends munit.FunSuite {
assertEquals(iso.reverseGet("Bob"), Animal("Bob"))
}

test("Type alias for parameterised type access") {
case class CC[T](t: T, i: Int)
type CCInt = CC[Int]
val cc = CC(2, 3)

assertEquals(Focus[CCInt](_.i).get(cc), 3)
assertEquals(Focus[CCInt](_.t).get(cc), 2)
}

/*
test("Refined type field accessss") {
test("Refined type field access") {
assertEquals(
Focus[RefinedBox { type A = String }](_.a).get(new RefinedBox { type A = String; def a = "Bob" }),
"Bob"
)
}*/

/*
test("Existential type field accessss") {
test("Existential type field access") {
val existentialBox: Box[_] = Box("abc")
assertEquals(
Focus[Box[_]](_.a).get(existentialBox),