Skip to content

Commit

Permalink
Make def generated from givens not synthetic
Browse files Browse the repository at this point in the history
  • Loading branch information
odersky authored and dwijnand committed Aug 19, 2021
1 parent 609a576 commit e567965
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
2 changes: 1 addition & 1 deletion compiler/src/dotty/tools/dotc/ast/Desugar.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down
19 changes: 19 additions & 0 deletions tests/pos/i12949.scala
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit e567965

Please sign in to comment.