Skip to content

Commit 54d409b

Browse files
committed
Report errors instead of crash
1 parent da72317 commit 54d409b

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

compiler/src/dotty/tools/dotc/transform/init/CycleChecker.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -246,8 +246,8 @@ class CycleChecker(cache: Cache) {
246246
val pot = Hot(dep.cls)(dep.source)
247247
val effs = pot.potentialsOf(dep.symbol)(using env).promote(dep.source)
248248

249-
val errs = effs.flatMap(Checking.check(_)(using state))
250-
assert(errs.isEmpty, "unexpected errors: " + Errors.show(errs.toList))
249+
val errs = effs.flatMap(Checking.check(_)(using state)).filter(!_.isInstanceOf[CallUnknown])
250+
errs.foreach(_.issue)
251251

252252
val deps = state.dependencies.toList
253253
proxyCache(dep.symbol) = deps
@@ -364,7 +364,7 @@ class CycleChecker(cache: Cache) {
364364
val effs = pot.effectsOf(dep.symbol)(using env)
365365

366366
val errs = effs.flatMap(Checking.check(_)(using state))
367-
assert(errs.isEmpty, "unexpected errors: " + Errors.show(errs.toList) + " while analyzing " + dep.show)
367+
errs.foreach(_.issue)
368368

369369
state.dependencies.toList
370370
}

compiler/src/dotty/tools/dotc/transform/init/Errors.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ object Errors {
116116

117117
case class CallUnknown(meth: Symbol, source: Tree, trace: Seq[Tree]) extends Error {
118118
def show(using Context): String =
119-
"Calling the external method " + meth.show + " may cause initialization errors" + "."
119+
"Unable to analyze external " + meth.show + "."
120120
}
121121

122122
/** Promote a value under initialization to fully-initialized */

0 commit comments

Comments
 (0)