Skip to content

Commit 8810e7b

Browse files
committed
Merge pull request scala#1774 from adriaanm/bc-2.9.3
binary compatibility compensation
2 parents 31518ee + a224bb7 commit 8810e7b

File tree

4 files changed

+22
-32
lines changed

4 files changed

+22
-32
lines changed

build.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2131,10 +2131,10 @@ Binary compatibility testing
21312131
<mkdir dir="${bc-build.dir}"/>
21322132
<!-- Pull down MIMA -->
21332133
<artifact:dependencies pathId="mima.classpath">
2134-
<dependency groupId="com.typesafe" artifactId="mima-reporter_2.9.1" version="0.1.3"/>
2134+
<dependency groupId="com.typesafe" artifactId="mima-reporter_2.9.2" version="0.1.4"/>
21352135
</artifact:dependencies>
21362136
<artifact:dependencies pathId="old.bc.classpath">
2137-
<dependency groupId="org.scala-lang" artifactId="scala-library" version="2.9.0"/>
2137+
<dependency groupId="org.scala-lang" artifactId="scala-library" version="2.9.2"/>
21382138
</artifact:dependencies>
21392139
</target>
21402140

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

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ abstract class SuperAccessors extends transform.Transform with transform.TypingT
6565
storeAccessorDefinition(clazz, DefDef(acc, EmptyTree))
6666
acc
6767
}
68-
68+
6969
atPos(sel.pos)(Select(gen.mkAttributedThis(clazz), superAcc) setType sel.tpe)
7070
}
7171

@@ -131,20 +131,20 @@ abstract class SuperAccessors extends transform.Transform with transform.TypingT
131131
// we need an accessor to get to a super on an outer thing, but only if we can't call name more directly on
132132
// a trait implementation class. So this complicated condition is leaving alone cases where we don't need to do
133133
// anything special (i.e. we're getting a direct super class) or where a later transform will inject a call to
134-
// a trait implementation method directly.
134+
// a trait implementation method directly.
135135
//
136-
// SI-6536 has more discussion about how this works.
136+
// SI-6536 has more discussion about how this works.
137137
//
138-
// So, we're looking for items of the form clazz.super[mix].name (or clazz.super.name wich is seen as
138+
// So, we're looking for items of the form clazz.super[mix].name (or clazz.super.name wich is seen as
139139
// clazz.super[EMPTY].name with some limitations. First, name has to be a term rather than a type.
140-
// Then there are a couple of cases.
140+
// Then there are a couple of cases.
141141
def requiresAccessor = name.isTermName && (mix match {
142142
// If mix is empty then we only need an accessor if clazz is a trait, it's not this current class,
143-
// or the validCurentOwner setting is false...which...ugh, is a mess.
144-
case tpnme.EMPTY => clazz.isTrait || clazz != currentClass || !validCurrentOwner
143+
// or the validCurentOwner setting is false...which...ugh, is a mess.
144+
case tpnme.EMPTY => clazz.isTrait || clazz != currentClass || !validCurrentOwner
145145
// If the mix is set then if it refers to a class and the clazz part isn't the current class
146146
// it's not just super[mix].name then we need to generate an accessor.
147-
case _ => clazz != currentClass && !mixTpeIsTrait
147+
case _ => clazz != currentClass && !mixTpeIsTrait
148148
})
149149

