Skip to content

Commit 34e26d3

Browse files
committed
Use Scala 3 implicit scopes in scalatest
Add `-Yscala3ImplicitScopes` to eneble Scala 3 implicit scope rules under `-language:Scala2`
1 parent b280932 commit 34e26d3

File tree

3 files changed

+3
-2
lines changed

3 files changed

+3
-2
lines changed
Submodule scalatest updated 36 files

compiler/src/dotty/tools/dotc/config/ScalaSettings.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ class ScalaSettings extends Settings.SettingGroup {
109109
val YemitTastyInClass: Setting[Boolean] = BooleanSetting("-Yemit-tasty-in-class", "Generate tasty in the .class file and add an empty *.hasTasty file.")
110110
val YlogClasspath: Setting[Boolean] = BooleanSetting("-Ylog-classpath", "Output information about what classpath is being applied.")
111111
val YdisableFlatCpCaching: Setting[Boolean] = BooleanSetting("-YdisableFlatCpCaching", "Do not cache flat classpath representation of classpath elements from jars across compiler instances.")
112+
val Yscala3ImplicitScopes: Setting[Boolean] = BooleanSetting("-Yscala3ImplicitScopes", "Use Scala 3 implicit scopes rules under -language:Scala2")
112113

113114
val Yscala2Unpickler: Setting[String] = StringSetting("-Yscala2-unpickler", "", "Control where we may get Scala 2 symbols from. This is either \"always\", \"never\", or a classpath.", "always")
114115
// TODO: Remove once we drop support for 2.12 standard library

compiler/src/dotty/tools/dotc/typer/Implicits.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ object Implicits {
267267
*/
268268
override val level: Int =
269269
if (outerImplicits == null) 1
270-
else if (ctx.scala2Mode ||
270+
else if ((ctx.scala2Mode && !ctx.settings.Yscala3ImplicitScopes.value) ||
271271
(ctx.owner eq outerImplicits.ctx.owner) &&
272272
(ctx.scope eq outerImplicits.ctx.scope) &&
273273
!refs.head.implicitName.is(LazyImplicitName)) outerImplicits.level

0 commit comments

Comments
 (0)