10000 Leverage adjustment · scala/scala@77320f3 · GitHub
[go: up one dir, main page]

Skip to content

Commit 77320f3

Browse files
committed
Leverage adjustment
1 parent 9488ccd commit 77320f3

File tree

16 files changed

+42
-52
lines changed

16 files changed

+42
-52
lines changed

src/compiler/scala/tools/nsc/ast/parser/Parsers.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ trait ParsersCommon extends ScannersCommon {
4141
// same time; use Parser.unit instead
4242
import global.{currentUnit => _, _}
4343

44-
def newLiteral(@deprecatedName value: Any) = Literal(Constant(value))
44+
def newLiteral(value: Any) = Literal(Constant(value))
4545
def literalUnit = gen.mkSyntheticUnit()
4646

4747
/** This is now an abstract class, only to work around the optimizer:

src/compiler/scala/tools/nsc/backend/jvm/BCodeHelpers.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ abstract class BCodeHelpers extends BCodeIdiomatic {
267267
* must-single-thread
268268
*/
269269
def apply(sym: Symbol, csymCompUnit: CompilationUnit, mainClass: Option[String]): Boolean = sym.hasModuleFlag && {
270-
val warn = mainClass.fold(ifEmpty = true)(_ == sym.fullNameString)
270+
val warn = mainClass.fold(true)(_ == sym.fullNameString)
271271
def warnBadMain(msg: String, pos: Position): Unit = if (warn) runReporting.warning(pos,
272272
s"""|not a valid main method for ${sym.fullName('.')},
273273
| because $msg.

src/compiler/scala/tools/nsc/backend/jvm/BTypes.scala

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -700,17 +700,15 @@ abstract class BTypes {
700700
})
701701

702702
def isSubtypeOf(other: ClassBType): Either[NoClassBTypeInfo, Boolean] = try {
703-
def True = Right(true)
704-
def False = Right(false)
705-
if (this == other) return True
703+
if (this == other) return Right(true)
706704
if (isInterface.orThrow) {
707-
if (other == ObjectRef) return True // interfaces conform to Object
708-
if (!other.isInterface.orThrow) return False // this is an interface, the other is some class other than object. interfaces cannot extend classes, so the result is false.
705+
if (other == ObjectRef) return Right(true) // interfaces conform to Object
706+
if (!other.isInterface.orThrow) return Right(false) // this is an interface, the other is some class other than object. interfaces cannot extend classes, so the result is false.
709707
// else: this and other are both interfaces. continue to (*)
710708
} else {
711709
val sc = info.orThrow.superClass
712-
if (sc.isDefined && sc.get.isSubtypeOf(other).orThrow) return True // the superclass of this class conforms to other
713-
if (!other.isInterface.orThrow) return False // this and other are both classes, and the superclass of this does not conform
710+
if (sc.isDefined && sc.get.isSubtypeOf(other).orThrow) return Right(true) // the superclass of this class conforms to other
711+
if (!other.isInterface.orThrow) return Right(false) // this and other are both classes, and the superclass of this does not conform
714712
// else: this is a class, the other is an interface. continue to (*)
715713
}
716714

src/compiler/scala/tools/nsc/backend/jvm/opt/LocalOpt.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ abstract class LocalOpt {
211211
* @return `true` if unreachable code was eliminated in some method, `false` otherwise.
212212
*/
213213
def methodOptimizations(clazz: ClassNode): Boolean = {
214-
!compilerSettings.optNone && clazz.methods.asScala.foldLeft(z=false) {
214+
!compilerSettings.optNone && clazz.methods.asScala.foldLeft(false) {
215215
case (changed, method) => methodOptimizations(method, clazz.name) || changed
216216
}
217217
}

src/compiler/scala/tools/nsc/tasty/bridge/TreeOps.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ trait TreeOps { self: TastyUniverse =>
5050

5151
object tpd {
5252

53-
@inline final def Constant(@deprecatedName value: Any): Constant =
53+
@inline final def Constant(value: Any): Constant =
5454
u.Constant(value)
5555

5656
@inline final def Ident(name: TastyName)(tpe: Type): Tree =

src/compiler/scala/tools/nsc/transform/async/TransformUtils.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ private[async] trait TransformUtils extends AsyncTransformStates {
8989

9090
def literalUnit: Tree = Literal(Constant(())).setType(definitions.UnitTpe) // a def to avoid sharing trees
9191
def literalBoxedUnit: Tree = gen.mkAttributedRef(definitions.BoxedUnit_UNIT)
92-
def literalBool(@deprecatedName b: Boolean): Tree = Literal(Constant(b)).setType(definitions.BooleanTpe)
92+
def literalBool[B <: Boolean](b: B): Tree = Literal(Constant(b)).setType(definitions.BooleanTpe)
9393

9494
def isLiteralUnit(t: Tree): Boolean = t match {
9595
case Literal(Constant(())) => true

src/compiler/scala/tools/nsc/typechecker/Contexts.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -928,7 +928,7 @@ trait Contexts { self: Analyzer =>
928928
// don't have access if there is no linked class (so exclude linkedClass=NoSymbol)
929929
def accessWithinLinked(ab: Symbol) = {
930930
val linked = linkedClassOfClassOf(ab, this)
931-
linked.fold(none = false)(accessWithin)
931+
linked.fold(false)(accessWithin)
932932
}
933933

934934
/* Are we inside definition of `ab`? */

src/compiler/scala/tools/nsc/typechecker/RefChecks.scala

Lines changed: 8 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1697,6 +1697,8 @@ abstract class RefChecks extends Transform {
16971697
toConstructor(tree.pos, tree.tpe)
16981698
}
16991699

1700+
private lazy val ArrayApplyBoolean = ArrayModule_apply(BooleanTpe)
1701+
17001702
private def transformApply(tree: Apply): Tree = tree match {
17011703
case Apply(
17021704
Select(qual, nme.withFilter),
@@ -1714,33 +1716,12 @@ abstract class RefChecks extends Transform {
17141716
checkImplicitViewOptionApply(tree.pos, fn, args)
17151717
checkSensible(tree.pos, fn, args) // TODO: this should move to preEraseApply, as reasoning about runtime semantics makes more sense in the JVM type system
17161718
}
1717-
def lintedBoolean = {
1718-
val sym = fn.symbol
1719-
( sym.ne(null)
1720-
&& sym.ne(NoSymbol)
1721-
&& !sym.isJavaDefined
1722-
/*
1723-
&& !sym.isSetter
1724-
&& (
1725-
sym.name match {
1726-
case nme.apply =>
1727-
val companion = sym.owner.companion
1728-
companion != SomeClass && companion != OptionClass && companion != ArrayClass && !isTupleSymbol(companion) && !isFunctionSymbol(sym.owner)
1729-
case nme.getOrElse | nme.orElse => false
1730-
case _ => true
1731-
}
1732-
)
1733-
*/
1734-
)
1735-
}
1736-
def innommable(s: Symbol) = s.deprecatedParamName match {
1737-
case Some(nme.NO_NAME) => true
1738-
case _ => false
1739-
}
1740-
if (settings.lintNamedBooleans && lintedBoolean)
1741-
foreach2(args, fn.symbol.paramss.head)((arg, param) => arg match {
1742-
case t @ Literal(Constant(_: Boolean)) if t.hasAttachment[UnnamedArg.type] && param.tpe.typeSymbol == BooleanClass && !innommable(param) /*&& !isRepeated(param)*/ =>
1743-
runReporting.warning(t.pos, s"Boolean literals should be passed using named argument syntax for parameter ${param.name}.", WarningCategory.LintNamedBooleans, fn.symbol)
1719+
val sym = fn.symbol
1720+
if (settings.lintNamedBooleans && sym.ne(null) && sym.ne(NoSymbol) && !sym.isJavaDefined && sym.ne(ArrayApplyBoolean))
1721+
foreach2(args, sym.paramss.head)((arg, param) => arg match {
1722+
case t @ Literal(Constant(_: Boolean)) if t.hasAttachment[UnnamedArg.type] && param.tpe.typeSymbol == BooleanClass && !param.deprecatedParamName.contains(nme.NO_NAME)
1723+
=>
1724+
runReporting.warning(t.pos, s"Boolean literals should be passed using named argument syntax for parameter ${param.name}.", WarningCategory.LintNamedBooleans, sym)
17441725
case _ =>
17451726
})
17461727
currentApplication = tree

src/library/scala/util/Either.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -459,7 +459,7 @@ sealed abstract class Either[+A, +B] extends Product with Serializable {
459459

460460
/** The left side of the disjoint union, as opposed to the [[scala.util.Right]] side.
461461
*/
462-
final case class Left[+A, +B](@deprecatedName value: A) extends Either[A, B] {
462+
final case class Left[+A, +B](value: A) extends Either[A, B] {
463463
def isLeft = true
464464
def isRight = false
465465

@@ -476,7 +476,7 @@ final case class Left[+A, +B](@deprecatedName value: A) extends Either[A, B] {
476476

477477
/** The right side of the disjoint union, as opposed to the [[scala.util.Left]] side.
478478
*/
479-
final case class Right[+A, +B](@deprecatedName value: B) extends Either[A, B] {
479+
final case class Right[+A, +B](value: B) extends Either[A, B] {
480480
def isLeft = false
481481
def isRight = true
482482

src/library/scala/util/Try.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ object Try {
221221
}
222222
}
223223

224-
final case class Failure[+T](@deprecatedName exception: Throwable) extends Try[T] {
224+
final case class Failure[+T](exception: Throwable) extends Try[T] {
225225
override def isFailure: Boolean = true
226226
override def isSuccess: Boolean = false
227227
override def get: T = throw exception
@@ -256,7 +256,7 @@ final case class Failure[+T](@deprecatedName exception: Throwable) extends Try[T
256256
override def fold[U](fa: Throwable => U, fb: T => U): U = fa(exception)
257257
}
258258

259-
final case class Success[+T](@deprecatedName value: T) extends Try[T] {
259+
final case class Success[+T](value: T) extends Try[T] {
260260
override def isFailure: Boolean = false
261261
override def isSuccess: Boolean = true
262262
override def get = value

0 commit comments

Comments
 (0)
0