File tree Expand file tree Collapse file tree 7 files changed +78
-2
lines changed
compiler/src/dotty/tools/dotc/core Expand file tree Collapse file tree 7 files changed +78
-2
lines changed Original file line number Diff line number Diff line change @@ -183,8 +183,9 @@ object NamerOps:
183
183
cls.owner, cls.name.toTermName,
184
184
flags, flags,
185
185
constructorCompanionCompleter(cls),
186
- coord = cls.coord,
187
- compUnitInfo = cls.compUnitInfo)
186
+ cls.privateWithin,
187
+ cls.coord,
188
+ cls.compUnitInfo)
188
189
companion.moduleClass.registerCompanion(cls)
189
190
cls.registerCompanion(companion.moduleClass)
190
191
companion
Original file line number Diff line number Diff line change @@ -12,7 +12,9 @@ package p:
12
12
private [p] class C (i : Int ) // ctor proxy gets privateWithin of class
13
13
private [p] class D (i : Int )
14
14
object D
15
+ private class E (i : Int )
15
16
16
17
package q:
17
18
def f () = p.C (42 ) // error
18
19
def g () = p.D (42 ) // error
20
+ def h () = p.E (42 ) // error
Original file line number Diff line number Diff line change
1
+
2
+ package i22560:
3
+ val alpha = C .D () // error
4
+
5
+ class Test extends Enumeration :
6
+ val Hearts = Val (27 ) // error
7
+ val Diamonds = Val () // error
8
+
9
+ package q:
10
+ def f () = p.C (42 ) // error
11
+ def g () = p.D (42 ) // error
Original file line number Diff line number Diff line change
1
+
2
+ package i22560:
3
+
4
+ object C :
5
+ protected class D
6
+
7
+ class Enumeration :
8
+ protected class Val (i : Int ):
9
+ def this () = this (42 )
10
+ object Val
11
+
12
+ package p:
13
+ private [p] class C (i : Int ) // companion gets privateWithin of class
14
+ private [p] class D (i : Int ) // ctor proxy gets privateWithin of class
15
+ object D
16
+
Original file line number Diff line number Diff line change @@ -20,3 +20,13 @@ package companioned:
20
20
class Test extends Enumeration :
21
21
val Hearts = Val (27 )
22
22
val Diamonds = Val ()
23
+
24
+ package p:
25
+
26
+ package internal:
27
+
28
+ protected [p] class P (i : Int )
29
+ private [p] class Q (i : Int )
30
+
31
+ def f = internal.P (42 )
32
+ def g = internal.Q (42 )
Original file line number Diff line number Diff line change
1
+
2
+ package companionless:
3
+
4
+ class Test extends Enumeration :
5
+ val Hearts = Val (27 )
6
+ val Diamonds = Val ()
7
+
8
+
9
+ package companioned:
10
+
11
+ class Test extends Enumeration :
12
+ val Hearts = Val (27 )
13
+ val Diamonds = Val ()
14
+
15
+ package p:
16
+
17
+ def f = internal.P (42 )
Original file line number Diff line number Diff line change
1
+
2
+ package companionless:
3
+
4
+ class Enumeration :
5
+ protected class Val (i : Int ):
6
+ def this () = this (42 )
7
+
8
+ package companioned:
9
+
10
+ class Enumeration :
11
+ protected class Val (i : Int ):
12
+ def this () = this (42 )
13
+ protected object Val
14
+
15
+ package p:
16
+
17
+ package internal:
18
+
19
+ protected [p] class P (i : Int )
You can’t perform that action at this time.
0 commit comments