summaryrefslogtreecommitdiff
path: root/src/reflect/scala/reflect/internal/Symbols.scala
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2012-11-23 20:10:28 -0800
committerPaul Phillips <paulp@improving.org>2012-11-23 20:12:42 -0800
commitf0e9237834d00ea9e27937e44dc8b8382be32db6 (patch)
tree9807c35aa0bc818bf487a2c93bd577e37e1adce0 /src/reflect/scala/reflect/internal/Symbols.scala
parent889ceade520ae5d2d1485edf2826696fa91a0e91 (diff)
parentfaa6cfcf404b4d172f20b3ed01ba3bd59427b700 (diff)
downloadscala-f0e9237834d00ea9e27937e44dc8b8382be32db6.tar.gz
scala-f0e9237834d00ea9e27937e44dc8b8382be32db6.tar.bz2
scala-f0e9237834d00ea9e27937e44dc8b8382be32db6.zip
Merge branch 'merge-2.10.wip-x' into merge-2.10.x-master
* merge-2.10.wip-x: (24 commits) SI-6023 reify abstract vals Removing controversial `either` method from Futures API. SI-6695 Test case for fixed Array match bug adds comments to standard attachments SI-6673 fixes macro problems with eta expansions Restore the opimization apparently lost after merge. SI-6624 set info of case pattern binder to help find case field accessors Scaladoc update for collection.mutable.MultiMap SI-6663: don't ignore type parameter on selectDynamic invocation SI-6551: don't insert apply call in polymorphic expression. SI-6634 Fixes data corruption issue in ListBuffer#remove Fixes SI-6628, Revert "Fix for view isEmpty." SI-6661 - Remove obsolete implicit parameter of scala.concurrent.promise method Fixes SI-6150 - backport to 2.10.x branch. SI-5330, SI-6014 deal with existential self-type Fixes SI-6559 - StringContext not using passed in escape function. SI-6648 copyAttrs must preserve TypeTree#wasEmpty Fix raw string interpolator: string parts which were after the first argument were still escaped sane printing of renamed imports SI-6440 Address regressions around MissingRequirementError ... Conflicts: src/library/scala/collection/generic/IndexedSeqFactory.scala src/library/scala/collection/mutable/ListBuffer.scala src/reflect/scala/reflect/internal/Symbols.scala src/reflect/scala/reflect/internal/Types.scala test/files/run/t6150.scala
Diffstat (limited to 'src/reflect/scala/reflect/internal/Symbols.scala')
-rw-r--r--src/reflect/scala/reflect/internal/Symbols.scala33
1 files changed, 19 insertions, 14 deletions
diff --git a/src/reflect/scala/reflect/internal/Symbols.scala b/src/reflect/scala/reflect/internal/Symbols.scala
index 032c75f6df..ad7dbe5ef1 100644
--- a/src/reflect/scala/reflect/internal/Symbols.scala
+++ b/src/reflect/scala/reflect/internal/Symbols.scala
@@ -404,9 +404,9 @@ trait Symbols extends api.Symbols { self: SymbolTable =>
* failure to the point when that name is used for something, which is
* often to the point of never.
*/
- def newStubSymbol(name: Name): Symbol = name match {
- case n: TypeName => new StubClassSymbol(this, n)
- case _ => new StubTermSymbol(this, name.toTermName)
+ def newStubSymbol(name: Name, missingMessage: String): Symbol = name match {
+ case n: TypeName => new StubClassSymbol(this, n, missingMessage)
+ case _ => new StubTermSymbol(this, name.toTermName, missingMessage)
}
@deprecated("Use the other signature", "2.10.0")
@@ -1360,6 +1360,9 @@ trait Symbols extends api.Symbols { self: SymbolTable =>
}
}
+ /** Raises a `MissingRequirementError` if this symbol is a `StubSymbol` */
+ def failIfStub() {}
+
/** Initialize the symbol */
final def initialize: this.type = {
if (!isInitialized) info
@@ -3066,14 +3069,20 @@ trait Symbols extends api.Symbols { self: SymbolTable =>
)
}
trait StubSymbol extends Symbol {
- protected def stubWarning = {
- val from = if (associatedFile == null) "" else s" - referenced from ${associatedFile.canonicalPath}"
- s"$kindString $nameString$locationString$from (a classfile may be missing)"
- }
+ devWarning("creating stub symbol to defer error: " + missingMessage)
+
+ protected def missingMessage: String
+
+ /** Fail the stub by throwing a [[scala.reflect.internal.MissingRequirementError]]. */
+ override final def failIfStub() = {MissingRequirementError.signal(missingMessage)} //
+
+ /** Fail the stub by reporting an error to the reporter, setting the IS_ERROR flag
+ * on this symbol, and returning the dummy value `alt`.
+ */
private def fail[T](alt: T): T = {
// Avoid issuing lots of redundant errors
if (!hasFlag(IS_ERROR)) {
- globalError(s"bad symbolic reference to " + stubWarning)
+ globalError(missingMessage)
if (settings.debug.value)
(new Throwable).printStackTrace
@@ -3089,13 +3098,9 @@ trait Symbols extends api.Symbols { self: SymbolTable =>
override def info = fail(NoType)
override def rawInfo = fail(NoType)
override def companionSymbol = fail(NoSymbol)
-
- locally {
- devWarning("creating stub symbol for " + stubWarning)
- }
}
- class StubClassSymbol(owner0: Symbol, name0: TypeName) extends ClassSymbol(owner0, owner0.pos, name0) with StubSymbol
- class StubTermSymbol(owner0: Symbol, name0: TermName) extends TermSymbol(owner0, owner0.pos, name0) with StubSymbol
+ class StubClassSymbol(owner0: Symbol, name0: TypeName, protected val missingMessage: String) extends ClassSymbol(owner0, owner0.pos, name0) with StubSymbol
+ class StubTermSymbol(owner0: Symbol, name0: TermName, protected val missingMessage: String) extends TermSymbol(owner0, owner0.pos, name0) with StubSymbol
trait FreeSymbol extends Symbol {
def origin: String