Skip to content

Commit 060baa4

Browse files
committed
Remove obsolete lint of by-name-right-assoc
1 parent 1b808c3 commit 060baa4

File tree

5 files changed

+10
-48
lines changed

5 files changed

+10
-48
lines changed

src/compiler/scala/tools/nsc/settings/Warnings.scala

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,6 @@ trait Warnings {
9393
val PolyImplicitOverload = LintWarning("poly-implicit-overload", "Parameterized overloaded implicit methods are not visible as view bounds.")
9494
val OptionImplicit = LintWarning("option-implicit", "Option.apply used implicit view.")
9595
val DelayedInitSelect = LintWarning("delayedinit-select", "Selecting member of DelayedInit.")
96-
val ByNameRightAssociative = LintWarning("by-name-right-associative", "By-name parameter of right associative operator.")
9796
val PackageObjectClasses = LintWarning("package-object-classes", "Class or object defined in package object.")
9897
val StarsAlign = LintWarning("stars-align", "Pattern sequence wildcard must align with sequence component.")
9998
val Constant = LintWarning("constant", "Evaluation of a constant arithmetic expression results in an error.")
@@ -116,7 +115,6 @@ trait Warnings {
116115
def warnPolyImplicitOverload = lint contains PolyImplicitOverload
117116
def warnOptionImplicit = lint contains OptionImplicit
118117
def warnDelayedInit = lint contains DelayedInitSelect
119-
def warnByNameRightAssociative = lint contains ByNameRightAssociative
120118
def warnPackageObjectClasses = lint contains PackageObjectClasses
121119
def warnStarsAlign = lint contains StarsAlign
122120
def warnConstant = lint contains Constant

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

Lines changed: 10 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1337,16 +1337,6 @@ abstract class RefChecks extends Transform {
13371337
member.typeParams.map(_.info.bounds.hi.widen) foreach checkAccessibilityOfType
13381338
}
13391339

1340-
private def checkByNameRightAssociativeDef(tree: DefDef): Unit = {
1341-
tree match {
1342-
case DefDef(_, name, _, params :: _, _, _) =>
1343-
if (settings.warnByNameRightAssociative && !nme.isLeftAssoc(name.decodedName) && params.exists(p => isByName(p.symbol)))
1344-
reporter.warning(tree.pos,
1345-
"by-name parameters will be evaluated eagerly when called as a right-associative infix operator. For more details, see scala/bug#1980.")
1346-
case _ =>
1347-
}
1348-
}
1349-
13501340
/** Check that a deprecated val or def does not override a
13511341
* concrete, non-deprecated method. If it does, then
13521342
* deprecation is meaningless.
@@ -1677,20 +1667,16 @@ abstract class RefChecks extends Transform {
16771667
checkAccessibilityOfReferencedTypes(tree)
16781668
}
16791669
tree match {
1680-
case dd: DefDef =>
1681-
checkByNameRightAssociativeDef(dd)
1682-
1683-
if (sym hasAnnotation NativeAttr) {
1684-
if (sym.owner.isTrait) {
1685-
reporter.error(tree.pos, "A trait cannot define a native method.")
1686-
tree
1687-
} else if (dd.rhs == EmptyTree) {
1688-
// pretend it had a stub implementation
1689-
sym resetFlag DEFERRED
1690-
deriveDefDef(dd)(_ => typed(gen.mkThrowNewRuntimeException("native method stub")))
1691-
} else tree
1692-
} else tree
1693-
1670+
case dd: DefDef if sym.hasAnnotation(NativeAttr) =>
1671+
if (sym.owner.isTrait) {
1672+
reporter.error(tree.pos, "A trait cannot define a native method.")
1673+
tree
1674+
} else if (dd.rhs == EmptyTree) {
1675+
// pretend it had a stub implementation
1676+
sym resetFlag DEFERRED
1677+
deriveDefDef(dd)(_ => typed(gen.mkThrowNewRuntimeException("native method stub")))
1678+
} else
1679+
tree
16941680
case _ => tree
16951681
}
16961682

test/files/neg/t1980.check

Lines changed: 0 additions & 12 deletions
This file was deleted.

test/files/neg/t1980.flags

Lines changed: 0 additions & 1 deletion
This file was deleted.

test/files/neg/t1980.scala

Lines changed: 0 additions & 9 deletions
This file was deleted.

0 commit comments

Comments
 (0)