150150
if (requiresAccessor) ensureAccessor(sel)
@@ -232,7 +232,7 @@ abstract class SuperAccessors extends transform.Transform with transform.TypingT
232232
parent.info.decls filterNot (x => x.isPrivate || x.hasLocalFlag) foreach { m2 =>
233233
if (sym.name == m2.name && m2.isGetter && m2.accessed.isMutable) {
234234
unit.warning(sel.pos,
235-
sym.accessString + " " + sym.fullLocationString + " shadows mutable " + m2.name
235+
sym.fullLocationString + " shadows mutable " + m2.name
236236
+ " inherited from " + m2.owner + ". Changes to " + m2.name + " will not be visible within "
237237
+ sym.owner + " - you may want to give them distinct names."
238238
)
@@ -263,7 +263,7 @@ abstract class SuperAccessors extends transform.Transform with transform.TypingT
263263
// FIXME - this should be unified with needsProtectedAccessor, but some
264264
// subtlety which presently eludes me is foiling my attempts.
265265
val shouldEnsureAccessor = (
266-
currentClass.isTrait
266+
currentClass.isTrait
267267
&& sym.isProtected
268268
&& sym.enclClass != currentClass
269269
&& !sym.owner.isTrait

src/library/scala/collection/immutable/Stream.scala

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -479,7 +479,7 @@ self =>
479479
final class StreamWithFilter(p: A => Boolean) extends WithFilter(p) {
480480

481481
override def map[B, That](f: A => B)(implicit bf: CanBuildFrom[Stream[A], B, That]): That = {
482-
def tailMap(coll: Stream[A]): Stream[B] = {
482+
def tailMapConstStack(coll: Stream[A]): Stream[B] = {
483483
var head: A = null.asInstanceOf[A]
484484
var tail: Stream[A] = coll
485485
while (true) {
@@ -488,17 +488,17 @@ self =>
488488
head = tail.head
489489
tail = tail.tail
490490
if (p(head))
491-
return cons(f(head), tailMap(tail))
491+
return cons(f(head), tailMapConstStack(tail))
492492
}
493493
throw new RuntimeException()
494494
}
495495

496-
if (isStreamBuilder(bf)) asThat(tailMap(Stream.this))
496+
if (isStreamBuilder(bf)) asThat(tailMapConstStack(Stream.this))
497497
else super.map(f)(bf)
498498
}
499499

500500
override def flatMap[B, That](f: A => GenTraversableOnce[B])(implicit bf: CanBuildFrom[Stream[A], B, That]): That = {
501-
def tailFlatMap(coll: Stream[A]): Stream[B] = {
501+
def tailFlatMapConstStack(coll: Stream[A]): Stream[B] = {
502502
var head: A = null.asInstanceOf[A]
503503
var tail: Stream[A] = coll
504504
while (true) {
@@ -507,12 +507,12 @@ self =>
507507
head = tail.head
508508
tail = tail.tail
509509
if (p(head))
510-
return f(head).toStream append tailFlatMap(tail)
510+
return f(head).toStream append tailFlatMapConstStack(tail)
511511
}
512512
throw new RuntimeException()
513513
}
514514

515-
if (isStreamBuilder(bf)) asThat(tailFlatMap(Stream.this))
515+
if (isStreamBuilder(bf)) asThat(tailFlatMapConstStack(Stream.this))
516516
else super.flatMap(f)(bf)
517517
}
518518

@@ -522,6 +522,10 @@ self =>
522522

523523
override def withFilter(q: A => Boolean): StreamWithFilter =
524524
new StreamWithFilter(x => p(x) && q(x))
525+
526+
// DO NOT USE -- for binary compatibility
527+
def tailMap$1(f: Nothing => Nothing): Stream[Nothing] = null
528+
def tailFlatMap$1(f: Nothing => Nothing): Stream[Nothing] = null
525529
}
526530

527531
/** A lazier Iterator than LinearSeqLike's. */

src/library/scala/reflect/generic/HasFlags.scala

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -183,20 +183,6 @@ import Flags._
183183
def hasTraitFlag = hasFlag(TRAIT)
184184
def hasDefaultFlag = hasFlag(DEFAULTPARAM)
185185

186-
def accessString: String = {
187-
val pw = if (hasAccessBoundary) privateWithin.toString else ""
188-
189-
if (pw == "") {
190-
if (hasAllFlags(PRIVATE | LOCAL)) "private[this]"
191-
else if (hasAllFlags(PROTECTED | LOCAL)) "protected[this]"
192-
else if (hasFlag(PRIVATE)) "private"
193-
else if (hasFlag(PROTECTED)) "protected"
194-
else ""
195-
}
196-
else if (hasFlag(PROTECTED)) "protected[" + pw + "]"
197-
else "private[" + pw + "]"
198-
}
199-
200186
// Straightforwardly named accessors already being used differently.
201187
// These names are most likely temporary.
202188
def hasAbstractFlag = hasFlag(ABSTRACT)

0 commit comments

Comments
 (0)