summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/build/pack.xml2
-rw-r--r--src/compiler/scala/tools/nsc/interactive/Global.scala6
-rw-r--r--src/compiler/scala/tools/nsc/transform/Erasure.scala13
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/ContextErrors.scala10
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Typers.scala2
-rw-r--r--src/library/scala/MatchError.scala10
-rw-r--r--src/reflect/scala/reflect/internal/Symbols.scala13
-rw-r--r--src/swing/scala/swing/Publisher.scala2
8 files changed, 47 insertions, 11 deletions
diff --git a/src/build/pack.xml b/src/build/pack.xml
index 20c4034107..8aedd3feb8 100644
--- a/src/build/pack.xml
+++ b/src/build/pack.xml
@@ -56,7 +56,7 @@ MAIN DISTRIBUTION PACKAGING
<target name="pack-devel-docs.tar" depends="pack-archives.zip">
<tar destfile="${dists.dir}/archives/${dist.name}-devel-docs.tar"
compression="none" longfile="gnu">
- <tarfileset dir="${dist.dir}/doc/scala-devel-docs" prefix="${dist.name}-devel-docs"/>
+ <tarfileset dir="${dist.dir}/api" prefix="${dist.name}-devel-docs"/>
</tar>
<gzip src="${dists.dir}/archives/${dist.name}-devel-docs.tar" destfile="${dists.dir}/archives/${dist.name}-devel-docs.tgz"/>
<if>
diff --git a/src/compiler/scala/tools/nsc/interactive/Global.scala b/src/compiler/scala/tools/nsc/interactive/Global.scala
index 531d7ec1e0..d6fa42b1cc 100644
--- a/src/compiler/scala/tools/nsc/interactive/Global.scala
+++ b/src/compiler/scala/tools/nsc/interactive/Global.scala
@@ -955,7 +955,11 @@ class Global(settings: Settings, _reporter: Reporter, projectName: String = "")
val enclosing = new Members[ScopeMember]
def addScopeMember(sym: Symbol, pre: Type, viaImport: Tree) =
locals.add(sym, pre, false) { (s, st) =>
- new ScopeMember(s, st, context.isAccessible(s, pre, false), viaImport)
+ // imported val and var are always marked as inaccessible, but they could be accessed through their getters. SI-7995
+ if (s.hasGetter)
+ new ScopeMember(s, st, context.isAccessible(s.getter, pre, superAccess = false), viaImport)
+ else
+ new ScopeMember(s, st, context.isAccessible(s, pre, superAccess = false), viaImport)
}
def localsToEnclosing() = {
enclosing.addNonShadowed(locals)
diff --git a/src/compiler/scala/tools/nsc/transform/Erasure.scala b/src/compiler/scala/tools/nsc/transform/Erasure.scala
index abd3262c56..df220b7381 100644
--- a/src/compiler/scala/tools/nsc/transform/Erasure.scala
+++ b/src/compiler/scala/tools/nsc/transform/Erasure.scala
@@ -918,11 +918,24 @@ abstract class Erasure extends AddInterfaces
}
val decls = root.info.decls
+
+ // SI-8010 force infos, otherwise makeNotPrivate in ExplicitOuter info transformer can trigger
+ // a scope rehash while were iterating and we can see the same entry twice!
+ // Inspection of SymbolPairs (the basis of OverridingPairs), suggests that it is immune
+ // from this sort of bug as it copies the symbols into a temporary scope *before* any calls to `.info`,
+ // ie, no variant of it calls `info` or `tpe` in `SymbolPair#exclude`.
+ //
+ // Why not just create a temporary scope here? We need to force the name changes in any case before
+ // we do these checks, so that we're comparing same-named methods based on the expanded names that actually
+ // end up in the bytecode.
+ afterPostErasure(decls.foreach(_.info))
+
var e = decls.elems
while (e ne null) {
if (e.sym.isTerm) {
var e1 = decls.lookupNextEntry(e)
while (e1 ne null) {
+ assert(e.sym ne e1.sym, s"Internal error: encountered ${e.sym.debugLocationString} twice during scope traversal. This might be related to SI-8010.")
if (sameTypeAfterErasure(e1.sym, e.sym)) doubleDefError(e.sym, e1.sym)
e1 = decls.lookupNextEntry(e1)
}
diff --git a/src/compiler/scala/tools/nsc/typechecker/ContextErrors.scala b/src/compiler/scala/tools/nsc/typechecker/ContextErrors.scala
index 5d6d094b44..a7b0e47214 100644
--- a/src/compiler/scala/tools/nsc/typechecker/ContextErrors.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/ContextErrors.scala
@@ -1294,7 +1294,7 @@ trait ContextErrors {
private def compatibilityError(message: String) =
implRefError(
- "macro implementation has wrong shape:"+
+ "macro implementation has incompatible shape:"+
"\n required: " + showMeth(rparamss, rret, abbreviate = true) +
"\n found : " + showMeth(aparamss, aret, abbreviate = false) +
"\n" + message)
@@ -1328,7 +1328,11 @@ trait ContextErrors {
def MacroImplOverloadedError() = implRefError("macro implementation cannot be overloaded")
- def MacroImplWrongNumberOfTypeArgumentsError(macroImplRef: Tree) = implRefError(typer.TyperErrorGen.TypedApplyWrongNumberOfTpeParametersErrorMessage(macroImplRef))
+ def MacroImplWrongNumberOfTypeArgumentsError(macroImplRef: Tree) = {
+ val MacroImplReference(owner, meth, targs) = macroImplRef
+ val diagnostic = if (meth.typeParams.length > targs.length) "has too few type arguments" else "has too many arguments"
+ implRefError(s"macro implementation reference $diagnostic for " + treeSymTypeMsg(macroImplRef))
+ }
def MacroImplNotStaticError() = implRefError("macro implementation must be in statically accessible object")
@@ -1336,7 +1340,7 @@ trait ContextErrors {
// aXXX (e.g. aparams) => characteristics of the macro impl ("a" stands for "actual")
// rXXX (e.g. rparams) => characteristics of a reference macro impl signature synthesized from the macro def ("r" stands for "reference")
- def MacroImplNonTagImplicitParameters(params: List[Symbol]) = compatibilityError("macro implementations cannot have implicit parameters other than WeakTypeTag evidences")
+ def MacroImplNonTagImplicitParameters(params: List[Symbol]) = implRefError("macro implementations cannot have implicit parameters other than WeakTypeTag evidences")
def MacroImplParamssMismatchError() = compatibilityError("number of parameter sections differ")
diff --git a/src/compiler/scala/tools/nsc/typechecker/Typers.scala b/src/compiler/scala/tools/nsc/typechecker/Typers.scala
index b80dcefef8..40313bdb5d 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Typers.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Typers.scala
@@ -3826,7 +3826,7 @@ trait Typers extends Modes with Adaptations with Tags {
val normalizeLocals = new TypeMap {
def apply(tp: Type): Type = tp match {
case TypeRef(pre, sym, args) =>
- if (sym.isAliasType && containsLocal(tp)) apply(tp.dealias)
+ if (sym.isAliasType && containsLocal(tp) && (tp.dealias ne tp)) apply(tp.dealias)
else {
if (pre.isVolatile)
InferTypeWithVolatileTypeSelectionError(tree, pre)
diff --git a/src/library/scala/MatchError.scala b/src/library/scala/MatchError.scala
index 6ba7e833d3..9965bb19b5 100644
--- a/src/library/scala/MatchError.scala
+++ b/src/library/scala/MatchError.scala
@@ -23,9 +23,15 @@ final class MatchError(obj: Any) extends RuntimeException {
/** There's no reason we need to call toString eagerly,
* so defer it until getMessage is called.
*/
- private lazy val objString =
+ private lazy val objString = {
+ def ofClass = "of class " + obj.getClass.getName
if (obj == null) "null"
- else obj.toString() + " (of class " + obj.getClass.getName + ")"
+ else try {
+ obj.toString() + " (" + ofClass + ")"
+ } catch {
+ case _: Throwable => "an instance " + ofClass
+ }
+ }
override def getMessage() = objString
}
diff --git a/src/reflect/scala/reflect/internal/Symbols.scala b/src/reflect/scala/reflect/internal/Symbols.scala
index 45c16b7302..579f7684fd 100644
--- a/src/reflect/scala/reflect/internal/Symbols.scala
+++ b/src/reflect/scala/reflect/internal/Symbols.scala
@@ -709,7 +709,9 @@ trait Symbols extends api.Symbols { self: SymbolTable =>
final def isMonomorphicType =
isType && {
val info = originalInfo
- info.isComplete && !info.isHigherKinded
+ ( (info eq null)
+ || (info.isComplete && !info.isHigherKinded)
+ )
}
def isStrictFP = hasAnnotation(ScalaStrictFPAttr) || (enclClass hasAnnotation ScalaStrictFPAttr)
@@ -1282,6 +1284,13 @@ trait Symbols extends api.Symbols { self: SymbolTable =>
def hasRawInfo: Boolean = infos ne null
def hasCompleteInfo = hasRawInfo && rawInfo.isComplete
+ // does not run adaptToNewRun, which is prone to trigger cycles (SI-8029)
+ // TODO: give this a better name if you understand the intent of the caller.
+ // Is it something to do with `reallyExists` or `isStale`?
+ final def rawInfoIsNoType: Boolean = {
+ hasRawInfo && (infos.info eq NoType)
+ }
+
/** Return info without checking for initialization or completing */
def rawInfo: Type = {
var infos = this.infos
@@ -1928,7 +1937,7 @@ trait Symbols extends api.Symbols { self: SymbolTable =>
/** Is this symbol defined in the same scope and compilation unit as `that` symbol? */
def isCoDefinedWith(that: Symbol) = (
- (this.rawInfo ne NoType)
+ !rawInfoIsNoType
&& (this.effectiveOwner == that.effectiveOwner)
&& ( !this.effectiveOwner.isPackageClass
|| (this.sourceFile eq null)
diff --git a/src/swing/scala/swing/Publisher.scala b/src/swing/scala/swing/Publisher.scala
index 96207de808..578ef71e09 100644
--- a/src/swing/scala/swing/Publisher.scala
+++ b/src/swing/scala/swing/Publisher.scala
@@ -44,7 +44,7 @@ trait Publisher extends Reactor {
/**
* Notify all registered reactions.
*/
- def publish(e: Event) { for (l <- listeners) l(e) }
+ def publish(e: Event) { for (l <- listeners) if (l.isDefinedAt(e)) l(e) }
listenTo(this)
}