diff --git a/compiler/src/dotty/tools/dotc/ast/Desugar.scala b/compiler/src/dotty/tools/dotc/ast/Desugar.scala index 057a93196154..4f3186941513 100644 --- a/compiler/src/dotty/tools/dotc/ast/Desugar.scala +++ b/compiler/src/dotty/tools/dotc/ast/Desugar.scala @@ -783,7 +783,7 @@ object desugar { DefDef( className.toTermName, joinParams(constrTparams, defParamss), classTypeRef, creatorExpr) - .withMods(companionMods | mods.flags.toTermFlags & GivenOrImplicit | Synthetic | Final) + .withMods(companionMods | mods.flags.toTermFlags & GivenOrImplicit | Final) .withSpan(cdef.span) :: Nil } diff --git a/tests/pos/i12949.scala b/tests/pos/i12949.scala new file mode 100644 index 000000000000..5a886aa894b3 --- /dev/null +++ b/tests/pos/i12949.scala @@ -0,0 +1,19 @@ +object Catch22: + trait TC[V] + object TC: + export Hodor.TC.given + +object Hodor: + object TC: + import Catch22.TC + given fromString[V <: String]: TC[V] = ??? + transparent inline given fromDouble[V <: Double]: TC[V] = + new TC[V]: + type Out = Double + given fromInt[V <: Int]: TC[V] with + type Out = Int + +object Test: + summon[Catch22.TC["hi"]] //works + summon[Catch22.TC[7.7]] //works + summon[Catch22.TC[1]] //error