@@ -8,6 +8,7 @@ import Symbols._, StdNames._, Trees._
8
8
import Decorators ._ , transform .SymUtils ._
9
9
import NameKinds .{UniqueName , EvidenceParamName , DefaultGetterName }
10
10
import typer .FrontEnd
11
+ import util .Property
11
12
import collection .mutable .ListBuffer
12
13
import reporting .diagnostic .messages ._
13
14
import reporting .trace
@@ -18,6 +19,11 @@ object desugar {
18
19
import untpd ._
19
20
import DesugarEnums ._
20
21
22
+ /** If a Select node carries this attachment, suppress the check
23
+ * that its type refers to an acessible symbol.
24
+ */
25
+ val SuppressAccessCheck = new Property .Key [Unit ]
26
+
21
27
/** Info of a variable in a pattern: The named tree and its type */
22
28
private type VarInfo = (NameTree , Tree )
23
29
@@ -727,9 +733,11 @@ object desugar {
727
733
fwd
728
734
}
729
735
val moduleName = tdef.name.toTermName
730
- val aliasType = cpy.TypeDef (tdef)(
731
- rhs = completeForwarder(Select (Ident (moduleName), tdef.name)))
732
- val localType = tdef.withFlags(Synthetic | Opaque )
736
+ val localRef = Select (Ident (moduleName), tdef.name)
737
+ localRef.pushAttachment(SuppressAccessCheck , ())
738
+ val aliasType = cpy.TypeDef (tdef)(rhs = completeForwarder(localRef))
739
+ val localType = tdef.withMods(Modifiers (Synthetic | Opaque ).withPrivateWithin(tdef.name))
740
+
733
741
val companions = moduleDef(ModuleDef (
734
742
moduleName, Template (emptyConstructor, Nil , EmptyValDef , localType :: Nil ))
735
743
.withFlags(Synthetic | Opaque ))
0 commit comments