diff --git a/compiler/src/dotty/tools/dotc/typer/Typer.scala b/compiler/src/dotty/tools/dotc/typer/Typer.scala index 96149caf215d..d45e24bf30e5 100644 --- a/compiler/src/dotty/tools/dotc/typer/Typer.scala +++ b/compiler/src/dotty/tools/dotc/typer/Typer.scala @@ -2511,6 +2511,9 @@ class Typer(@constructorOnly nestingLevel: Int = 0) extends Namer checkSimpleKinded(parent) // allow missing type parameters if there are implicit arguments to pass // since we can infer type arguments from them + val constr = psym.primaryConstructor + if psym.is(Trait) && constr.exists && !cls.isRefinementClass then + ensureAccessible(constr.termRef, superAccess = true, tree.srcPos) else checkParentCall(result, cls) if cls is Case then diff --git a/tests/neg/i17089.scala b/tests/neg/i17089.scala new file mode 100644 index 000000000000..46968aa6f093 --- /dev/null +++ b/tests/neg/i17089.scala @@ -0,0 +1,4 @@ +object o: + trait T private[o]() + +def test = new o.T { } // error