diff --git a/compiler/src/dotty/tools/dotc/typer/Typer.scala b/compiler/src/dotty/tools/dotc/typer/Typer.scala index c518de7dbbfe..3f0b8c9c01b4 100644 --- a/compiler/src/dotty/tools/dotc/typer/Typer.scala +++ b/compiler/src/dotty/tools/dotc/typer/Typer.scala @@ -3038,7 +3038,7 @@ class Typer(@constructorOnly nestingLevel: Int = 0) extends Namer body /** Implement givens that were declared with a `deferred` rhs. - * The a given value matching the declared type is searched in a + * The given value matching the declared type is searched in a * context directly enclosing the current class, in which all given * parameters of the current class are also defined. */ @@ -3067,7 +3067,7 @@ class Typer(@constructorOnly nestingLevel: Int = 0) extends Namer )(using searchCtx) val impl = dcl.copy(cls, - flags = dcl.flags &~ (HasDefault | Deferred) | Final | Override, + flags = dcl.flags &~ (HasDefault | Deferred) | Override, info = target, coord = rhs.span).entered.asTerm diff --git a/tests/pos/i21189.scala b/tests/pos/i21189.scala new file mode 100644 index 000000000000..88a0bf601476 --- /dev/null +++ b/tests/pos/i21189.scala @@ -0,0 +1,10 @@ +//> using options -source:future -language:experimental.modularity + +class MySortedSet[T : Ord] extends SortedSet[T] + +trait Ord[T] + +trait Sorted[T]: + given Ord[T] as ord = compiletime.deferred + +class SortedSet[T : Ord] extends Sorted[T]