File tree Expand file tree Collapse file tree 4 files changed +30
-1
lines changed
compiler/src/dotty/tools/dotc/ast Expand file tree Collapse file tree 4 files changed +30
-1
lines changed Original file line number Diff line number Diff line change @@ -960,7 +960,8 @@ object desugar {
960960 def packageDef (pdef : PackageDef )(implicit ctx : Context ): PackageDef = {
961961 def needsObject (stat : Tree ) = stat match {
962962 case _ : ValDef | _ : PatDef | _ : DefDef => true
963- case stat : TypeDef => ! stat.isClassDef
963+ case stat : ModuleDef => stat.mods.is(Implicit )
964+ case stat : TypeDef => ! stat.isClassDef || stat.mods.is(Implicit )
964965 case _ => false
965966 }
966967 val (nestedStats, topStats) = pdef.stats.partition(needsObject)
Original file line number Diff line number Diff line change 1+ (C(),C())
2+ (a D,a D)
Original file line number Diff line number Diff line change 1+ object Test extends App {
2+ import implicits ._
3+
4+ val c = new C
5+ val c2 = c.pair(c)
6+ println(c2)
7+
8+ val d = new D
9+ val d2 = d.pair(d)
10+ println(d2)
11+ }
Original file line number Diff line number Diff line change 1+ package implicits
2+
3+ case class C ()
4+
5+ implicit object Cops {
6+ def (x : C ) pair (y : C ) = (x, y)
7+ }
8+
9+ class D {
10+ override def toString = " a D"
11+ }
12+
13+ implicit class Ddeco (x : D ) {
14+ def pair (y : D ) = (x, y)
15+ }
You can’t perform that action at this time.
0 commit comments