File tree 2 files changed +33
-22
lines changed
compiler/src/dotty/tools/dotc/typer
2 files changed +33
-22
lines changed Original file line number Diff line number Diff line change @@ -2842,9 +2842,10 @@ class Typer(@constructorOnly nestingLevel: Int = 0) extends Namer
2842
2842
}
2843
2843
2844
2844
private def setAbstractTrackedInfo (sym : Symbol , rhs : Tree , tpt : untpd.Tree )(using Context ): Unit =
2845
- if sym.allOverriddenSymbols.exists(_.flags.is(Tracked )) && ! sym.flags.is(ParamAccessor ) && ! sym.flags.is(Param ) then
2846
- sym.setFlag(Tracked )
2847
- if tpt.isEmpty then
2845
+ if ! sym.flags.is(ParamAccessor ) && ! sym.flags.is(Param ) then
2846
+ if sym.allOverriddenSymbols.exists(_.flags.is(Tracked )) then
2847
+ sym.setFlag(Tracked )
2848
+ if sym.flags.is(Tracked ) && tpt.isEmpty then
2848
2849
sym.info = rhs.tpe
2849
2850
2850
2851
private def retractDefDef (sym : Symbol )(using Context ): Tree =
Original file line number Diff line number Diff line change @@ -2,39 +2,49 @@ import scala.language.experimental.modularity
2
2
import scala .language .future
3
3
4
4
trait F :
5
- tracked val x : Int
5
+ tracked val a : Int
6
6
7
7
trait G :
8
- tracked val y : Int
8
+ tracked val b : Int
9
9
10
10
trait H :
11
- tracked val z : Int = 3
11
+ tracked val c : Int = 3
12
12
13
13
trait I extends F
14
14
15
15
trait J extends F :
16
- val x : Int = 1
16
+ val a : Int = 1
17
17
18
- class K (tracked val x : Int )
18
+ class K (tracked val d : Int )
19
+
20
+ class L
21
+
22
+ trait M :
23
+ val f : Int
19
24
20
25
object Test :
21
- // val f : F(1) /*: F { val x: 1 }*/ = new F:
22
- // val x: 1 = 1
23
26
val f = new F :
24
- val x = 1
27
+ val a = 1
25
28
val g = new G :
26
- val y : 2 = 2
29
+ val b : 2 = 2
27
30
val h = new H :
28
- override val z = 4
31
+ override val c = 4
29
32
val i = new I :
30
- val x = 5
33
+ val a = 5
31
34
val j = new J :
32
- override val x = 6
35
+ override val a = 6
33
36
val k = new K (7 )
34
-
35
- summon[f.x.type <:< 1 ]
36
- summon[g.y.type <:< 2 ]
37
- summon[h.z.type <:< 4 ]
38
- summon[i.x.type <:< 5 ]
39
- summon[j.x.type <:< 6 ]
40
- summon[k.x.type <:< 7 ]
37
+ val l = new L {
38
+ tracked val e = 8
39
+ }
40
+ val m = new M :
41
+ tracked val f = 9
42
+
43
+ summon[f.a.type <:< 1 ]
44
+ summon[g.b.type <:< 2 ]
45
+ summon[h.c.type <:< 4 ]
46
+ summon[i.a.type <:< 5 ]
47
+ summon[j.a.type <:< 6 ]
48
+ summon[k.d.type <:< 7 ]
49
+ // summon[l.e.type <:< 8] // unrelated issue -- error: e is not a member of L
50
+ summon[m.f.type <:< 9 ]
You can’t perform that action at this time.
0 commit comments