Skip to content

Commit 11dd2bb

Browse files
Merge pull request #6836 from dotty-staging/private-module-constructors
Fix #6834: Make module constructors private
2 parents c809a55 + d307177 commit 11dd2bb

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

compiler/src/dotty/tools/backend/jvm/DottyBackendInterface.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -679,7 +679,7 @@ class DottyBackendInterface(outputDirectory: AbstractFile, val superCallsMap: Ma
679679
isFinal && !toDenot(sym).isClassConstructor && !(sym.is(Flags.Mutable)) && !(sym.enclosingClass.is(Flags.Trait))
680680

681681
def getsJavaPrivateFlag: Boolean =
682-
isPrivate //|| (sym.isPrimaryConstructor && sym.owner.isTopLevelModuleClass)
682+
isPrivate || (sym.isPrimaryConstructor && sym.owner.isTopLevelModuleClass)
683683

684684
def isFinal: Boolean = sym.is(Flags.Final)
685685
def isStaticMember: Boolean = (sym ne NoSymbol) &&

tests/run/i6834.scala

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
object Foo
2+
object Test {
3+
def main(args: Array[String]) =
4+
assert(Foo.getClass.getConstructors.length == 0)
5+
}

0 commit comments

Comments
 (0)