Skip to content

Commit 64cc671

Browse files
liufengyuntanishiking
authored andcommitted
Fix join of values
After scala#12711, it is no longer the case that `Warm < ThisRef`. The reason is that the class parameters for `ThisRef` are always hot, while it is not the case anymore after scala#12711. Actually even before scala#12711, it's not the case because the outers of warm objects may not be hot. The theory does not have inner classes, it thus does not suffer from the problem.
1 parent b3a1bd0 commit 64cc671

File tree

1 file changed

+12
-19
lines changed

1 file changed

+12
-19
lines changed

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

Lines changed: 12 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -28,24 +28,20 @@ class Semantic {
2828
* Value = Hot | Cold | Warm | ThisRef | Fun | RefSet
2929
*
3030
* Cold
31-
* ┌──────► ▲ ──┐ ◄────┐
32-
* │ │ │ │
33-
* │ │ │ │
34-
* ThisRef(C) │ │
35-
* │ │ │
36-
* Warm(D) Fun RefSet
37-
* │ ▲ ▲ ▲
38-
* │ │ │ │
39-
* Warm(C) │ │
40-
* ▲ │ │ │
41-
* │ │ │ │
42-
* └─────────┴──────┴───────┘
31+
* ┌──────► ▲ ◄────┐ ◄────┐
32+
* │ │ │ │
33+
* │ │ │ │
34+
* | │ │ │
35+
* | │ │
36+
* ThisRef(C) Warm(D) Fun RefSet
37+
* │ ▲ ▲ ▲
38+
* │ │ │ │
39+
* | │ │
40+
* ▲ │ │ │
41+
* │ │ │ │
42+
* └─────────┴──────┴───────┘
4343
* Hot
4444
*
45-
* The most important ordering is the following:
46-
*
47-
* Hot ⊑ Warm(C) ⊑ ThisRef(C) ⊑ Cold
48-
*
4945
* The diagram above does not reflect relationship between `RefSet`
5046
* and other values. `RefSet` represents a set of values which could
5147
* be `ThisRef`, `Warm` or `Fun`. The following ordering applies for
@@ -302,9 +298,6 @@ class Semantic {
302298
case (Cold, _) => Cold
303299
case (_, Cold) => Cold
304300

305-
case (a: Warm, b: ThisRef) if a.klass == b.klass => b
306-
case (a: ThisRef, b: Warm) if a.klass == b.klass => a
307-
308301
case (a: (Fun | Warm | ThisRef), b: (Fun | Warm | ThisRef)) => RefSet(a :: b :: Nil)
309302

310303
case (a: (Fun | Warm | ThisRef), RefSet(refs)) => RefSet(a :: refs)

0 commit comments

Comments
 (0)