Skip to content

Commit 71a8a44

Browse files
authored
Merge branch '2.12.x' into merge-2.11.x-to-2.12.x-20170214
2 parents 04c45e1 + c8b8005 commit 71a8a44

File tree

89 files changed

+632
-1757
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

89 files changed

+632
-1757
lines changed

bincompat-forward.whitelist.conf

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -407,6 +407,14 @@ filter {
407407
{
408408
matchName="scala.collection.immutable.$colon$colon"
409409
problemName=MissingTypesProblem
410+
},
411+
{
412+
matchName="scala.annotation.showAsInfix$"
413+
problemName=MissingClassProblem
414+
},
415+
{
416+
matchName="scala.annotation.showAsInfix"
417+
problemName=MissingClassProblem
410418
}
411419
]
412420
}

project/PartestUtil.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,6 @@ object PartestUtil {
9090
val ScalacOptsParser = (token("-Dpartest.scalac_opts=") ~ token(NotSpace)) map { case opt ~ v => opt + v }
9191

9292
val P = oneOf(knownUnaryOptions.map(x => token(x))) | SrcPath | TestPathParser | Grep | ScalacOptsParser
93-
(Space ~> repsep(P, oneOrMore(Space))).map(_.mkString(" ")).?.map(_.getOrElse("")) <~ OptSpace
93+
(Space ~> repsep(P, oneOrMore(Space))).map(_.mkString(" ")).?.map(_.getOrElse(""))
9494
}
9595
}

scripts/jobs/integrate/bootstrap

Lines changed: 1 addition & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -178,8 +178,7 @@ sbtResolve() {
178178
'show update' >> $baseDir/logs/resolution 2>&1
179179
}
180180

181-
# Oh boy... can't use scaladoc to document scala-xml/scala-parser-combinators
182-
# if scaladoc depends on the same version of scala-xml/scala-parser-combinators.
181+
# Oh boy... can't use scaladoc to document scala-xml if scaladoc depends on the same version of scala-xml.
183182
# Even if that version is available through the project's resolvers, sbt won't look past this project.
184183
# SOOOOO, we set the version to a dummy (-DOC), generate documentation,
185184
# then set the version to the right one and publish (which won't re-gen the docs).
@@ -216,17 +215,6 @@ buildXML() {
216215
fi
217216
}
218217

