File tree Expand file tree Collapse file tree 4 files changed +13
-20
lines changed
compiler/src/dotty/tools/dotc/typer
library/src/scalaShadowing Expand file tree Collapse file tree 4 files changed +13
-20
lines changed Original file line number Diff line number Diff line change @@ -792,10 +792,11 @@ trait Checking {
792
792
sym.owner
793
793
}
794
794
val conversionOK =
795
- conv.is(Synthetic ) ||
796
- sym.info.finalResultType.classSymbols.exists(_.isLinkedWith(conv.owner)) ||
797
- defn.isPredefClass(conv.owner) ||
798
- conv.name == nme.reflectiveSelectable && conv.maybeOwner.maybeOwner.maybeOwner == defn.ScalaPackageClass
795
+ conv.is(Synthetic )
796
+ || sym.info.finalResultType.classSymbols.exists(_.isLinkedWith(conv.owner))
797
+ || defn.isPredefClass(conv.owner)
798
+ || conv.name == nme.reflectiveSelectable && conv.maybeOwner.maybeOwner.maybeOwner == defn.ScalaPackageClass
799
+ || conv.maybeOwner == defn.LanguageModule .moduleClass
799
800
if (! conversionOK)
800
801
checkFeature(nme.implicitConversions,
801
802
i " Use of implicit conversion ${conv.showLocated}" , NoSymbol , posd.sourcePos)
Original file line number Diff line number Diff line change @@ -75,23 +75,13 @@ object language {
75
75
*/
76
76
implicit lazy val postfixOps : postfixOps = languageFeature.postfixOps
77
77
78
- /** Only where enabled, accesses to members of structural types that need
79
- * reflection are supported. Reminder: A structural type is a type of the form
80
- * `Parents { Decls }` where `Decls` contains declarations of new members that do
81
- * not override any member in `Parents`. To access one of these members, a
82
- * reflective call is needed.
83
- *
84
- * '''Why keep the feature?''' Structural types provide great flexibility because
85
- * they avoid the need to define inheritance hierarchies a priori. Besides,
86
- * their definition falls out quite naturally from Scala’s concept of type refinement.
87
- *
88
- * '''Why control it?''' Reflection is not available on all platforms. Popular tools
89
- * such as ProGuard have problems dealing with it. Even where reflection is available,
90
- * reflective dispatch can lead to surprising performance degradations.
78
+ /** A forwarder to `scala.reflect.Selectable.reflectiveSelectable`.
79
+ * Enables cross compilation between Scala 2 and Scala 3.
91
80
*
92
81
* @group production
93
82
*/
94
- implicit lazy val reflectiveCalls : reflectiveCalls = languageFeature.reflectiveCalls
83
+ implicit def reflectiveCalls (receiver : Any ): reflect.Selectable =
84
+ reflect.Selectable .reflectiveSelectable(receiver)
95
85
96
86
/** Only where enabled, definitions of legacy implicit conversions and certain uses
97
87
* of implicit conversions are allowed.
Original file line number Diff line number Diff line change 1
- import scala .reflect .Selectable .reflectiveSelectable
1
+ // import scala.reflect.Selectable.reflectiveSelectable
2
+ import scala .language .reflectiveCalls
2
3
class Foo1 { val a : Int = 10 }
3
4
class Foo2 { def a : Int = 10 }
4
5
class Foo3 { var a : Int = 10 }
Original file line number Diff line number Diff line change 1
- import scala .reflect .Selectable .reflectiveSelectable
1
+ // import scala.reflect.Selectable.reflectiveSelectable
2
+ import scala .language .reflectiveCalls
2
3
3
4
trait Foo1 { val a : Int }
4
5
trait Foo2 { def a : Int }
You can’t perform that action at this time.
0 commit comments