@@ -26,7 +26,7 @@ class Synthesizer(typer: Typer)(using @constructorOnly c: Context):
26
26
/** Handlers to synthesize implicits for special types */
27
27
type SpecialHandler = (Type , Span ) => Context ?=> TreeWithErrors
28
28
private type SpecialHandlers = List [(ClassSymbol , SpecialHandler )]
29
-
29
+
30
30
val synthesizedClassTag : SpecialHandler = (formal, span) =>
31
31
formal.argInfos match
32
32
case arg :: Nil =>
@@ -282,7 +282,7 @@ class Synthesizer(typer: Typer)(using @constructorOnly c: Context):
282
282
def acceptable (tp : Type , cls : Symbol ): Boolean = tp match
283
283
case tp : HKTypeLambda if tp.resultType.isInstanceOf [HKTypeLambda ] => false
284
284
case tp : TypeProxy => acceptable(tp.underlying, cls)
285
- case OrType (tp1, tp2) => acceptable(tp1, cls) && acceptable(tp2, cls)
285
+ case OrType (tp1, tp2) => false
286
286
case _ => tp.classSymbol eq cls
287
287
288
288
/** for a case class, if it will have an anonymous mirror,
@@ -323,12 +323,12 @@ class Synthesizer(typer: Typer)(using @constructorOnly c: Context):
323
323
withNoErrors(mirrorRef.cast(mirrorType))
324
324
end makeProductMirror
325
325
326
- def getError (cls : Symbol ): String =
326
+ def getError (cls : Symbol ): String =
327
327
val reason = if ! cls.isGenericProduct then
328
328
i " because ${cls.whyNotGenericProduct}"
329
329
else if ! canAccessCtor(cls) then
330
330
i " because the constructor of $cls is innaccessible from the calling scope. "
331
- else
331
+ else
332
332
" "
333
333
i " $cls is not a generic product $reason"
334
334
end getError
@@ -369,7 +369,7 @@ class Synthesizer(typer: Typer)(using @constructorOnly c: Context):
369
369
case tp : TermRef => false
370
370
case tp : HKTypeLambda if tp.resultType.isInstanceOf [HKTypeLambda ] => false
371
371
case tp : TypeProxy => acceptable(tp.underlying)
372
- case OrType (tp1, tp2) => acceptable(tp1) && acceptable(tp2)
372
+ case OrType (tp1, tp2) => false
373
373
case _ => tp.classSymbol eq cls
374
374
375
375
if acceptable(mirroredType) && clsIsGenericSum then
@@ -428,7 +428,7 @@ class Synthesizer(typer: Typer)(using @constructorOnly c: Context):
428
428
withNoErrors(mirrorRef.cast(mirrorType))
429
429
else if ! clsIsGenericSum then
430
430
(EmptyTree , List (i " $cls is not a generic sum because ${cls.whyNotGenericSum(declScope)}" ))
431
- else
431
+ else
432
432
EmptyTreeNoError
433
433
end sumMirror
434
434
@@ -595,7 +595,7 @@ class Synthesizer(typer: Typer)(using @constructorOnly c: Context):
595
595
tp.baseType(cls)
596
596
val base = baseWithRefinements(formal)
597
597
val result =
598
- if (base <:< formal.widenExpr)
598
+ if (base <:< formal.widenExpr)
599
599
// With the subtype test we enforce that the searched type `formal` is of the right form
600
600
handler(base, span)
601
601
else EmptyTreeNoError
@@ -609,19 +609,19 @@ end Synthesizer
609
609
610
610
object Synthesizer :
611
611
612
- /** Tuple used to store the synthesis result with a list of errors. */
612
+ /** Tuple used to store the synthesis result with a list of errors. */
613
613
type TreeWithErrors = (Tree , List [String ])
614
614
private def withNoErrors (tree : Tree ): TreeWithErrors = (tree, List .empty)
615
615
616
616
private val EmptyTreeNoError : TreeWithErrors = withNoErrors(EmptyTree )
617
617
618
618
private def orElse (treeWithErrors1 : TreeWithErrors , treeWithErrors2 : => TreeWithErrors ): TreeWithErrors = treeWithErrors1 match
619
- case (tree, errors) if tree eq genericEmptyTree =>
619
+ case (tree, errors) if tree eq genericEmptyTree =>
620
620
val (tree2, errors2) = treeWithErrors2
621
621
(tree2, errors ::: errors2)
622
622
case _ => treeWithErrors1
623
623
624
- private def clearErrorsIfNotEmpty (treeWithErrors : TreeWithErrors ) = treeWithErrors match
624
+ private def clearErrorsIfNotEmpty (treeWithErrors : TreeWithErrors ) = treeWithErrors match
625
625
case (tree, _) if tree eq genericEmptyTree => treeWithErrors
626
626
case (tree, _) => withNoErrors(tree)
627
627
0 commit comments