Skip to content

Commit 4f437ae

Browse files
committed
More fixes in code and tests
1 parent 24dc2de commit 4f437ae

File tree

85 files changed

+1226
-1231
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

85 files changed

+1226
-1231
lines changed

compiler/src/dotty/tools/backend/jvm/GenBCode.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,10 +161,10 @@ class GenBCodePipeline(val int: DottyBackendInterface)(implicit val ctx: Context
161161
val same = classSymbol.effectiveName.toString == dupClassSym.effectiveName.toString
162162
ctx.atPhase(ctx.typerPhase) {
163163
if (same)
164-
the[Context].warning( // FIXME: This should really be an error, but then FromTasty tests fail
164+
summon[Context].warning( // FIXME: This should really be an error, but then FromTasty tests fail
165165
s"${cl1.show} and ${cl2.showLocated} produce classes that overwrite one another", cl1.sourcePos)
166166
else
167-
the[Context].warning(s"${cl1.show} differs only in case from ${cl2.showLocated}. " +
167+
summon[Context].warning(s"${cl1.show} differs only in case from ${cl2.showLocated}. " +
168168
"Such classes will overwrite one another on case-insensitive filesystems.", cl1.sourcePos)
169169
}
170170
}

compiler/src/dotty/tools/dotc/ast/Desugar.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -893,7 +893,7 @@ object desugar {
893893
* If the given member `mdef` is not of this form, flag it as an error.
894894
*/
895895

896-
def makeExtensionDef(mdef: Tree, tparams: List[TypeDef], leadingParams: List[ValDef]) given (ctx: Context): Tree = {
896+
def makeExtensionDef(mdef: Tree, tparams: List[TypeDef], leadingParams: List[ValDef])(given ctx: Context): Tree = {
897897
val allowed = "allowed here, since collective parameters are given"
898898
mdef match {
899899
case mdef: DefDef =>

compiler/src/dotty/tools/dotc/ast/MainProxies.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ object MainProxies {
4040
}
4141

4242
import untpd._
43-
def mainProxy(mainFun: Symbol) given (ctx: Context): List[TypeDef] = {
43+
def mainProxy(mainFun: Symbol)(given ctx: Context): List[TypeDef] = {
4444
val mainAnnotSpan = mainFun.getAnnotation(defn.MainAnnot).get.tree.span
4545
def pos = mainFun.sourcePos
4646
val argsRef = Ident(nme.args)

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ object Annotations {
121121
def deferred(sym: Symbol)(treeFn: ImplicitFunction1[Context, Tree])(implicit ctx: Context): Annotation =
122122
new LazyAnnotation {
123123
override def symbol(implicit ctx: Context): Symbol = sym
124-
def complete(implicit ctx: Context) = treeFn given ctx
124+
def complete(implicit ctx: Context) = treeFn(given ctx)
125125
}
126126

127127
/** Create an annotation where the symbol and the tree are computed lazily. */
@@ -131,12 +131,12 @@ object Annotations {
131131

132132
override def symbol(implicit ctx: Context): Symbol = {
133133
if (mySym == null || mySym.defRunId != ctx.runId) {
134-
mySym = symf given ctx
134+
mySym = symf(given ctx)
135135
assert(mySym != null)
136136
}
137137
mySym
138138
}
139-
def complete(implicit ctx: Context) = treeFn given ctx
139+
def complete(implicit ctx: Context) = treeFn(given ctx)
140140
}
141141

142142
def deferred(atp: Type, args: List[Tree])(implicit ctx: Context): Annotation =

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ object Decorators {
174174
def (x: T) reporting[T](
175175
op: ImplicitFunction1[WrappedResult[T], String],
176176
printer: config.Printers.Printer = config.Printers.default): T = {
177-
printer.println(op given WrappedResult(x))
177+
printer.println(op(given WrappedResult(x)))
178178
x
179179
}
180180
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ abstract class Periods { self: Context =>
2222

2323
/** Execute `op` at given phase id */
2424
def atPhase[T](pid: PhaseId)(op: ImplicitFunction1[Context, T]): T =
25-
op given ctx.withPhase(pid)
25+
op(given ctx.withPhase(pid))
2626

2727
/** The period containing the current period where denotations do not change.
2828
* We compute this by taking as first phase the first phase less or equal to

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ trait Phases {
3737
def atNextPhase[T](op: ImplicitFunction1[Context, T]): T = atPhase(phase.next)(op)
3838

3939
def atPhaseNotLaterThan[T](limit: Phase)(op: ImplicitFunction1[Context, T]): T =
40-
if (!limit.exists || phase <= limit) op given this else atPhase(limit)(op)
40+
if (!limit.exists || phase <= limit) op(given this) else atPhase(limit)(op)
4141

4242
def isAfterTyper: Boolean = base.isAfterTyper(phase)
4343
}

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ object Signature {
167167
y match {
168168
case y: TypeName =>
169169
// `Ordering[TypeName]` doesn't work due to `Ordering` still being invariant
170-
the[Ordering[Name]].compare(x, y)
170+
summon[Ordering[Name]].compare(x, y)
171171
case y: Int =>
172172
1
173173
}
@@ -184,7 +184,7 @@ object Signature {
184184
import scala.math.Ordering.Implicits.seqOrdering
185185
val paramsOrdering = seqOrdering(paramSigOrdering).compare(x.paramsSig, y.paramsSig)
186186
if (paramsOrdering != 0) paramsOrdering
187-
else the[Ordering[Name]].compare(x.resSig, y.resSig)
187+
else summon[Ordering[Name]].compare(x.resSig, y.resSig)
188188
}
189189
}
190190
}

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ class TypeComparer(initctx: Context) extends ConstraintHandling[AbsentContext] w
195195
//}
196196
assert(!ctx.settings.YnoDeepSubtypes.value)
197197
if (Config.traceDeepSubTypeRecursions && !this.isInstanceOf[ExplainingTypeComparer])
198-
ctx.log(TypeComparer.explained(the[Context].typeComparer.isSubType(tp1, tp2, approx)))
198+
ctx.log(TypeComparer.explained(summon[Context].typeComparer.isSubType(tp1, tp2, approx)))
199199
}
200200
// Eliminate LazyRefs before checking whether we have seen a type before
201201
val normalize = new TypeMap {
@@ -2309,7 +2309,7 @@ object TypeComparer {
23092309
/** Show trace of comparison operations when performing `op` */
23102310
def explaining[T](say: String => Unit)(op: ImplicitFunction1[Context, T])(implicit ctx: Context): T = {
23112311
val nestedCtx = ctx.fresh.setTypeComparerFn(new ExplainingTypeComparer(_))
2312-
val res = try { op given nestedCtx } finally { say(nestedCtx.typeComparer.lastTrace()) }
2312+
val res = try { op(given nestedCtx) } finally { say(nestedCtx.typeComparer.lastTrace()) }
23132313
res
23142314
}
23152315

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ class TyperState(private val previous: TyperState /* | Null */) {
9898
*/
9999
def test[T](op: ImplicitFunction1[Context, T])(implicit ctx: Context): T =
100100
if (isShared)
101-
op given ctx.fresh.setExploreTyperState()
101+
op(given ctx.fresh.setExploreTyperState())
102102
else {
103103
val savedConstraint = myConstraint
104104
val savedReporter = myReporter
@@ -113,7 +113,7 @@ class TyperState(private val previous: TyperState /* | Null */) {
113113
testReporter.inUse = true
114114
testReporter
115115
}
116-
try op given ctx
116+
try op(given ctx)
117117
finally {
118118
testReporter.inUse = false
119119
resetConstraintTo(savedConstraint)

0 commit comments

Comments
 (0)