219-
buildParsers() {
220-
if [ "$PARSERS_BUILT" != "yes" ] && [ "$forceRebuild" != "yes" ] && ( sbtResolve "org.scala-lang.modules" "scala-parser-combinators" $PARSERS_VER )
221-
then echo "Found scala-parser-combinators $PARSERS_VER; not building."
222-
else
223-
update scala scala-parser-combinators "$PARSERS_REF" && gfxd
224-
doc="$(docTask $PARSERS_BUILT)"
225-
sbtBuild 'set version := "'$PARSERS_VER'-DOC"' $clean "$doc" 'set version := "'$PARSERS_VER'"' test "${buildTasks[@]}"
226-
PARSERS_BUILT="yes"
227-
fi
228-
}
229-
230218
buildPartest() {
231219
if [ "$PARTEST_BUILT" != "yes" ] && [ "$forceRebuild" != "yes" ] && ( sbtResolve "org.scala-lang.modules" "scala-partest" $PARTEST_VER )
232220
then echo "Found scala-partest $PARTEST_VER; not building."
@@ -238,17 +226,6 @@ buildPartest() {
238226
fi
239227
}
240228

241-
buildSwing() {
242-
if [ "$SWING_BUILT" != "yes" ] && [ "$forceRebuild" != "yes" ] && ( sbtResolve "org.scala-lang.modules" "scala-swing" $SWING_VER )
243-
then echo "Found scala-swing $SWING_VER; not building."
244-
else
245-
update scala scala-swing "$SWING_REF" && gfxd
246-
doc="$(docTask $SWING_BUILT)"
247-
sbtBuild 'set version := "'$SWING_VER'"' $clean "$doc" test "${buildTasks[@]}"
248-
SWING_BUILT="yes"
249-
fi
250-
}
251-
252229
# should only be called with publishTasks publishing to private-repo
253230
buildScalaCheck(){
254231
if [ "$SCALACHECK_BUILT" != "yes" ] && [ "$forceRebuild" != "yes" ] && ( sbtResolve "org.scalacheck" "scalacheck" $SCALACHECK_VER )
@@ -266,8 +243,6 @@ buildModules() {
266243
publishTasks=('set credentials += Credentials(Path.userHome / ".credentials-private-repo")' "set every publishTo := Some(\"private-repo\" at \"$releaseTempRepoUrl\")")
267244
buildTasks=($publishPrivateTask)
268245
buildXML
269-
buildParsers
270-
buildSwing
271246
# buildScalaCheck
272247
buildPartest
273248
}
@@ -276,8 +251,6 @@ buildPublishedModules() {
276251
publishTasks=('set credentials += Credentials(Path.userHome / ".credentials-sonatype")' "set pgpPassphrase := Some(Array.empty)")
277252
buildTasks=($publishSonatypeTaskModules)
278253
buildXML
279-
buildParsers
280-
buildSwing
281254
buildPartest
282255
}
283256

@@ -381,36 +354,26 @@ deriveModuleVersions() {
381354
if [ "$moduleVersioning" == "versions.properties" ]; then
382355
# use versions.properties as defaults when no version specified on the command line
383356
XML_VER=${XML_VER-$scala_xml_version_number}
384-
PARSERS_VER=${PARSERS_VER-$scala_parser_combinators_version_number}
385-
SWING_VER=${SWING_VER-$scala_swing_version_number}
386357
PARTEST_VER=${PARTEST_VER-$partest_version_number}
387358
SCALACHECK_VER=${SCALACHECK_VER-$scalacheck_version_number}
388359

389360
XML_REF="v$XML_VER"
390-
PARSERS_REF="v$PARSERS_VER"
391-
SWING_REF="v$SWING_VER"
392361
PARTEST_REF="v$PARTEST_VER"
393362
SCALACHECK_REF="$SCALACHECK_VER" # no `v` in their tags
394363
else
395364
# use HEAD as default when no revision is specified on the command line
396365
XML_REF=${XML_REF-"HEAD"}
397-
PARSERS_REF=${PARSERS_REF-"HEAD"}
398-
SWING_REF=${SWING_REF-"HEAD"}
399366
PARTEST_REF=${PARTEST_REF-"HEAD"}
400367
SCALACHECK_REF=${SCALACHECK_REF-"HEAD"}
401368

402369
XML_VER=$(deriveVersion scala scala-xml "$XML_REF")
403-
PARSERS_VER=$(deriveVersion scala scala-parser-combinators "$PARSERS_REF")
404-
SWING_VER=$(deriveVersion scala scala-swing "$SWING_REF")
405370
PARTEST_VER=$(deriveVersion scala scala-partest "$PARTEST_REF")
406371
SCALACHECK_VER=$(deriveVersionAnyTag rickynils scalacheck "$SCALACHECK_REF")
407372
fi
408373

409374
echo "Module versions (versioning strategy: $moduleVersioning):"
410-
echo "PARSERS = $PARSERS_VER at $PARSERS_REF"
411375
echo "PARTEST = $PARTEST_VER at $PARTEST_REF"
412376
# echo "SCALACHECK = $SCALACHECK_VER at $SCALACHECK_REF"
413-
echo "SWING = $SWING_VER at $SWING_REF"
414377
echo "XML = $XML_VER at $XML_REF"
415378

416379
}
@@ -444,8 +407,6 @@ constructUpdatedModuleVersions() {
444407
# force the new module versions for building the core. these may be different from the values in versions.properties,
445408
# either because the variables (XML_VER) were provided, or because we're building the modules from HEAD.
446409
# in the common case, the values are the same as in versions.properties.
447-
updatedModuleVersions=("${updatedModuleVersions[@]}" "-Dscala-parser-combinators.version.number=$PARSERS_VER")
448-
updatedModuleVersions=("${updatedModuleVersions[@]}" "-Dscala-swing.version.number=$SWING_VER")
449410
updatedModuleVersions=("${updatedModuleVersions[@]}" "-Dscala-xml.version.number=$XML_VER")
450411

451412
updatedModuleVersions=("${updatedModuleVersions[@]}" "-Dpartest.version.number=$PARTEST_VER")

src/compiler/scala/tools/nsc/Global.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1198,7 +1198,7 @@ class Global(var currentSettings: Settings, var reporter: Reporter)
11981198
first
11991199
}
12001200

1201-
// --------------- Miscellania -------------------------------
1201+
// --------------- Miscellanea -------------------------------
12021202

12031203
/** Progress tracking. Measured in "progress units" which are 1 per
12041204
* compilation unit per phase completed.

src/compiler/scala/tools/nsc/PhaseAssembly.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ trait PhaseAssembly {
1717
self: Global =>
1818

1919
/**
20-
* Aux datastructure for solving the constraint system
20+
* Aux data structure for solving the constraint system
2121
* The dependency graph container with helper methods for node and edge creation
2222
*/
2323
private class DependencyGraph {

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1263,8 +1263,8 @@ self =>
12631263
case CHARLIT => in.charVal
12641264
case INTLIT => in.intVal(isNegated).toInt
12651265
case LONGLIT => in.intVal(isNegated)
1266-
case FLOATLIT => in.floatVal(isNegated).toFloat
1267-
case DOUBLELIT => in.floatVal(isNegated)
1266+
case FLOATLIT => in.floatVal(isNegated)
1267+
case DOUBLELIT => in.doubleVal(isNegated)
12681268
case STRINGLIT | STRINGPART => in.strVal.intern()
12691269
case TRUE => true
12701270
case FALSE => false

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

Lines changed: 28 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -983,23 +983,45 @@ trait Scanners extends ScannersCommon {
983983

984984
def intVal: Long = intVal(negated = false)
985985

986-
/** Convert current strVal, base to double value
986+
/** Convert current strVal, base to float value.
987987
*/
988-
def floatVal(negated: Boolean): Double = {
989-
val limit: Double = if (token == DOUBLELIT) Double.MaxValue else Float.MaxValue
988+
def floatVal(negated: Boolean): Float = {
990989
try {
991-
val value: Double = java.lang.Double.valueOf(strVal).doubleValue()
992-
if (value > limit)
990+
val value: Float = java.lang.Float.parseFloat(strVal)
991+
if (value > Float.MaxValue)
993992
syntaxError("floating point number too large")
993+
val zeroly = "0.fF"
994+
if (value == 0.0f && strVal.exists(c => !zeroly.contains(c)))
995+
syntaxError("floating point number too small")
994996
if (negated) -value else value
995997
} catch {
996998
case _: NumberFormatException =>
997999
syntaxError("malformed floating point number")
1000+
0.0f
1001+
}
1002+
}
1003+
1004+
def floatVal: Float = floatVal(negated = false)
1005+
1006+
/** Convert current strVal, base to double value.
1007+
*/
1008+
def doubleVal(negated: Boolean): Double = {
1009+
try {
1010+
val value: Double = java.lang.Double.parseDouble(strVal)
1011+
if (value > Double.MaxValue)
1012+
syntaxError("double precision floating point number too large")
1013+
val zeroly = "0.dD"
1014+
if (value == 0.0d && strVal.exists(c => !zeroly.contains(c)))
1015+
syntaxError("double precision floating point number too small")
1016+
if (negated) -value else value
1017+
} catch {
1018+
case _: NumberFormatException =>
1019+
syntaxError("malformed double precision floating point number")
9981020
0.0
9991021
}
10001022
}
10011023

1002-
def floatVal: Double = floatVal(negated = false)
1024+
def doubleVal: Double = doubleVal(negated = false)
10031025

10041026
def checkNoLetter(): Unit = {
10051027
if (isIdentifierPart(ch) && ch >= ' ')

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ object AsmUtils {
3333
final val traceClassPattern = ""
3434

3535
/**
36-
* Print the bytedcode of classes as they are serialized by the ASM library. The serialization
36+
* Print the bytecode of classes as they are serialized by the ASM library. The serialization
3737
* performed by `asm.ClassWriter` can change the code generated by GenBCode. For example, it
3838
* introduces stack map frames, it computes the maximal stack sizes, and it replaces dead
3939
* code by NOPs (see also https://github.com/scala/scala/pull/3726#issuecomment-42861780).

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -918,7 +918,7 @@ abstract class BCodeBodyBuilder extends BCodeSkelBuilder {
918918
(args zip params) filterNot isTrivial
919919
}
920920

921-
// first push *all* arguments. This makes sure muliple uses of the same labelDef-var will all denote the (previous) value.
921+
// first push *all* arguments. This makes sure multiple uses of the same labelDef-var will all denote the (previous) value.
922922
aps foreach { case (arg, param) => genLoad(arg, locals(param).tk) } // `locals` is known to contain `param` because `genDefDef()` visited `labelDefsAtOrUnder`
923923

924924
// second assign one by one to the LabelDef's variables.

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ abstract class BCodeHelpers extends BCodeIdiomatic with BytecodeWriters {
188188
* Data for emitting an EnclosingMethod attribute. None if `classSym` is a member class (not
189189
* an anonymous or local class). See doc in BTypes.
190190
*
191-
* The class is parametrized by two functions to obtain a bytecode class descriptor for a class
191+
* The class is parameterized by two functions to obtain a bytecode class descriptor for a class
192192
* symbol, and to obtain a method signature descriptor fro a method symbol. These function depend
193193
* on the implementation of GenASM / GenBCode, so they need to be passed in.
194194
*/
@@ -332,7 +332,7 @@ abstract class BCodeHelpers extends BCodeIdiomatic with BytecodeWriters {
332332
failNoForwarder("companion contains its own main method (implementation restriction: no main is allowed, regardless of signature)")
333333
else if (companion.isTrait)
334334
failNoForwarder("companion is a trait")
335-
// Now either succeeed, or issue some additional warnings for things which look like
335+
// Now either succeed, or issue some additional warnings for things which look like
336336
// attempts to be java main methods.
337337
else (possibles exists definitions.isJavaMainMethod) || {
338338
possibles exists { m =>
@@ -541,9 +541,9 @@ abstract class BCodeHelpers extends BCodeIdiomatic with BytecodeWriters {
541541
* symbol (sym.annotations) or type (as an AnnotatedType, eliminated by erasure).
542542
*
543543
* For Scala annotations this is OK: they are stored in the pickle and ignored by the backend.
544-
* Java annoations on the other hand are additionally emitted to the classfile in Java's format.
544+
* Java annotations on the other hand are additionally emitted to the classfile in Java's format.
545545
*
546-
* This means that [[Type]] instances within an AnnotaionInfo reach the backend non-erased. Examples:
546+
* This means that [[Type]] instances within an AnnotationInfo reach the backend non-erased. Examples:
547547
* - @(javax.annotation.Resource @annotation.meta.getter) val x = 0
548548
* Here, annotationInfo.atp is an AnnotatedType.
549549
* - @SomeAnnotation[T] val x = 0

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ abstract class BTypes {
8383
val callsitePositions: concurrent.Map[MethodInsnNode, Position] = recordPerRunCache(TrieMap.empty)
8484

8585
/**
86-
* Stores callsite instructions of invocatinos annotated `f(): @inline/noinline`.
86+
* Stores callsite instructions of invocations annotated `f(): @inline/noinline`.
8787
* Instructions are added during code generation (BCodeBodyBuilder). The maps are then queried
8888
* when building the CallGraph, every Callsite object has an annotated(No)Inline field.
8989
*/
@@ -287,7 +287,7 @@ abstract class BTypes {
287287
}
288288

289289
// The InlineInfo is built from the classfile (not from the symbol) for all classes that are NOT
290-
// being compiled. For those classes, the info is only needed if the inliner is enabled, othewise
290+
// being compiled. For those classes, the info is only needed if the inliner is enabled, otherwise
291291
// we can save the memory.
292292
if (!compilerSettings.optInlinerEnabled) BTypes.EmptyInlineInfo
293293
else fromClassfileAttribute getOrElse fromClassfileWithoutAttribute
@@ -653,7 +653,7 @@ abstract class BTypes {
653653
* Fields in the InnerClass entries:
654654
* - inner class: the (nested) class C we are talking about
655655
* - outer class: the class of which C is a member. Has to be null for non-members, i.e. for
656-
* local and anonymous classes. NOTE: this co-incides with the presence of an
656+
* local and anonymous classes. NOTE: this coincides with the presence of an
657657
* EnclosingMethod attribute (see below)
658658
* - inner name: A string with the simple name of the inner class. Null for anonymous classes.
659659
* - flags: access property flags, details in JVMS, table in 4.7.6. Static flag: see
@@ -702,7 +702,7 @@ abstract class BTypes {
702702
* local and anonymous classes, no matter if there is an enclosing method or not. Accordingly, the
703703
* "class" field (see below) must be always defined, while the "method" field may be null.
704704
*
705-
* NOTE: When an EnclosingMethod attribute is requried (local and anonymous classes), the "outer"
705+
* NOTE: When an EnclosingMethod attribute is required (local and anonymous classes), the "outer"
706706
* field in the InnerClass table must be null.
707707
*
708708
* Fields:
@@ -1144,7 +1144,7 @@ object BTypes {
11441144
/**
11451145
* Metadata about a ClassBType, used by the inliner.
11461146
*
1147-
* More information may be added in the future to enable more elaborate inlinine heuristics.
1147+
* More information may be added in the future to enable more elaborate inline heuristics.
11481148
* Note that this class should contain information that can only be obtained from the ClassSymbol.
11491149
* Information that can be computed from the ClassNode should be added to the call graph instead.
11501150
*

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ trait BytecodeWriters {
7878
}
7979

8080
/*
81-
* The ASM textual representation for bytecode overcomes disadvantages of javap ouput in three areas:
81+
* The ASM textual representation for bytecode overcomes disadvantages of javap output in three areas:
8282
* (a) pickle dingbats undecipherable to the naked eye;
8383
* (b) two constant pools, while having identical contents, are displayed differently due to physical layout.
8484
* (c) stack maps (classfile version 50 and up) are displayed in encoded form by javap,

src/compiler/scala/tools/nsc/backend/jvm/analysis/BackendUtils.scala

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -382,7 +382,8 @@ class BackendUtils[BT <: BTypes](val btypes: BT) {
382382
* but not for writing in the classfile. We let the ClassWriter recompute max's.
383383
*
384384
* NOTE 2: the maxStack value computed here may be larger than the smallest correct value
385-
* that would allow running an analyzer, see `InstructionStackEffect.forAsmAnalysisConservative`.
385+
* that would allow running an analyzer, see `InstructionStackEffect.forAsmAnalysis` and
386+
* `InstructionStackEffect.maxStackGrowth`.
386387
*
387388
* NOTE 3: the implementation doesn't look at instructions that cannot be reached, it computes
388389
* the max local / stack size in the reachable code. These max's work just fine for running an

src/compiler/scala/tools/nsc/backend/jvm/analysis/package.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ package scala.tools.nsc.backend.jvm
110110
* - Use YourKit for finding hotspots (cpu profiling). when it comes to drilling down into the details
111111
* of a hotspot, don't pay too much attention to the percentages / time counts.
112112
* - Should also try other profilers.
113-
* - Use timers. When a method showed up as a hotspot, i added a timer around that method, and a
113+
* - Use timers. When a method showed up as a hotspot, I added a timer around that method, and a
114114
* second one within the method to measure specific parts. The timers slow things down, but the
115115
* relative numbers show what parts of a method are slow.
116116
*

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ class BoxUnbox[BT <: BTypes](val btypes: BT) {
6969
* E1: M1 only works if there's a single boxing operation.
7070
* def e1(b: Boolean) = {
7171
* val i: Integer = box(10) // 10 is stored into a new local, box operation and i removed
72-
* val j: Integer = box(20) // 20 is stored into a new local, box operation adn j removed
72+
* val j: Integer = box(20) // 20 is stored into a new local, box operation and j removed
7373
* val r = if (b) i else j // loads and stores of the box are eliminated, r no longer exists
7474
* unbox(r) // cannot rewrite: we don't know which local to load
7575
* }
@@ -138,7 +138,7 @@ class BoxUnbox[BT <: BTypes](val btypes: BT) {
138138
* - note that the MatchError creation is dead code: local2 is never null. However, our nullness
139139
* analysis cannot identify this: it does not track nullness through tuple stores and loads.
140140
* - if we re-write the non-escaping consumers of the outer tuple, but keep the tuple allocation
141-
* and the escaping consumer, we get the follwoing:
141+
* and the escaping consumer, we get the following:
142142
*
143143
* load 1, load 2
144144
* val newLocal1 = new Tuple2; load newLocal1 // stack: Tuple2
@@ -188,7 +188,7 @@ class BoxUnbox[BT <: BTypes](val btypes: BT) {
188188

189189
var maxStackGrowth = 0
190190

191-
/** Mehtod M1 for eliminating box-unbox pairs (see doc comment in the beginning of this file) */
191+
/** Method M1 for eliminating box-unbox pairs (see doc comment in the beginning of this file) */
192192
def replaceBoxOperationsSingleCreation(creation: BoxCreation, finalCons: Set[BoxConsumer], boxKind: BoxKind, keepBox: Boolean): Unit = {
193193
/**
194194
* If the box is eliminated, all copy operations (loads, stores, others) of the box need to

0 commit comments

Comments
 (0)