Skip to content

Commit 5747be5

Browse files
committed
Merge remote-tracking branch 'origin/2.12.x' into topic/pipeline-trace-macro-omnibus-rebase
2 parents 3e500b2 + ce9a857 commit 5747be5

File tree

12 files changed

+99
-65
lines changed

12 files changed

+99
-65
lines changed

README.md

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
# Welcome!
2-
This is the official repository for the [Scala Programming Language](http://www.scala-lang.org).
2+
3+
This is the official repository for the [Scala Programming Language](http://www.scala-lang.org)
4+
standard library, compiler, and language spec.
35

46
# How to contribute
57

6-
To contribute to the Scala standard library, Scala compiler, and Scala Language Specification, please send us a [pull request](https://help.github.com/articles/using-pull-requests/#fork--pull) from your fork of this repository.
8+
To contribute in this repo, please open a [pull request](https://help.github.com/articles/using-pull-requests/#fork--pull) from your fork of this repository.
79

8-
We do have to ask you to sign the [Scala CLA](http://www.lightbend.com/contribute/cla/scala) before we can merge any of your work into our code base, to protect its open source nature.
10+
We do have to ask you to sign the [Scala CLA](http://www.lightbend.com/contribute/cla/scala) before we can merge any of your work, to protect its open source nature.
911

1012
For more information on building and developing the core of Scala, make sure to read
1113
the rest of this README!
@@ -25,17 +27,16 @@ If you need some help with your PR at any time, please feel free to @-mention an
2527
| | username | talk to me about... |
2628
--------------------------------------------------------------------------------------------------|----------------------------------------------------------------|---------------------------------------------------|
2729
<img src="https://avatars.githubusercontent.com/adriaanm" height="50px" title="Adriaan Moors"/> | [`@adriaanm`](https://github.com/adriaanm) | type checker, pattern matcher, infrastructure, language spec |
28-
<img src="https://avatars.githubusercontent.com/SethTisue" height="50px" title="Seth Tisue"/> | [`@SethTisue`](https://github.com/SethTisue) | build, developer docs, community build, Jenkins, library, the welcome-to-Scala experience |
30+
<img src="https://avatars.githubusercontent.com/SethTisue" height="50px" title="Seth Tisue"/> | [`@SethTisue`](https://github.com/SethTisue) | getting started, build, developer docs, community build, Jenkins, library |
2931
<img src="https://avatars.githubusercontent.com/retronym" height="50px" title="Jason Zaugg"/> | [`@retronym`](https://github.com/retronym) | compiler performance, weird compiler bugs, Java 8 lambdas, REPL |
32+
<img src="https://avatars.githubusercontent.com/szeiger" height="50px" title="Stefan Zeiger"/> | [`@szeiger`](https://github.com/szeiger) | collections, build |
33+
<img src="https://avatars.githubusercontent.com/lrytz" height="50px" title="Lukas Rytz"/> | [`@lrytz`](https://github.com/lrytz) | back end, optimizer, named & default arguments |
3034
<img src="https://avatars.githubusercontent.com/Ichoran" height="50px" title="Rex Kerr"/> | [`@Ichoran`](https://github.com/Ichoran) | collections library, performance |
31-
<img src="https://avatars.githubusercontent.com/lrytz" height="50px" title="Lukas Rytz"/> | [`@lrytz`](https://github.com/lrytz) | optimizer, named & default arguments |
32-
<img src="https://avatars.githubusercontent.com/VladUreche" height="50px" title="Vlad Ureche"/> | [`@VladUreche`](https://github.com/VladUreche) | specialization, Scaladoc tool |
33-
<img src="https://avatars.githubusercontent.com/densh" height="50px" title="Denys Shabalin"/> | [`@densh`](https://github.com/densh) | quasiquotes, parser, string interpolators, macros in standard library |
34-
<img src="https://avatars.githubusercontent.com/xeno-by" height="50px" title="Eugene Burmako"/> | [`@xeno-by`](https://github.com/xeno-by) | macros and reflection |
35-
<img src="https://avatars.githubusercontent.com/heathermiller" height="50px" title="Heather Miller"/> | [`@heathermiller`](https://github.com/heathermiller) | documentation |
35+
<img src="https://avatars.githubusercontent.com/viktorklang" height="50px" title="Viktor Klang"/> | [`@viktorklang`](https://github.com/viktorklang) | concurrency, futures |
36+
<img src="https://avatars.githubusercontent.com/axel22" height="50px" title="Aleksandr Prokopec"/> | [`@axel22`](https://github.com/axel22) | concurrency, parallel collections, specialization |
3637
<img src="https://avatars.githubusercontent.com/dragos" height="50px" title="Iulian Dragos"/> | [`@dragos`](https://github.com/dragos) | specialization, back end |
37-
<img src="https://avatars.githubusercontent.com/axel22" height="50px" title="Aleksandr Prokopec"/> | [`@axel22`](https://github.com/axel22) | collections, concurrency, specialization |
3838
<img src="https://avatars.githubusercontent.com/janekdb" height="50px" title="Janek Bogucki"/> | [`@janekdb`](https://github.com/janekdb) | documentation |
39+
<img src="https://avatars.githubusercontent.com/sjrd" height="50px" title="Sébastien Doeraene"/> | [`@sjrd`](https://github.com/sjrd) | interactions with Scala.js |
3940

4041
P.S.: If you have some spare time to help out around here, we would be delighted to add your name to this list!
4142

@@ -50,13 +51,13 @@ scala/
5051
+---/library Scala Standard Library
5152
+---/reflect Scala Reflection
5253
+---/compiler Scala Compiler
53-
+---/eclipse Eclipse project files
5454
+---/intellij IntelliJ project templates
5555
+--spec/ The Scala language specification
5656
+--scripts/ Scripts for the CI jobs (including building releases)
5757
+--test/ The Scala test suite
5858
+---/files Partest tests
5959
+---/junit JUnit tests
60+
+---/scalacheck ScalaCheck tests
6061
+--build/ [Generated] Build output directory
6162
```
6263

@@ -68,10 +69,9 @@ You need the following tools:
6869
- Java SDK. The baseline version is 8 for both 2.12.x and 2.13.x. It may be possible to use a
6970
later SDK for local development, but the CI will verify against the baseline
7071
version.
71-
- sbt. We recommend the [sbt-extras](https://github.com/paulp/sbt-extras) runner
72-
script. It provides sensible default jvm options (stack and heap size).
72+
- sbt (sbt 0.13 on the 2.12.x branch, sbt 1 on the 2.13.x branch)
7373

74-
Mac OS X and Linux work. Windows may work if you use Cygwin. Community help with keeping
74+
MacOS and Linux work. Windows may work if you use Cygwin. Community help with keeping
7575
the build working on Windows is appreciated.
7676

7777
## Tools we use
@@ -87,7 +87,7 @@ We are grateful for the following OSS licenses:
8787

8888
During ordinary development, a new Scala build is built by the
8989
previously released version. For short we call the previous release
90-
"starr": the stable reference Scala release. Building with starr is
90+
"starr": the stable reference release. Building with starr is
9191
sufficient for most kinds of changes.
9292

9393
However, a full build of Scala (a *bootstrap*, as performed by our CI)
@@ -258,14 +258,14 @@ after an LGTM comment is in the [scala/scabot](https://github.com/scala/scabot)
258258

259259
## Community build
260260

261-
The Scala community build is a central element for testing Scala
261+
The Scala community build is an important method for testing Scala
262262
releases. A community build can be launched for any Scala commit, even
263263
before the commit's PR has been merged. That commit is then used to
264264
build a large number of open-source projects from source and run their
265265
test suites.
266266

267267
To request a community build run on your PR, just ask in a comment on
268-
the PR and a Scala team member will take care of
268+
the PR and a Scala team member (probably @SethTisue) will take care of
269269
it. ([details](https://github.com/scala/community-builds/wiki#can-i-run-it-against-a-pull-request-in-scalascala))
270270

271271
Community builds run on the Scala Jenkins instance. The jobs are

src/compiler/scala/tools/nsc/PickleExtractor.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ object PickleExtractor {
107107
true
108108
}).asJava
109109
}
110-
val writer = new ClassWriter(Opcodes.ASM7_EXPERIMENTAL)
110+
val writer = new ClassWriter(Opcodes.ASM7)
111111
val isScalaRaw = foundScalaAttr && !foundScalaSig
112112
if (isScalaRaw) Skip
113113
else {

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

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -73,15 +73,11 @@ abstract class PostProcessor extends PerRunInit {
7373
setInnerClasses(classNode)
7474
serializeClass(classNode)
7575
} catch {
76-
case e: java.lang.RuntimeException if e.getMessage != null && (e.getMessage contains "too large!") =>
77-
backendReporting.error(NoPosition,
78-
s"Could not write class ${internalName} because it exceeds JVM code size limits. ${e.getMessage}")
79-
null
8076
case ex: InterruptedException => throw ex
8177
case ex: Throwable =>
8278
// TODO fail fast rather than continuing to write the rest of the class files?
8379
if (frontendAccess.compilerSettings.debug) ex.printStackTrace()
84-
backendReporting.error(NoPosition, s"Error while emitting ${internalName}\n${ex.getMessage}")
80+
backendReporting.error(NoPosition, s"Error while emitting $internalName\n${ex.getMessage}")
8581
null
8682
}
8783

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

Lines changed: 25 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import java.util
1818

1919
import scala.annotation.switch
2020
import scala.tools.asm.tree.analysis._
21-
import scala.tools.asm.tree.{AbstractInsnNode, LdcInsnNode, MethodInsnNode, MethodNode}
21+
import scala.tools.asm.tree.{AbstractInsnNode, LdcInsnNode, MethodInsnNode, MethodNode, LabelNode}
2222
import scala.tools.asm.{Opcodes, Type}
2323
import scala.tools.nsc.backend.jvm.opt.BytecodeUtils
2424
import scala.tools.nsc.backend.jvm.opt.BytecodeUtils._
@@ -146,15 +146,37 @@ final class NullnessInterpreter(knownNonNullInvocation: MethodInsnNode => Boolea
146146
}
147147

148148
class NullnessFrame(nLocals: Int, nStack: Int) extends AliasingFrame[NullnessValue](nLocals, nStack) {
149+
private[this] var ifNullAliases: AliasSet = null
150+
149151
// Auxiliary constructor required for implementing `NullnessAnalyzer.newFrame`
150152
def this(src: Frame[_ <: NullnessValue]) {
151153
this(src.getLocals, src.getMaxStackSize)
152154
init(src)
153155
}
154156

157+
private def setNullness(s: AliasSet, v: NullnessValue) = {
158+
val it = s.iterator
159+
while (it.hasNext)
160+
this.setValue(it.next(), v)
161+
}
162+
163+
override def initJumpTarget(opcode: Int, target: LabelNode): Unit = {
164+
// when `target` is defined, we're in the case where the branch condition is true
165+
val conditionTrue = target != null
166+
if (opcode == Opcodes.IFNULL)
167+
setNullness(ifNullAliases, if (conditionTrue) NullValue else NotNullValue)
168+
else if (opcode == Opcodes.IFNONNULL)
169+
setNullness(ifNullAliases, if (conditionTrue) NotNullValue else NullValue)
170+
}
171+
155172
override def execute(insn: AbstractInsnNode, interpreter: Interpreter[NullnessValue]): Unit = {
156173
import Opcodes._
157174

175+
ifNullAliases = insn.getOpcode match {
176+
case IFNULL | IFNONNULL => aliasesOf(this.stackTop)
177+
case _ => null
178+
}
179+
158180
// get the alias set the object that is known to be not-null after this operation.
159181
// alias sets are mutable / mutated, so after super.execute, this set contains the remaining
160182
// aliases of the value that becomes not-null.
@@ -203,11 +225,8 @@ class NullnessFrame(nLocals: Int, nStack: Int) extends AliasingFrame[NullnessVal
203225

204226
super.execute(insn, interpreter)
205227

206-
if (nullCheckedAliases != null) {
207-
val it = nullCheckedAliases.iterator
208-
while (it.hasNext)
209-
this.setValue(it.next(), NotNullValue)
210-
}
228+
if (nullCheckedAliases != null)
229+
setNullness(nullCheckedAliases, NotNullValue)
211230
}
212231
}
213232

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -464,16 +464,16 @@ case class ParameterProducer(local: Int)
464464
case class UninitializedLocalProducer(local: Int) extends InitialProducer
465465
case class ExceptionProducer[V <: Value](handlerLabel: LabelNode, handlerStackTop: Int) extends InitialProducer
466466

467-
class InitialProducerSourceInterpreter extends SourceInterpreter(scala.tools.asm.Opcodes.ASM7_EXPERIMENTAL) {
467+
class InitialProducerSourceInterpreter extends SourceInterpreter(scala.tools.asm.Opcodes.ASM7) {
468468
override def newParameterValue(isInstanceMethod: Boolean, local: Int, tp: Type): SourceValue = {
469469
new SourceValue(tp.getSize, ParameterProducer(local))
470470
}
471471

472-
override def newEmptyNonParameterLocalValue(local: Int): SourceValue = {
472+
override def newEmptyValue(local: Int): SourceValue = {
473473
new SourceValue(1, UninitializedLocalProducer(local))
474474
}
475475

476-
override def newExceptionValue(tryCatchBlockNode: TryCatchBlockNode, handlerFrame: Frame[_ <: Value], exceptionType: Type): SourceValue = {
476+
override def newExceptionValue(tryCatchBlockNode: TryCatchBlockNode, handlerFrame: Frame[SourceValue], exceptionType: Type): SourceValue = {
477477
val handlerStackTop = handlerFrame.stackTop + 1 // +1 because this value is about to be pushed onto `handlerFrame`.
478478
new SourceValue(1, ExceptionProducer(tryCatchBlockNode.handler, handlerStackTop))
479479
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ package analysis
1717
import scala.tools.asm.Type
1818
import scala.tools.asm.tree.analysis.{BasicValue, BasicInterpreter}
1919

20-
abstract class TypeFlowInterpreter extends BasicInterpreter(scala.tools.asm.Opcodes.ASM7_EXPERIMENTAL) {
20+
abstract class TypeFlowInterpreter extends BasicInterpreter(scala.tools.asm.Opcodes.ASM7) {
2121
override def newValue(tp: Type) = {
2222
if (tp == null) super.newValue(tp)
2323
else if (isRef(tp)) new BasicValue(tp)

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

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -473,12 +473,16 @@ trait Implicits {
473473
val syms = for (t <- tp; if t.typeSymbol.isTypeParameter) yield t.typeSymbol
474474
deriveTypeWithWildcards(syms.distinct)(tp)
475475
}
476+
@annotation.tailrec def sumComplexity(acc: Int, xs: List[Type]): Int = xs match {
477+
case h :: t => sumComplexity(acc + complexity(h), t)
478+
case _: Nil.type => acc
479+
}
476480
def complexity(tp: Type): Int = tp.dealias match {
477481
case NoPrefix => 0
478482
case SingleType(pre, sym) => if (sym.hasPackageFlag) 0 else complexity(tp.dealiasWiden)
479483
case ThisType(sym) => if (sym.hasPackageFlag) 0 else 1
480-
case TypeRef(pre, sym, args) => complexity(pre) + (args map complexity).sum + 1
481-
case RefinedType(parents, _) => (parents map complexity).sum + 1
484+
case TypeRef(pre, sym, args) => 1 + complexity(pre) + sumComplexity(0, args)
485+
case RefinedType(parents, _) => 1 + sumComplexity(0, parents)
482486
case _ => 1
483487
}
484488
def overlaps(tp1: Type, tp2: Type): Boolean = (tp1, tp2) match {

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -671,6 +671,8 @@ trait Typers extends Adaptations with Tags with TypersTracking with PatternTyper
671671
}
672672
}
673673

674+
@deprecated("Use the overload accepting a Type.", "2.12.9")
675+
def member(qual: Tree, name: Name): Symbol = member(qual.tpe, name)
674676
/** The member with given name of given qualifier type */
675677
def member(qual: Type, name: Name): Symbol = {
676678
def callSiteWithinClass(clazz: Symbol) = context.enclClass.owner hasTransOwner clazz

src/reflect/scala/reflect/internal/tpe/GlbLubs.scala

Lines changed: 37 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -482,30 +482,34 @@ private[internal] trait GlbLubs {
482482
try {
483483
val (ts, tparams) = stripExistentialsAndTypeVars(ts0)
484484
val glbOwner = commonOwner(ts)
485-
def refinedToParents(t: Type): List[Type] = t match {
486-
case RefinedType(ps, _) => ps flatMap refinedToParents
487-
case _ => List(t)
488-
}
489-
def refinedToDecls(t: Type): List[Scope] = t match {
490-
case RefinedType(ps, decls) =>
491-
val dss = ps flatMap refinedToDecls
492-
if (decls.isEmpty) dss else decls :: dss
493-
case _ => List()
485+
val ts1 = {
486+
val res = mutable.ListBuffer.empty[Type]
487+
def loop(ty: Type): Unit = ty match {
488+
case RefinedType(ps, _) => ps.foreach(loop)
489+
case _ => res += ty
490+
}
491+
ts foreach loop
492+
res.toList
494493
}
495-
val ts1 = ts flatMap refinedToParents
496-
val glbBase = intersectionType(ts1, glbOwner)
497494
val glbType =
498-
if (phase.erasedTypes || depth.isZero) glbBase
495+
if (phase.erasedTypes || depth.isZero)
496+
intersectionType(ts1, glbOwner)
499497
else {
500498
val glbRefined = refinedType(ts1, glbOwner)
501499
val glbThisType = glbRefined.typeSymbol.thisType
502500
def glbsym(proto: Symbol): Symbol = {
503501
val prototp = glbThisType.memberInfo(proto)
504-
val syms = for (t <- ts;
505-
alt <- (t.nonPrivateMember(proto.name).alternatives)
506-
if glbThisType.memberInfo(alt) matches prototp
507-
) yield alt
508-
val symtypes = syms map glbThisType.memberInfo
502+
val symtypes: List[Type] = {
503+
val res = mutable.ListBuffer.empty[Type]
504+
ts foreach { t =>
505+
t.nonPrivateMember(proto.name).alternatives foreach { alt =>
506+
val mi = glbThisType.memberInfo(alt)
507+
if (mi matches prototp)
508+
res += mi
509+
}
510+
}
511+
res.toList
512+
}
509513
assert(!symtypes.isEmpty)
510514
proto.cloneSymbol(glbRefined.typeSymbol).setInfoOwnerAdjusted(
511515
if (proto.isTerm) glb(symtypes, depth.decr)
@@ -534,18 +538,25 @@ private[internal] trait GlbLubs {
534538
if (globalGlbDepth < globalGlbLimit)
535539
try {
536540
globalGlbDepth = globalGlbDepth.incr
537-
val dss = ts flatMap refinedToDecls
538-
for (ds <- dss; sym <- ds.iterator)
539-
if (globalGlbDepth < globalGlbLimit && !specializesSym(glbThisType, sym, depth))
540-
try {
541-
addMember(glbThisType, glbRefined, glbsym(sym), depth)
542-
} catch {
543-
case ex: NoCommonType =>
544-
}
541+
def foreachRefinedDecls(ty: Type): Unit = ty match {
542+
case RefinedType(ps, decls) =>
543+
ps foreach foreachRefinedDecls
544+
if (! decls.isEmpty)
545+
decls.iterator.foreach { sym =>
546+
if (globalGlbDepth < globalGlbLimit && !specializesSym(glbThisType, sym, depth))
547+
try {
548+
addMember(glbThisType, glbRefined, glbsym(sym), depth)
549+
} catch {
550+
case ex: NoCommonType =>
551+
}
552+
}
553+
case _ =>
554+
}
555+
ts foreach foreachRefinedDecls
545556
} finally {
546557
globalGlbDepth = globalGlbDepth.decr
547558
}
548-
if (glbRefined.decls.isEmpty) glbBase else glbRefined
559+
if (glbRefined.decls.isEmpty) intersectionType(ts1, glbOwner) else glbRefined
549560
}
550561
existentialAbstraction(tparams, glbType)
551562
} catch {

test/files/run/large_class.check

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
error: Could not write class BigEnoughToFail because it exceeds JVM code size limits. Class file too large!
1+
error: Error while emitting BigEnoughToFail
2+
Class too large: BigEnoughToFail

test/files/run/large_code.check

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
error: Could not write class BigEnoughToFail because it exceeds JVM code size limits. Method tooLong's code too large!
1+
error: Error while emitting BigEnoughToFail
2+
Method too large: BigEnoughToFail.tooLong ()V

versions.properties

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,6 @@ scala.binary.version=2.12
2222
scala-xml.version.number=1.0.6
2323
scala-parser-combinators.version.number=1.0.7
2424
scala-swing.version.number=2.0.3
25-
partest.version.number=1.1.7
26-
scala-asm.version=6.2.0-scala-2
25+
partest.version.number=1.1.9
26+
scala-asm.version=7.0.0-scala-1
2727
jline.version=2.14.6

0 commit comments

Comments
 (0)