Skip to content

Commit 5cdf2d6

Browse files
committed
Avoid IFT in Reporter#reportsErrorsFor
If we make this method take an implicit function rather than a normal one we get a build error with trace: ``` [error] ## Exception when compiling 9 sources to /Users/odersky/workspace/dotty/sbt-bridge/src/target/classes [error] Type scala.ImplicitFunction1 not present [error] sun.reflect.generics.factory.CoreReflectionFactory.makeNamedType(CoreReflectionFactory.java:117) [error] sun.reflect.generics.visitor.Reifier.visitClassTypeSignature(Reifier.java:125) [error] sun.reflect.generics.tree.ClassTypeSignature.accept(ClassTypeSignature.java:49) [error] sun.reflect.generics.repository.ConstructorRepository.getParameterTypes(ConstructorRepository.java:94) [error] java.lang.reflect.Executable.getGenericParameterTypes(Executable.java:283) [error] java.lang.reflect.Method.getGenericParameterTypes(Method.java:283) [error] sbt.internal.inc.ClassToAPI$.parameterTypes(ClassToAPI.scala:566) [error] sbt.internal.inc.ClassToAPI$.methodToDef(ClassToAPI.scala:318) [error] sbt.internal.inc.ClassToAPI$.$anonfun$structure$1(ClassToAPI.scala:182) [error] sbt.internal.inc.ClassToAPI$.$anonfun$mergeMap$1(ClassToAPI.scala:400) [error] scala.collection.TraversableLike.$anonfun$flatMap$1(TraversableLike.scala:240) [error] scala.collection.IndexedSeqOptimized.foreach(IndexedSeqOptimized.scala:32) [error] scala.collection.IndexedSeqOptimized.foreach$(IndexedSeqOptimized.scala:29) [error] scala.collection.mutable.WrappedArray.foreach(WrappedArray.scala:37) [error] scala.collection.TraversableLike.flatMap(TraversableLike.scala:240) [error] scala.collection.TraversableLike.flatMap$(TraversableLike.scala:237) [error] scala.collection.AbstractTraversable.flatMap(Traversable.scala:104) [error] sbt.internal.inc.ClassToAPI$.merge(ClassToAPI.scala:411) [error] sbt.internal.inc.ClassToAPI$.mergeMap(ClassToAPI.scala:400) [error] sbt.internal.inc.ClassToAPI$.structure(ClassToAPI.scala:182) [error] sbt.internal.inc.ClassToAPI$.x$2$lzycompute$1(ClassToAPI.scala:133) [error] sbt.internal.inc.ClassToAPI$.x$2$1(ClassToAPI.scala:133) [error] sbt.internal.inc.ClassToAPI$.instance$lzycompute$1(ClassToAPI.scala:133) [error] sbt.internal.inc.ClassToAPI$.instance$1(ClassToAPI.scala:133) [error] sbt.internal.inc.ClassToAPI$.$anonfun$toDefinitions0$1(ClassToAPI.scala:140) [error] xsbti.api.SafeLazyProxy$$anon$1.get(SafeLazyProxy.scala:26) [error] xsbti.api.SafeLazy$Impl.get(SafeLazy.java:58) ```
1 parent 86acb56 commit 5cdf2d6

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

compiler/src/dotty/tools/dotc/reporting/Reporter.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -252,9 +252,9 @@ abstract class Reporter extends interfaces.ReporterResult {
252252

253253
/** Run `op` and return `true` if errors were reported by this reporter.
254254
*/
255-
def reportsErrorsFor(op: given Context => Unit) given Context : Boolean = {
255+
def reportsErrorsFor(op: Context => Unit) given (ctx: Context): Boolean = {
256256
val initial = errorCount
257-
op
257+
op(ctx)
258258
errorCount > initial
259259
}
260260

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1138,7 +1138,7 @@ trait Checking {
11381138

11391139
/** check that annotation `annot` is applicable to symbol `sym` */
11401140
def checkAnnotApplicable(annot: Tree, sym: Symbol) given (ctx: Context): Boolean =
1141-
!ctx.reporter.reportsErrorsFor {
1141+
!ctx.reporter.reportsErrorsFor { implicit ctx =>
11421142
val pos = annot.sourcePos
11431143
if (annot.symbol == defn.MainAnnot) {
11441144
if (!sym.isRealMethod)

0 commit comments

Comments
 (0)