Skip to content

Commit 948c6b3

Browse files
committed
Fix indentation in Implicits
1 parent cab060c commit 948c6b3

File tree

1 file changed

+28
-22
lines changed

1 file changed

+28
-22
lines changed

compiler/src/dotty/tools/dotc/typer/Implicits.scala

Lines changed: 28 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -697,7 +697,7 @@ trait Implicits { self: Typer =>
697697
classTag.select(sym.name.toTermName)
698698
else
699699
classTag.select(nme.apply).appliedToType(tp).appliedTo(clsOf(erasure(tp)))
700-
tag.withSpan(span)
700+
tag.withSpan(span)
701701
case tp =>
702702
EmptyTree
703703
}
@@ -708,7 +708,7 @@ trait Implicits { self: Typer =>
708708
/** Synthesize the tree for `'[T]` for an implicit `scala.quoted.Type[T]`.
709709
* `T` is deeply dealiased to avoid references to local type aliases.
710710
*/
711-
lazy val synthesizedTypeTag: SpecialHandler =
711+
lazy val synthesizedTypeTag: SpecialHandler = {
712712
(formal, span) => implicit ctx => {
713713
def quotedType(t: Type) = {
714714
if (StagingContext.level == 0)
@@ -725,6 +725,7 @@ trait Implicits { self: Typer =>
725725
EmptyTree
726726
}
727727
}
728+
}
728729

729730
lazy val synthesizedQuoteContext: SpecialHandler =
730731
(formal, span) => implicit ctx =>
@@ -778,7 +779,7 @@ trait Implicits { self: Typer =>
778779
/** If `formal` is of the form Eql[T, U], try to synthesize an
779780
* `Eql.eqlAny[T, U]` as solution.
780781
*/
781-
lazy val synthesizedEq: SpecialHandler =
782+
lazy val synthesizedEq: SpecialHandler = {
782783
(formal, span) => implicit ctx => {
783784

784785
/** Is there an `Eql[T, T]` instance, assuming -strictEquality? */
@@ -839,11 +840,12 @@ trait Implicits { self: Typer =>
839840
EmptyTree
840841
}
841842
}
843+
}
842844

843845
/** Creates a tree that will produce a ValueOf instance for the requested type.
844846
* An EmptyTree is returned if materialization fails.
845847
*/
846-
lazy val synthesizedValueOf: SpecialHandler =
848+
lazy val synthesizedValueOf: SpecialHandler = {
847849
(formal, span) => implicit ctx => {
848850
def success(t: Tree) = New(defn.ValueOfClass.typeRef.appliedTo(t.tpe), t :: Nil).withSpan(span)
849851

@@ -863,6 +865,7 @@ trait Implicits { self: Typer =>
863865
EmptyTree
864866
}
865867
}
868+
}
866869

867870
/** Create an anonymous class `new Object { type MirroredMonoType = ... }`
868871
* and mark it with given attachment so that it is made into a mirror at PostTyper.
@@ -923,7 +926,7 @@ trait Implicits { self: Typer =>
923926
/** An implied instance for a type of the form `Mirror.Product { type MirroredType = T }`
924927
* where `T` is a generic product type or a case object or an enum case.
925928
*/
926-
lazy val synthesizedProductMirror: SpecialHandler =
929+
lazy val synthesizedProductMirror: SpecialHandler = {
927930
(formal, span) => implicit ctx => {
928931
def mirrorFor(mirroredType0: Type): Tree = {
929932
val mirroredType = mirroredType0.stripTypeVar
@@ -979,6 +982,7 @@ trait Implicits { self: Typer =>
979982
case other => EmptyTree
980983
}
981984
}
985+
}
982986

983987
/** An implied instance for a type of the form `Mirror.Sum { type MirroredType = T }`
984988
* where `T` is a generic sum type.
@@ -1114,8 +1118,8 @@ trait Implicits { self: Typer =>
11141118
case Nil =>
11151119
failed
11161120
}
1117-
if (fail.isAmbiguous) failed
1118-
else trySpecialCases(specialHandlers)
1121+
if (fail.isAmbiguous) failed
1122+
else trySpecialCases(specialHandlers)
11191123
}
11201124

11211125
/** Search an implicit argument and report error if not found */
@@ -1151,7 +1155,8 @@ trait Implicits { self: Typer =>
11511155
def userDefinedMsg(sym: Symbol, cls: Symbol) = for {
11521156
ann <- sym.getAnnotation(cls)
11531157
Trees.Literal(Constant(msg: String)) <- ann.argument(0)
1154-
} yield msg
1158+
}
1159+
yield msg
11551160

11561161

11571162
arg.tpe match {
@@ -1279,11 +1284,12 @@ trait Implicits { self: Typer =>
12791284
}
12801285

12811286
/** 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 = {
12831288
if (!ctx.isAfterTyper && !assumedCanEqual(ltp, rtp)) {
12841289
val res = implicitArgTree(defn.EqlClass.typeRef.appliedTo(ltp, rtp), span)
12851290
implicits.println(i"Eql witness found for $ltp / $rtp: $res: ${res.tpe}")
12861291
}
1292+
}
12871293

12881294
/** Find an implicit parameter or conversion.
12891295
* @param pt The expected type of the parameter or conversion.
@@ -1400,22 +1406,22 @@ trait Implicits { self: Typer =>
14001406
}
14011407
else tryConversion
14021408
}
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))
14101415
}
14111416
}
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-
}
14181417
}
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+
}
14191425

14201426
/** Try to type-check implicit reference, after checking that this is not
14211427
* a diverging search

0 commit comments

Comments
 (0)