@@ -697,7 +697,7 @@ trait Implicits { self: Typer =>
697
697
classTag.select(sym.name.toTermName)
698
698
else
699
699
classTag.select(nme.apply).appliedToType(tp).appliedTo(clsOf(erasure(tp)))
700
- tag.withSpan(span)
700
+ tag.withSpan(span)
701
701
case tp =>
702
702
EmptyTree
703
703
}
@@ -708,7 +708,7 @@ trait Implicits { self: Typer =>
708
708
/** Synthesize the tree for `'[T]` for an implicit `scala.quoted.Type[T]`.
709
709
* `T` is deeply dealiased to avoid references to local type aliases.
710
710
*/
711
- lazy val synthesizedTypeTag : SpecialHandler =
711
+ lazy val synthesizedTypeTag : SpecialHandler = {
712
712
(formal, span) => implicit ctx => {
713
713
def quotedType (t : Type ) = {
714
714
if (StagingContext .level == 0 )
@@ -725,6 +725,7 @@ trait Implicits { self: Typer =>
725
725
EmptyTree
726
726
}
727
727
}
728
+ }
728
729
729
730
lazy val synthesizedQuoteContext : SpecialHandler =
730
731
(formal, span) => implicit ctx =>
@@ -778,7 +779,7 @@ trait Implicits { self: Typer =>
778
779
/** If `formal` is of the form Eql[T, U], try to synthesize an
779
780
* `Eql.eqlAny[T, U]` as solution.
780
781
*/
781
- lazy val synthesizedEq : SpecialHandler =
782
+ lazy val synthesizedEq : SpecialHandler = {
782
783
(formal, span) => implicit ctx => {
783
784
784
785
/** Is there an `Eql[T, T]` instance, assuming -strictEquality? */
@@ -839,11 +840,12 @@ trait Implicits { self: Typer =>
839
840
EmptyTree
840
841
}
841
842
}
843
+ }
842
844
843
845
/** Creates a tree that will produce a ValueOf instance for the requested type.
844
846
* An EmptyTree is returned if materialization fails.
845
847
*/
846
- lazy val synthesizedValueOf : SpecialHandler =
848
+ lazy val synthesizedValueOf : SpecialHandler = {
847
849
(formal, span) => implicit ctx => {
848
850
def success (t : Tree ) = New (defn.ValueOfClass .typeRef.appliedTo(t.tpe), t :: Nil ).withSpan(span)
849
851
@@ -863,6 +865,7 @@ trait Implicits { self: Typer =>
863
865
EmptyTree
864
866
}
865
867
}
868
+ }
866
869
867
870
/** Create an anonymous class `new Object { type MirroredMonoType = ... }`
868
871
* and mark it with given attachment so that it is made into a mirror at PostTyper.
@@ -923,7 +926,7 @@ trait Implicits { self: Typer =>
923
926
/** An implied instance for a type of the form `Mirror.Product { type MirroredType = T }`
924
927
* where `T` is a generic product type or a case object or an enum case.
925
928
*/
926
- lazy val synthesizedProductMirror : SpecialHandler =
929
+ lazy val synthesizedProductMirror : SpecialHandler = {
927
930
(formal, span) => implicit ctx => {
928
931
def mirrorFor (mirroredType0 : Type ): Tree = {
929
932
val mirroredType = mirroredType0.stripTypeVar
@@ -979,6 +982,7 @@ trait Implicits { self: Typer =>
979
982
case other => EmptyTree
980
983
}
981
984
}
985
+ }
982
986
983
987
/** An implied instance for a type of the form `Mirror.Sum { type MirroredType = T }`
984
988
* where `T` is a generic sum type.
@@ -1114,8 +1118,8 @@ trait Implicits { self: Typer =>
1114
1118
case Nil =>
1115
1119
failed
1116
1120
}
1117
- if (fail.isAmbiguous) failed
1118
- else trySpecialCases(specialHandlers)
1121
+ if (fail.isAmbiguous) failed
1122
+ else trySpecialCases(specialHandlers)
1119
1123
}
1120
1124
1121
1125
/** Search an implicit argument and report error if not found */
@@ -1151,7 +1155,8 @@ trait Implicits { self: Typer =>
1151
1155
def userDefinedMsg (sym : Symbol , cls : Symbol ) = for {
1152
1156
ann <- sym.getAnnotation(cls)
1153
1157
Trees .Literal (Constant (msg : String )) <- ann.argument(0 )
1154
- } yield msg
1158
+ }
1159
+ yield msg
1155
1160
1156
1161
1157
1162
arg.tpe match {
@@ -1279,11 +1284,12 @@ trait Implicits { self: Typer =>
1279
1284
}
1280
1285
1281
1286
/** Check that equality tests between types `ltp` and `rtp` make sense */
1282
- def checkCanEqual (ltp : Type , rtp : Type , span : Span )(implicit ctx : Context ): Unit =
1287
+ def checkCanEqual (ltp : Type , rtp : Type , span : Span )(implicit ctx : Context ): Unit = {
1283
1288
if (! ctx.isAfterTyper && ! assumedCanEqual(ltp, rtp)) {
1284
1289
val res = implicitArgTree(defn.EqlClass .typeRef.appliedTo(ltp, rtp), span)
1285
1290
implicits.println(i " Eql witness found for $ltp / $rtp: $res: ${res.tpe}" )
1286
1291
}
1292
+ }
1287
1293
1288
1294
/** Find an implicit parameter or conversion.
1289
1295
* @param pt The expected type of the parameter or conversion.
@@ -1400,22 +1406,22 @@ trait Implicits { self: Typer =>
1400
1406
}
1401
1407
else tryConversion
1402
1408
}
1403
- if (ctx.reporter.hasErrors) {
1404
- ctx.reporter.removeBufferedMessages
1405
- SearchFailure {
1406
- adapted.tpe match {
1407
- case _ : SearchFailureType => adapted
1408
- case _ => adapted.withType(new MismatchedImplicit (ref, pt, argument))
1409
- }
1409
+ if (ctx.reporter.hasErrors) {
1410
+ ctx.reporter.removeBufferedMessages
1411
+ SearchFailure {
1412
+ adapted.tpe match {
1413
+ case _ : SearchFailureType => adapted
1414
+ case _ => adapted.withType(new MismatchedImplicit (ref, pt, argument))
1410
1415
}
1411
1416
}
1412
- else {
1413
- val returned =
1414
- if (cand.isExtension) Applications .ExtMethodApply (adapted)
1415
- else adapted
1416
- SearchSuccess (returned, ref, cand.level)(ctx.typerState, ctx.gadt)
1417
- }
1418
1417
}
1418
+ else {
1419
+ val returned =
1420
+ if (cand.isExtension) Applications .ExtMethodApply (adapted)
1421
+ else adapted
1422
+ SearchSuccess (returned, ref, cand.level)(ctx.typerState, ctx.gadt)
1423
+ }
1424
+ }
1419
1425
1420
1426
/** Try to type-check implicit reference, after checking that this is not
1421
1427
* a diverging search
0 commit comments