Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit c1451cf

Browse files
committed
Merge pull request scala#2693 from lexspoon/semmle-lint
Lint-like fixes found by Semmle
2 parents 5f60f27 + b86d29e commit c1451cf

File tree

21 files changed

+90
-29
lines changed

21 files changed

+90
-29
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
build

lib/.gitignore

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
ant-contrib.jar
2+
ant-dotnet-1.0.jar
3+
ant.jar
4+
fjbg.jar
5+
forkjoin.jar
6+
jline.jar
7+
maven-ant-tasks-2.1.1.jar
8+
msil.jar
9+
scala-compiler.jar
10+
scala-compiler-src.jar
11+
scala-library.jar
12+
scala-library-src.jar
13+
scala-reflect.jar
14+
scala-reflect-src.jar
15+
vizant.jar

src/compiler/scala/tools/ant/sabbus/Settings.scala

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,4 +93,18 @@ class Settings {
9393
case _ => false
9494
}
9595

96+
override lazy val hashCode: Int = Seq(
97+
gBf,
98+
uncheckedBf,
99+
classpathBf,
100+
sourcepathBf,
101+
sourcedirBf,
102+
bootclasspathBf,
103+
extdirsBf,
104+
dBf,
105+
encodingBf,
106+
targetBf,
107+
optimiseBf,
108+
extraParamsBf
109+
).##
96110
}

src/compiler/scala/tools/nsc/backend/icode/GenICode.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1748,7 +1748,7 @@ abstract class GenICode extends SubComponent {
17481748

17491749
/////////////////////// Context ////////////////////////////////
17501750

1751-
abstract class Cleanup(val value: AnyRef) {
1751+
sealed abstract class Cleanup(val value: AnyRef) {
17521752
def contains(x: AnyRef) = value == x
17531753
}
17541754
case class MonitorRelease(m: Local) extends Cleanup(m) { }

src/compiler/scala/tools/nsc/backend/icode/Members.scala

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,14 @@ trait Members {
108108
if (symbol eq other.symbol) 0
109109
else if (symbol isLess other.symbol) -1
110110
else 1
111+
112+
override def equals(other: Any): Boolean =
113+
other match {
114+
case other: IMember => (this compare other) == 0
115+
case _ => false
116+
}
117+
118+
override def hashCode = symbol.##
111119
}
112120

113121
/** Represent a class in ICode */

src/compiler/scala/tools/nsc/backend/icode/analysis/CopyPropagation.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ abstract class CopyPropagation {
2727
case object This extends Location
2828

2929
/** Values that can be on the stack. */
30-
abstract class Value { }
30+
sealed abstract class Value { }
3131
case class Record(cls: Symbol, bindings: mutable.Map[Symbol, Value]) extends Value { }
3232
/** The value of some location in memory. */
3333
case class Deref(l: Location) extends Value

src/compiler/scala/tools/nsc/dependencies/Changes.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ abstract class Changes {
1616
import compiler._
1717
import symtab.Flags._
1818

19-
abstract class Change
19+
sealed abstract class Change
2020

2121
private lazy val annotationsChecked =
2222
List(definitions.SpecializedClass) // Any others that should be checked?
@@ -38,7 +38,7 @@ abstract class Changes {
3838
/** An entity in source code, either a class or a member definition.
3939
* Name is fully-qualified.
4040
*/
41-
abstract class Entity
41+
sealed abstract class Entity
4242
case class Class(name: String) extends Entity
4343
case class Definition(name: String) extends Entity
4444

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ package tools.nsc.settings
1111
* Represents a single Scala version in a manner that
1212
* supports easy comparison and sorting.
1313
*/
14-
abstract class ScalaVersion extends Ordered[ScalaVersion] {
14+
sealed abstract class ScalaVersion extends Ordered[ScalaVersion] {
1515
def unparse: String
1616
}
1717

src/compiler/scala/tools/nsc/transform/patmat/MatchTreeMaking.scala

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ trait MatchTreeMaking extends MatchCodeGen with Debugging {
7979
def chainBefore(next: Tree)(casegen: Casegen): Tree
8080
}
8181

82-
trait NoNewBinders extends TreeMaker {
82+
sealed trait NoNewBinders extends TreeMaker {
8383
protected val localSubstitution: Substitution = EmptySubstitution
8484
}
8585

@@ -105,12 +105,12 @@ trait MatchTreeMaking extends MatchCodeGen with Debugging {
105105
override def toString = "S"+ localSubstitution
106106
}
107107

108-
abstract class FunTreeMaker extends TreeMaker {
108+
sealed abstract class FunTreeMaker extends TreeMaker {
109109
val nextBinder: Symbol
110110
def pos = nextBinder.pos
111111
}
112112

113-
abstract class CondTreeMaker extends FunTreeMaker {
113+
sealed abstract class CondTreeMaker extends FunTreeMaker {
114114
val prevBinder: Symbol
115115
val nextBinderTp: Type
116116
val cond: Tree
@@ -126,7 +126,7 @@ trait MatchTreeMaking extends MatchCodeGen with Debugging {
126126
// unless we're optimizing, emit local variable bindings for all subpatterns of extractor/case class patterns
127127
protected val debugInfoEmitVars = !settings.optimise.value
128128

129-
trait PreserveSubPatBinders extends TreeMaker {
129+
sealed trait PreserveSubPatBinders extends TreeMaker {
130130
val subPatBinders: List[Symbol]
131131
val subPatRefs: List[Tree]
132132
val ignoredSubPatBinders: Set[Symbol]

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,13 @@ trait ContextErrors {
2121
import global._
2222
import definitions._
2323

24-
abstract class AbsTypeError extends Throwable {
24+
sealed abstract class AbsTypeError extends Throwable {
2525
def errPos: Position
2626
def errMsg: String
2727
override def toString() = "[Type error at:" + errPos + "] " + errMsg
2828
}
2929

30-
abstract class TreeTypeError extends AbsTypeError {
30+
sealed abstract class TreeTypeError extends AbsTypeError {
3131
def underlyingTree: Tree
3232
def errPos = underlyingTree.pos
3333
}

0 commit comments

Comments
 (0)