Skip to content

Fix Scala2Compat language import #7638

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 28, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion compiler/src/dotty/tools/dotc/core/StdNames.scala
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,6 @@ object StdNames {
val Ref: N = "Ref"
val RootPackage: N = "RootPackage"
val RootClass: N = "RootClass"
val Scala2: N = "Scala2"
val Scala2Compat: N = "Scala2Compat"
val Select: N = "Select"
val Shape: N = "Shape"
Expand Down
13 changes: 2 additions & 11 deletions compiler/src/dotty/tools/dotc/core/TypeOps.scala
Original file line number Diff line number Diff line change
Expand Up @@ -501,12 +501,7 @@ trait TypeOps { this: Context => // TODO: Make standalone object.
!featureEnabled(nme.noAutoTupling)

def scala2CompatMode: Boolean =
featureEnabled(nme.Scala2Compat) || {
val scala2 = featureEnabled(nme.Scala2)
if scala2 then ctx.warning("Use `-language:Scala2Compat` or `import scala.Scala2Compat` instead of `-language:Scala2` or `import scala.Scala2`")
scala2
}

featureEnabled(nme.Scala2Compat)

def dynamicsEnabled: Boolean =
featureEnabled(nme.dynamics)
Expand All @@ -523,11 +518,7 @@ trait TypeOps { this: Context => // TODO: Make standalone object.
* This test is used when we are too early in the pipeline to consider imports.
*/
def scala2CompatSetting: Boolean =
ctx.settings.language.value.contains(nme.Scala2Compat.toString) || {
val scala2 = ctx.settings.language.value.contains(nme.Scala2.toString)
if scala2 then ctx.warning("Use -language:Scala2Compat instead of -language:Scala2")
scala2
}
ctx.settings.language.value.contains(nme.Scala2Compat.toString)

/** Refine child based on parent
*
Expand Down
2 changes: 1 addition & 1 deletion library/src/scalaShadowing/language.scala
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ object language {
}

/** Where imported, a backwards compatibility mode for Scala2 is enabled */
object Scala2
object Scala2Compat

/** Where imported, auto-tupling is disabled */
object noAutoTupling
Expand Down