Skip to content

Commit 8041083

Browse files
committed
Make def generated from givens not synthetic
Fixes #12949
1 parent cc47c56 commit 8041083

File tree

2 files changed

+20
-1
lines changed

2 files changed

+20
-1
lines changed

compiler/src/dotty/tools/dotc/ast/Desugar.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -783,7 +783,7 @@ object desugar {
783783
DefDef(
784784
className.toTermName, joinParams(constrTparams, defParamss),
785785
classTypeRef, creatorExpr)
786-
.withMods(companionMods | mods.flags.toTermFlags & GivenOrImplicit | Synthetic | Final)
786+
.withMods(companionMods | mods.flags.toTermFlags & GivenOrImplicit | Final)
787787
.withSpan(cdef.span) :: Nil
788788
}
789789

tests/pos/i12949.scala

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
object Catch22:
2+
trait TC[V]
3+
object TC:
4+
export Hodor.TC.given
5+
6+
object Hodor:
7+
object TC:
8+
import Catch22.TC
9+
given fromString[V <: String]: TC[V] = ???
10+
transparent inline given fromDouble[V <: Double]: TC[V] =
11+
new TC[V]:
12+
type Out = Double
13+
given fromInt[V <: Int]: TC[V] with
14+
type Out = Int
15+
16+
object Test:
17+
summon[Catch22.TC["hi"]] //works
18+
summon[Catch22.TC[7.7]] //works
19+
summon[Catch22.TC[1]] //error

0 commit comments

Comments
 (0)