Skip to content

Commit 61c5107

Browse files
committed
fix passesConditionForErroringBestEffortCode and improve doc comments
1 parent aefd681 commit 61c5107

File tree

2 files changed

+10
-8
lines changed

2 files changed

+10
-8
lines changed

compiler/src/dotty/tools/dotc/core/tasty/TreePickler.scala

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -66,15 +66,16 @@ class TreePickler(pickler: TastyPickler, attributes: Attributes) {
6666
fillRef(lengthAddr, currentAddr, relative = true)
6767
}
6868

69-
/** There are certain expectations with code which is naturally able to reach pickling
70-
* phase as opposed to one that uses best-effort compilation features.
71-
* When pickling betasty files, we do some custom checks, in case those expectations
72-
* cannot be fulfilled, and if then we can try to do something else.
73-
* For regular non best-effort compilation (without best-effort and without using .betasty on classpath),
74-
* this will always return true.
69+
/** There are certain expectations with code which is naturally able to reach
70+
* pickling phase as opposed to one that uses best-effort compilation features.
71+
* When pickling betasty files, we do some custom checks, in case those
72+
* expectations cannot be fulfilled, and if so, then we can try to do something
73+
* else (usually pickle an ERRORtype).
74+
* For regular non best-effort compilation (without -Ybest-effort with thrown errors
75+
* and without using .betasty on classpath), this will always return true.
7576
*/
7677
private inline def passesConditionForErroringBestEffortCode(condition: => Boolean)(using Context): Boolean =
77-
((!ctx.isBestEffort && ctx.reporter.errorsReported) || ctx.usedBestEffortTasty) || condition
78+
!((ctx.isBestEffort && ctx.reporter.errorsReported) || ctx.usedBestEffortTasty) || condition
7879

7980
def addrOfSym(sym: Symbol): Option[Addr] =
8081
symRefs.get(sym)

compiler/src/dotty/tools/dotc/transform/Pickler.scala

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,8 @@ class Pickler extends Phase {
6262
(super.isRunnable || ctx.isBestEffort)
6363
&& !ctx.settings.fromTasty.value
6464
&& (!ctx.usedBestEffortTasty || ctx.isBestEffort)
65-
// we do not want to pickle `.betasty` if will not create the file either way
65+
// we do not want to pickle `.betasty` if do not plan to actually create the
66+
// betasty file (as signified by the -Ybest-effort option)
6667

6768
// when `-Yjava-tasty` is set we actually want to run this phase on Java sources
6869
override def skipIfJava(using Context): Boolean = false

0 commit comments

Comments
 (0)