@@ -110,8 +110,10 @@ object NamerOps:
110
110
*/
111
111
def addConstructorApplies (scope : MutableScope , cls : ClassSymbol , modcls : ClassSymbol )(using Context ): scope.type =
112
112
def proxy (constr : Symbol ): Symbol =
113
+ var flags = ApplyProxyFlags | (constr.flagsUNSAFE & AccessFlags )
114
+ if cls.is(Protected ) && ! modcls.is(Protected ) then flags |= Protected
113
115
newSymbol(
114
- modcls, nme.apply, ApplyProxyFlags | (constr.flagsUNSAFE & AccessFlags ) ,
116
+ modcls, nme.apply, flags ,
115
117
ApplyProxyCompleter (constr), coord = constr.coord)
116
118
for dcl <- cls.info.decls do
117
119
if dcl.isConstructor then scope.enter(proxy(dcl))
@@ -133,9 +135,11 @@ object NamerOps:
133
135
134
136
/** A new symbol that is the constructor companion for class `cls` */
135
137
def classConstructorCompanion (cls : ClassSymbol )(using Context ): TermSymbol =
138
+ var flags = ConstructorCompanionFlags
139
+ if cls.is(Protected ) then flags |= Protected
136
140
val companion = newModuleSymbol(
137
141
cls.owner, cls.name.toTermName,
138
- ConstructorCompanionFlags , ConstructorCompanionFlags ,
142
+ flags, flags ,
139
143
constructorCompanionCompleter(cls),
140
144
coord = cls.coord,
141
145
assocFile = cls.assocFile)
0 commit comments