Skip to content

Commit 86d56f9

Browse files
committed
Fix #12267: Constraints should not cross phases
To enforce the invariant, we need to ensure that tvars are instantiated at end of phases.
1 parent afbe02d commit 86d56f9

File tree

4 files changed

+33
-1
lines changed

4 files changed

+33
-1
lines changed

bench/profiles/stdlib.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
charts:
2+
3+
- name: "scala stdlib-2.13"
4+
url: https://github.com/dotty-staging/scala/commits/stdLib213-dotty-community-build
5+
lines:
6+
- key: stdlib213
7+
label: bootstrapped
8+
9+
scripts:
10+
11+
stdlib213:
12+
- source $PROG_HOME/dotty/bench/scripts/stdlib213
13+
14+
config:
15+
pr_base_url: "https://github.com/lampepfl/dotty/pull/"

compiler/src/dotty/tools/dotc/Run.scala

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,16 @@ class Run(comp: Compiler, ictx: Context) extends ImplicitRunInfo with Constraint
202202
Stats.trackTime(s"$phase ms ") {
203203
val start = System.currentTimeMillis
204204
val profileBefore = profiler.beforePhase(phase)
205+
206+
// invariant: constraint should not cross phase boundary
207+
ctx.typerState.constraint = OrderingConstraint.empty
208+
205209
units = phase.runOn(units)
210+
211+
// force instantiate tvars
212+
// see tests/pos/t2619b.scala
213+
ctx.typerState.gc()
214+
206215
profiler.afterPhase(phase, profileBefore)
207216
if (ctx.settings.Xprint.value.containsPhase(phase))
208217
for (unit <- units)

compiler/src/dotty/tools/dotc/util/Stats.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import collection.mutable
99

1010
@sharable object Stats {
1111

12-
final val enabled = true
12+
final val enabled = false
1313

1414
var monitored: Boolean = false
1515

tests/pos/t2619b.scala

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
abstract class AbstractModule
2+
3+
object ModuleBE extends AbstractModule
4+
object ModuleBF extends AbstractModule
5+
6+
object ModuleBM extends AbstractModule {
7+
def ms: List[AbstractModule] = List(ModuleBE) ::: List(ModuleBF)
8+
}

0 commit comments

Comments
 (0)