Skip to content

Commit 7943084

Browse files
committed
SI-7624 Fix -feature warnings and build with -feature
I added a language.existential import to LazyCombiner.scala which should not be necessary, but causes a spurious warning otherwise: scala/src/library/scala/collection/parallel/mutable/LazyCombiner.scala:33: warning: the existential type scala.collection.parallel.mutable.LazyCombiner[_$1,_$2,_$3] forSome { type _$1; type _$2; type _$3 <: scala.collection.generic.Growable[_$1] with scala.collection.generic.Sizing }, which cannot be expressed by wildcards, should be enabled by making the implicit value scala.language.existentials visible. if (other.isInstanceOf[LazyCombiner[_, _, _]]) { ^ I created ticket SI-7750 to track this issue.
1 parent f17fb5e commit 7943084

File tree

10 files changed

+24
-20
lines changed

10 files changed

+24
-20
lines changed

build.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -395,7 +395,7 @@ TODO:
395395
<property name="scalac.args" value=""/>
396396
<property name="javac.args" value=""/>
397397

398-
<property name="scalac.args.always" value="" />
398+
<property name="scalac.args.always" value="-feature" />
399399
<property name="scalac.args.optimise" value=""/> <!-- scalac.args.optimise is selectively overridden in certain antcall tasks. -->
400400
<property name="scalac.args.all" value="${scalac.args.always} ${scalac.args} ${scalac.args.optimise}"/>
401401
<property name="scalac.args.locker" value="${scalac.args.all}"/>

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1340,6 +1340,7 @@ trait Contexts { self: Analyzer =>
13401340
}
13411341

13421342
object ContextMode {
1343+
import scala.language.implicitConversions
13431344
private implicit def liftIntBitsToContextState(bits: Int): ContextMode = apply(bits)
13441345
def apply(bits: Int): ContextMode = new ContextMode(bits)
13451346
final val NOmode: ContextMode = 0

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -700,7 +700,7 @@ trait Infer extends Checkable {
700700
tp nonPrivateMember nme.apply match {
701701
case NoSymbol => tp
702702
case sym if !sym.isOverloaded && sym.isPublic => OverloadedType(tp, sym.alternatives)
703-
case sym => OverloadedType(tp, sym filter (_.isPublic) alternatives)
703+
case sym => OverloadedType(tp, sym.filter(_.isPublic).alternatives)
704704
}
705705
}
706706

src/library/scala/collection/parallel/mutable/LazyCombiner.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ trait LazyCombiner[Elem, +To, Buff <: Growable[Elem] with Sizing] extends Combin
3030
def result: To = allocateAndCopy
3131
def clear() = { chain.clear() }
3232
def combine[N <: Elem, NewTo >: To](other: Combiner[N, NewTo]): Combiner[N, NewTo] = if (this ne other) {
33+
import language.existentials // FIXME: See SI-7750
3334
if (other.isInstanceOf[LazyCombiner[_, _, _]]) {
3435
val that = other.asInstanceOf[LazyCombiner[Elem, To, Buff]]
3536
newLazyCombiner(chain ++= that.chain)

src/reflect/scala/reflect/internal/Kinds.scala

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ trait Kinds {
233233

234234
/**
235235
* The data structure describing the kind of a given type.
236-
*
236+
*
237237
* Proper types are represented using ProperTypeKind.
238238
*
239239
* Type constructors are reprented using TypeConKind.
@@ -251,7 +251,7 @@ trait Kinds {
251251
* it uses prescribed letters for each level: A, F, X, Y, Z.
252252
*/
253253
def scalaNotation: String
254-
254+
255255
/** Kind notation used in http://adriaanm.github.com/files/higher.pdf.
256256
* Proper types are expressed as *.
257257
* Type constructors are expressed * -> *(lo, hi) -(+)-> *.
@@ -261,13 +261,13 @@ trait Kinds {
261261
/** Contains bounds either as part of itself or its arguments.
262262
*/
263263
def hasBounds: Boolean = !bounds.isEmptyBounds
264-
264+
265265
private[internal] def buildState(sym: Symbol, v: Variance)(s: StringState): StringState
266266
}
267267
object Kind {
268268
private[internal] sealed trait ScalaNotation
269269
private[internal] sealed case class Head(order: Int, n: Option[Int], alias: Option[String]) extends ScalaNotation {
270-
override def toString: String = {
270+
override def toString: String = {
271271
alias getOrElse {
272272
typeAlias(order) + n.map(_.toString).getOrElse("")
273273
}
@@ -285,7 +285,7 @@ trait Kinds {
285285
}
286286
private[internal] sealed case class Text(value: String) extends ScalaNotation {
287287
override def toString: String = value
288-
}
288+
}
289289
private[internal] case class StringState(tokens: Seq[ScalaNotation]) {
290290
override def toString: String = tokens.mkString
291291
def append(value: String): StringState = StringState(tokens :+ Text(value))
@@ -310,7 +310,7 @@ trait Kinds {
310310
ts map {
311311
case Head(`o`, _, a) => Head(o, None, a)
312312
case t => t
313-
}
313+
}
314314
else ts
315315
})
316316
}
@@ -332,7 +332,7 @@ trait Kinds {
332332
val order = 0
333333
private[internal] def buildState(sym: Symbol, v: Variance)(s: StringState): StringState = {
334334
s.append(v.symbolicString).appendHead(order, sym).append(bounds.scalaNotation(_.toString))
335-
}
335+
}
336336
def scalaNotation: String = Kind.Head(order, None, None) + bounds.scalaNotation(_.toString)
337337
def starNotation: String = "*" + bounds.starNotation(_.toString)
338338
}
@@ -344,7 +344,7 @@ trait Kinds {
344344

345345
class TypeConKind(val bounds: TypeBounds, val args: Seq[TypeConKind.Argument]) extends Kind {
346346
import Kind.StringState
347-
val order = (args map {_.kind.order} max) + 1
347+
val order = (args map (_.kind.order)).max + 1
348348
def description: String =
349349
if (order == 1) "This is a type constructor: a 1st-order-kinded type."
350350
else "This is a type constructor that takes type constructor(s): a higher-kinded type."
@@ -389,7 +389,7 @@ trait Kinds {
389389
*/
390390
object inferKind {
391391
import TypeConKind.Argument
392-
392+
393393
abstract class InferKind {
394394
protected def infer(tpe: Type, owner: Symbol, topLevel: Boolean): Kind
395395
protected def infer(sym: Symbol, topLevel: Boolean): Kind = infer(sym.tpeHK, sym.owner, topLevel)
@@ -398,7 +398,7 @@ trait Kinds {
398398
}
399399

400400
def apply(pre: Type): InferKind = new InferKind {
401-
protected def infer(tpe: Type, owner: Symbol, topLevel: Boolean): Kind = {
401+
protected def infer(tpe: Type, owner: Symbol, topLevel: Boolean): Kind = {
402402
val bounds = if (topLevel) TypeBounds.empty
403403
else tpe.asSeenFrom(pre, owner).bounds
404404
if(!tpe.isHigherKinded) ProperTypeKind(bounds)

src/reflect/scala/reflect/internal/transform/Erasure.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ trait Erasure {
6060
*/
6161
protected def unboundedGenericArrayLevel(tp: Type): Int = tp match {
6262
case GenericArray(level, core) if !(core <:< AnyRefTpe) => level
63-
case RefinedType(ps, _) if ps.nonEmpty => logResult(s"Unbounded generic level for $tp is")(ps map unboundedGenericArrayLevel max)
63+
case RefinedType(ps, _) if ps.nonEmpty => logResult(s"Unbounded generic level for $tp is")((ps map unboundedGenericArrayLevel).max)
6464
case _ => 0
6565
}
6666

src/reflect/scala/reflect/internal/util/ScalaClassLoader.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ trait ScalaClassLoader extends JClassLoader {
4444

4545
/** Create an instance of a class with this classloader */
4646
def create(path: String): AnyRef =
47-
tryToInitializeClass[AnyRef](path) map (_.newInstance()) orNull
47+
tryToInitializeClass[AnyRef](path).map(_.newInstance()).orNull
4848

4949
/** The actual bytes for a class file, or an empty array if it can't be found. */
5050
def classBytes(className: String): Array[Byte] = classAsStream(className) match {
@@ -116,7 +116,7 @@ object ScalaClassLoader {
116116

117117
/** True if supplied class exists in supplied path */
118118
def classExists(urls: Seq[URL], name: String): Boolean =
119-
fromURLs(urls) tryToLoadClass name isDefined
119+
(fromURLs(urls) tryToLoadClass name).isDefined
120120

121121
/** Finding what jar a clazz or instance came from */
122122
def originOfClass(x: Class[_]): Option[URL] =

src/reflect/scala/reflect/internal/util/TriState.scala

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ package reflect
33
package internal
44
package util
55

6+
import scala.language.implicitConversions
7+
68
import TriState._
79

810
/** A simple true/false/unknown value, for those days when

src/scaladoc/scala/tools/nsc/doc/model/ModelFactory.scala

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -305,10 +305,9 @@ class ModelFactory(val global: Global, val settings: doc.Settings) {
305305
else None
306306
}
307307

308+
private def templateAndType(ancestor: Symbol): (TemplateImpl, TypeEntity) = (makeTemplate(ancestor), makeType(reprSymbol.info.baseType(ancestor), this))
308309
lazy val (linearizationTemplates, linearizationTypes) =
309-
reprSymbol.ancestors map { ancestor =>
310-
(makeTemplate(ancestor), makeType(reprSymbol.info.baseType(ancestor), this))
311-
} unzip
310+
(reprSymbol.ancestors map templateAndType).unzip
312311

313312
/* Subclass cache */
314313
private lazy val subClassesCache = (
@@ -321,7 +320,7 @@ class ModelFactory(val global: Global, val settings: doc.Settings) {
321320
}
322321
def directSubClasses = if (subClassesCache == null) Nil else subClassesCache.toList
323322

324-
/* Implcitly convertible class cache */
323+
/* Implicitly convertible class cache */
325324
private var implicitlyConvertibleClassesCache: mutable.ListBuffer[(DocTemplateImpl, ImplicitConversionImpl)] = null
326325
def registerImplicitlyConvertibleClass(dtpl: DocTemplateImpl, conv: ImplicitConversionImpl): Unit = {
327326
if (implicitlyConvertibleClassesCache == null)
@@ -841,7 +840,7 @@ class ModelFactory(val global: Global, val settings: doc.Settings) {
841840
def value = tree
842841
}
843842
}
844-
case None =>
843+
case None =>
845844
argTrees map { tree =>
846845
new ValueArgument {
847846
def parameter = None

src/xml/scala/xml/Elem.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ object Elem {
3737
}
3838

3939
import scala.sys.process._
40+
import scala.language.implicitConversions
4041
/** Implicitly convert a [[scala.xml.Elem]] into a
4142
* [[scala.sys.process.ProcessBuilder]]. This is done by obtaining the text
4243
* elements of the element, trimming spaces, and then converting the result

0 commit comments

Comments
 (0)