Skip to content

Commit 889556e

Browse files
committed
Fix rebase breakage and other tweaks
1 parent 6e7bcf2 commit 889556e

File tree

5 files changed

+21
-23
lines changed

5 files changed

+21
-23
lines changed

compiler/src/dotty/tools/dotc/core/Contexts.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ object Contexts {
8888
with Plugins
8989
with Cloneable { thiscontext =>
9090

91-
implicit def thisContext: Context = this
91+
given Context = this
9292

9393
/** All outer contexts, ending in `base.initialCtx` and then `NoContext` */
9494
def outersIterator: Iterator[Context] = new Iterator[Context] {

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ object Inliner {
158158

159159
val unappplySym = ctx.newSymbol(cls, sym.name.toTermName, Synthetic | Method, unapplyInfo, coord = sym.coord).entered
160160
val unapply = DefDef(unappplySym, argss =>
161-
inlineCall(fun.appliedToArgss(argss).withSpan(unapp.span))(ctx.withOwner(unappplySym))
161+
inlineCall(fun.appliedToArgss(argss).withSpan(unapp.span))(using ctx.withOwner(unappplySym))
162162
)
163163
val cdef = ClassDef(cls, DefDef(constr), List(unapply))
164164
val newUnapply = Block(cdef :: Nil, New(cls.typeRef, Nil))

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

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,11 @@ trait NamerContextOps {
3939
* in order to make sure that updates to class members are reflected in
4040
* finger prints.
4141
*/
42-
def enter(sym: Symbol): Symbol = {
43-
thisContext.owner match {
42+
def enter(sym: Symbol): Symbol =
43+
thisCtx.owner match
4444
case cls: ClassSymbol => cls.enter(sym)
4545
case _ => thisCtx.scope.openForMutations.enter(sym)
46-
}
4746
sym
48-
}
4947

5048
/** The denotation with the given `name` and all `required` flags in current context
5149
*/

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

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -67,23 +67,23 @@ object ProtoTypes {
6767
*/
6868
def constrainResult(mt: Type, pt: Type)(using Context): Boolean =
6969
inContext(ctx.addMode(Mode.ConstrainResult)) {
70-
val savedConstraint = ctx.typerState.constraint
71-
val res = pt.widenExpr match {
72-
case pt: FunProto =>
73-
mt match {
74-
case mt: MethodType => constrainResult(resultTypeApprox(mt), pt.resultType)
75-
case _ => true
76-
}
77-
case _: ValueTypeOrProto if !disregardProto(pt) =>
78-
isCompatible(normalize(mt, pt), pt)
79-
case pt: WildcardType if pt.optBounds.exists =>
80-
isCompatible(normalize(mt, pt), pt)
81-
case _ =>
82-
true
70+
val savedConstraint = ctx.typerState.constraint
71+
val res = pt.widenExpr match {
72+
case pt: FunProto =>
73+
mt match {
74+
case mt: MethodType => constrainResult(resultTypeApprox(mt), pt.resultType)
75+
case _ => true
76+
}
77+
case _: ValueTypeOrProto if !disregardProto(pt) =>
78+
isCompatible(normalize(mt, pt), pt)
79+
case pt: WildcardType if pt.optBounds.exists =>
80+
isCompatible(normalize(mt, pt), pt)
81+
case _ =>
82+
true
83+
}
84+
if (!res) ctx.typerState.resetConstraintTo(savedConstraint)
85+
res
8386
}
84-
if (!res) ctx.typerState.resetConstraintTo(savedConstraint)
85-
res
86-
}
8787

8888
/** Constrain result with special case if `meth` is an inlineable method in an inlineable context.
8989
* In that case, we should always succeed and not constrain type parameters in the expected type,

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -351,7 +351,7 @@ class Typer extends Namer
351351
if (defDenot.symbol.is(Package))
352352
result = checkNewOrShadowed(previous orElse found, PackageClause)
353353
else if (prevPrec.ordinal < PackageClause.ordinal)
354-
result = findRefRecur(found, PackageClause, ctx)(ctx.outer)
354+
result = findRefRecur(found, PackageClause, ctx)(using ctx.outer)
355355
}
356356

357357
if result.exists then result

0 commit comments

Comments
 (0)