Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion compiler/src/dotty/tools/dotc/core/SymDenotations.scala
Original file line number Diff line number Diff line change
Expand Up @@ -477,7 +477,10 @@ object SymDenotations {

/** The expanded name of this denotation. */
final def expandedName(using Context): Name =
if (name.is(ExpandedName) || isConstructor) name
if name.is(ExpandedName) || isConstructor
|| name.is(DefaultGetterName) && name.match { case DefaultGetterName(nme.CONSTRUCTOR, _) => true case _ => false }
then
name
else name.expandedName(initial.owner)
// need to use initial owner to disambiguate, as multiple private symbols with the same name
// might have been moved from different origins into the same class
Expand Down
4 changes: 2 additions & 2 deletions compiler/src/dotty/tools/dotc/transform/ExpandPrivate.scala
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ import ValueClasses.*
* This is necessary since private methods are not allowed to have the same name
* as inherited public ones.
*
* Also, make non-private any private constructor that is annotated with `@publicInBinary`.
* (See SIP-52)
* Also, make non-private any private constructor that is annotated with `@publicInBinary`.
* (See SIP-52)
*
* See discussion in https://github.com/scala/scala3/pull/784
* and https://github.com/scala/scala3/issues/783
Expand Down
4 changes: 4 additions & 0 deletions tests/pos/i23477.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
//> using options -Ycheck:expandPrivate

class C private (x: Int, y: Int = 1):
def this() = this(1)
Loading