@@ -110,8 +110,10 @@ object NamerOps:
110110 */
111111 def addConstructorApplies (scope : MutableScope , cls : ClassSymbol , modcls : ClassSymbol )(using Context ): scope.type =
112112 def proxy (constr : Symbol ): Symbol =
113+ var flags = ApplyProxyFlags | (constr.flagsUNSAFE & AccessFlags )
114+ if cls.is(Protected ) && ! modcls.is(Protected ) then flags |= Protected
113115 newSymbol(
114- modcls, nme.apply, ApplyProxyFlags | (constr.flagsUNSAFE & AccessFlags ) ,
116+ modcls, nme.apply, flags ,
115117 ApplyProxyCompleter (constr), coord = constr.coord)
116118 for dcl <- cls.info.decls do
117119 if dcl.isConstructor then scope.enter(proxy(dcl))
@@ -133,9 +135,11 @@ object NamerOps:
133135
134136 /** A new symbol that is the constructor companion for class `cls` */
135137 def classConstructorCompanion (cls : ClassSymbol )(using Context ): TermSymbol =
138+ var flags = ConstructorCompanionFlags
139+ if cls.is(Protected ) then flags |= Protected
136140 val companion = newModuleSymbol(
137141 cls.owner, cls.name.toTermName,
138- ConstructorCompanionFlags , ConstructorCompanionFlags ,
142+ flags, flags ,
139143 constructorCompanionCompleter(cls),
140144 coord = cls.coord,
141145 assocFile = cls.assocFile)
0 commit comments