Skip to content

Commit 49c0b1d

Browse files
committed
Use literal type 1 for unit
1 parent 032a192 commit 49c0b1d

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ object Iso {
129129
}
130130
}
131131

132-
def implUnit[S: Type](implicit refl: Reflection): Expr[Iso[S, Unit]] = {
132+
def implUnit[S: Type](implicit refl: Reflection): Expr[Iso[S, 1]] = {
133133
import refl._
134134
import util._
135135
import quoted.Toolbox.Default._
@@ -139,7 +139,7 @@ object Iso {
139139
if (tpS.isSingleton) {
140140
val ident = Term.Ident(tpS.asInstanceOf[TermRef]).seal[S]
141141
'{
142-
Iso[S, Unit](Function.const(~ident))(Function.const(()))
142+
Iso[S, 1](Function.const(~ident))(Function.const(1))
143143
}
144144
}
145145
else if (tpS.classSymbol.flatMap(cls => if (cls.flags.is(Flags.Case)) Some(true) else None).nonEmpty) {
@@ -156,7 +156,7 @@ object Iso {
156156
val obj = Term.Select.overloaded(Term.Ident(companion), "apply", Nil, Nil).seal[S]
157157

158158
'{
159-
Iso[S, Unit](Function.const(~obj))(Function.const(()))
159+
Iso[S, 1](Function.const(~obj))(Function.const(1))
160160
}
161161
}
162162
else {
@@ -176,7 +176,7 @@ object GenIso {
176176
inline def apply[S, A]: Iso[S, A] = ~Iso.impl[S, A]
177177

178178
inline def fields[S, A]: Iso[S, A] = ???
179-
inline def unit[S]: Iso[S, Unit] = ~Iso.implUnit[S]
179+
inline def unit[S]: Iso[S, 1] = ~Iso.implUnit[S]
180180
}
181181

182182
trait Prism[S, A] {

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ object Test {
3030
// assert(jStr(JStr("world")) == JStr("world"))
3131

3232
assert(GenIso[JStr, String].to(JStr("Hello")) == "Hello")
33-
assert(GenIso.unit[JNull.type].to(JNull) == (()))
34-
assert(GenIso.unit[JNull.type].from(()) == JNull)
33+
assert(GenIso.unit[JNull.type].to(JNull) == 1)
34+
assert(GenIso.unit[JNull.type].from(1) == JNull)
3535
}
3636
}

0 commit comments

Comments
 (0)