Skip to content

Commit fbf2c52

Browse files
committed
GenIso.fields blocked by whitebox macros
1 parent 49c0b1d commit fbf2c52

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

tests/run-with-compiler/i5941/macro_1.scala

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,9 @@ object Iso {
163163
throw new QuoteError("Only support generation for case classes or singleton types")
164164
}
165165
}
166+
167+
// TODO: require whitebox macro
168+
def implFields[S: Type](implicit refl: Reflection): Expr[Iso[S, Any]] = ???
166169
}
167170

168171
object GenIso {
@@ -175,7 +178,9 @@ object GenIso {
175178
*/
176179
inline def apply[S, A]: Iso[S, A] = ~Iso.impl[S, A]
177180

178-
inline def fields[S, A]: Iso[S, A] = ???
181+
// TODO: require whitebox macro
182+
inline def fields[S]: Iso[S, Any] = ~Iso.implFields[S]
183+
179184
inline def unit[S]: Iso[S, 1] = ~Iso.implUnit[S]
180185
}
181186

tests/run-with-compiler/i5941/usage_2.scala

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,5 +32,8 @@ object Test {
3232
assert(GenIso[JStr, String].to(JStr("Hello")) == "Hello")
3333
assert(GenIso.unit[JNull.type].to(JNull) == 1)
3434
assert(GenIso.unit[JNull.type].from(1) == JNull)
35+
36+
// TODO: require whitebox macros
37+
// assert(GenIso.fields[Address].from((0, "a")) == Address(0, "a"))
3538
}
3639
}

0 commit comments

Comments
 (0)