summaryrefslogtreecommitdiff
path: root/src/compiler/scala/tools/nsc/typechecker/Contexts.scala
Commit message (Collapse)AuthorAgeFilesLines
...
* Work around weird AbstractMethodErrorAdriaan Moors2014-08-041-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Could not figure it out, so resorting to brain dumping. something with private classes and defaults, the default getter will be in the private companion module, but there's no accessor to get the module??? maybe something related to make non-private of the accessor? while running the repl or, e.g., the test presentation/ide-t1000567 AbstractMethodError: scala.tools.nsc.interactive.Global$$anon$5.scala$tools$nsc$typechecker$Contexts$$BufferingReporter()Lscala/tools/nsc/typechecker/Contexts$BufferingReporter$; at scala.tools.nsc.typechecker.Contexts$Context.makeSilent(Contexts.scala:518) in progress minimal repro: ``` package a class Reporter class Global { lazy val analyzer = new { val global: Global.this.type = Global.this } with Analyzer } trait Analyzer extends AnyRef with Contexts { val global : Global } trait Contexts { self: Analyzer => // the accessor to get to ContextReporter's companion object // to get the default for x is not emitted for some reason // the expected accessor is the non-private version // `def scala$tools$nsc$typechecker$Contexts$$BufferingReporter: scala.tools.nsc.typechecker.Contexts#BufferingReporter$` // (as seen in the AbstractMethodError's message) abstract class ContextReporter(x: Any = null) extends Reporter private class ThrowingReporter extends ContextReporter class Context(a: Any, private[this] var _reporter: ContextReporter = new ThrowingReporter) { def reporter = _reporter } object NoContext extends Context(null) } package b trait ReplGlobal extends a.Global { // this anon class corresponds to scala.tools.nsc.interactive.Global$$anon$5 in the above AbstractMethodError override lazy val analyzer = new { val global: ReplGlobal.this.type = ReplGlobal.this } with a.Analyzer { } } ```
* Cleanup ContextReporter hierarchyAdriaan Moors2014-07-181-94/+84
| | | | | | | | Next step: more principled buffering, make use of the single-entry point reporter. First example simplification in `TryTwice`: No need to store and restore errors -- just use a fresh reporter. Also, control-flow with vars ftw.
* s/reportBuffer/reporterAdriaan Moors2014-07-181-30/+29
|
* Remove dead code: mode settingAdriaan Moors2014-07-181-37/+12
|
* Encapsulate reporting mode as class of reportBuffer.Adriaan Moors2014-07-181-47/+98
| | | | | | | | | | | | Reporting mode used to be governed by contextMode. This logic is left in place by this commit, and the consistency of the new and the old is checked. Will be removed in follow-up commit. The main difference is that we no longer throw TypeErrors in buffering mode. There was one instance of context.error in implicit search the exploited the fact that implicit search runs in buffering (silent) mode and thus calls to error(pos,msg) used to throw new TypeError(pos, msg) -- made this explicit, and removed throwing behavior from the buffering context reporter.
* Clarify that ThrowErrors is the defaultAdriaan Moors2014-07-181-8/+8
|
* Configure `checking` mode in `rootContext`.Adriaan Moors2014-07-171-19/+10
| | | | This is used by the tree checkers.
* Remove `def error(pos: Position, err: Throwable)`Adriaan Moors2014-07-171-5/+0
| | | | The overload was used only once.
* Untangle reporting of ambiguous errors.Adriaan Moors2014-07-171-4/+9
| | | | | | | | | | | | | | | | | | | | | Now that all reporting mode manipulators are private to Context, let's untangle this logic: - every `setReportErrors` gets a corresponding `setAmbiguousErrors(true)` - every `setBufferErrors` gets a corresponding `setAmbiguousErrors(false)` - every `setThrowErrors` gets a corresponding `setAmbiguousErrors(false)` `ambiguousErrors` means that ambiguity errors *must* be reported, even when in silent mode. When it's false, they are *not* reported, but they are buffered when the context reporter is buffering. TODO: this seems a bit dubious, but this is what happens now. Let's see if we can simplify this once the refactoring is complete. Again, the end goal is a strategy-based approach to reporting, where the reporting mode is captured in the reporter being used, with as little mutation as possible to capture more invariants (would like to stop throwing TypeError eventually and only have two reporters: buffering reporter, regular reporter)
* Reduce Context iface: remove dead code.Adriaan Moors2014-07-171-37/+0
|
* Reduce Context iface: make contextMode mutators private.Adriaan Moors2014-07-171-5/+5
| | | | | | This allows local reasoning about these bits, giving some more confidence for the refactoring that's underway.
* Reduce Context iface: inline internally.Adriaan Moors2014-07-171-5/+6
|
* Reduce Context iface: encapsulate buffer manipulation.Adriaan Moors2014-07-171-0/+25
|
* Rely less on intricacies of `contextMode`-based reporting.Adriaan Moors2014-07-171-2/+2
| | | | | | - when warning must not be suppressed, use `reporter.warning` - don't (implicitly) rely on `reporter.warning` being silent after typer --> don't do pure expression check after typer
* Restrict `contextMode` fiddling to `Context`Adriaan Moors2014-07-171-3/+23
| | | | Introduce `initRootContext` to set the relevant bits.
* Encapsulate `TryTwice` as a class, move to `Context`.Adriaan Moors2014-07-171-0/+40
| | | | | All functionality that's closely tied to the error buffer should be in `Context`'s reporting infrastructure. (called `ContextReporter`, soon to follow.)
* Extract the `makeNonSilent` method.Adriaan Moors2014-07-171-0/+6
| | | | Setting the scene of removing the reporting mode bits from `contextMode`.
* Concretize diagnostics: one boolean suffices for now.Adriaan Moors2014-07-171-9/+9
| | | | | | | | | Once we get the next diagnostic, lets encapsulate them in an object, with a boolean flag for each one when it needs to trigger, and a nice message that should be presented to our delighted user. A list of Strings that is searched by contents is a bit fragile, and can't be very fast either.
* Simplify (ambiguous) error issuing.Adriaan Moors2014-07-171-18/+4
| | | | | | | | | | | | | | | | | | | | | | | The two functional differences are: - always add the diagnostics string - check erroneousness in `issueAmbiguousTypeErrorUnlessErroneous`, before even constructing the error message. Consider this nugget: ``` - def issueAmbiguousError(pre: Type, sym1: Symbol, sym2: Symbol, err: AbsTypeError) { - issueCommon(err) { case _ if ambiguousErrors => - if (!pre.isErroneous && !sym1.isErroneous && !sym2.isErroneous) ``` I'd like to state for the record that the if-erroneous in the case of the partial function looked super-dodgy: it meant that, when `ambiguousErrors`, `issueCommon` would not get to the `else` branches that buffer or throw, and if the erroneous condition was met, nothing would be issued/buffered/thrown. This refactoring checks this condition up front.
* Encapsulate deprecation warning message synthesis.Adriaan Moors2014-07-041-0/+2
| | | | | | | Both refchecks and typer constructed the same message. But different. Now with more DRYness. Note that no check files had to be updated (disconcerting)...
* Rip out reporting indirection from CompilationUnitAdriaan Moors2014-07-041-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Inline the forwarders from CompilationUnit, which should not affect behavior. Since all forwarders lead to global.reporter, don't first navigate to a compilation unit, only to then forward back to global.reporter. The cleanup in the previous commits revealed a ton of confusion regarding how to report an error. This was a mechanical search/replace, which has low potential for messing things up, since the list of available methods are disjoint between `reporter` and `currentRun.reporting`. The changes involving `typer.context` were done previously. Essentially, there are three ways to report: - via typer.context, so that reporting can be silenced (buffered) - via global.currentRun.reporting, which summarizes (e.g., deprecation) - via global.reporter, which is (mostly) stateless and straightforward. Ideally, these should all just go through `global.currentRun.reporting`, with the typing context changing that reporter to buffer where necessary. After the refactor, these are the ways in which we report (outside of typer): - reporter.comment - reporter.echo - reporter.error - reporter.warning - currentRun.reporting.deprecationWarning - currentRun.reporting.incompleteHandled - currentRun.reporting.incompleteInputError - currentRun.reporting.inlinerWarning - currentRun.reporting.uncheckedWarning Before: - c.cunit.error - c.enclosingUnit.deprecationWarning - context.unit.error - context.unit.warning - csymCompUnit.warning - cunit.error - cunit.warning - currentClass.cunit.warning - currentIClazz.cunit.inlinerWarning - currentRun.currentUnit.error - currentRun.reporting - currentUnit.deprecationWarning - currentUnit.error - currentUnit.warning - getContext.unit.warning - getCurrentCUnit.error - global.currentUnit.uncheckedWarning - global.currentUnit.warning - global.reporter - icls.cunit.warning - item.cunit.warning - reporter.comment - reporter.echo - reporter.error - reporter.warning - reporting.deprecationWarning - reporting.incompleteHandled - reporting.incompleteInputError - reporting.inlinerWarning - reporting.uncheckedWarning - typer.context.unit.warning - unit.deprecationWarning - unit.echo - unit.error - unit.incompleteHandled - unit.incompleteInputError - unit.uncheckedWarning - unit.warning - v1.cunit.warning All these methods ended up calling a method on `global.reporter` or on `global.currentRun.reporting` (their interfaces are disjoint). Also clean up `TypeDiagnostics`: inline nearly-single-use private methods.
* Route type checker reporting through contextAdriaan Moors2014-07-041-0/+8
| | | | | | | | | | Continue the work started in SI-8450 (no "implicit numeric widening" warning in silent mode), which was caused by going straight to the reporter instead of using the context for type error reporting (which buffers in silent mode). Ideally, this mistake should not be possible: typer should change the current reporter to buffer where appropriate.
* SI-4492 More informative error when class not found on classpathAdriaan Moors2014-03-141-1/+3
| | | | | | | | | | | | Position the error based on Select tree that failed to type check, presumably due to an underlying MissingRequirementError, which has no position. There are lots of other ways we could rewrap a MRE and supplement position info, but that remains TODO. Jason's review comment is recorded in the code. Also try to detect the case of a missing module and provide some advice, as well as linking to the forthcoming 2.11 guide at http://docs.scala-lang.org/overviews/core/scala-2.11.html.
* SI-8403 Fix regression in name binding with imports in templatesJason Zaugg2014-03-131-2/+4
| | | | | | | | | | | | | | Regressed in dbd8457 which changed `Context#make` to automatically include the imports from the given `Tree` if it was an `Import` tree, rather than requiring callers to call `makeNewImport`. However, this turns out to double up the imports for the "inner" namer of a template that starts with imports. The inner namer has a new scope, but the same owner and tree as its parent. This commit detects this case by seeing if the `Import` tree used to consruct the child context is the same as the parent context. If that is the case, we don't augment `Context#imports`.
* SI-8364 fixes cxTree lookup for importsEugene Burmako2014-03-071-0/+7
| | | | | | | | | This is reminiscent of the bug that I recently fixed in paradise: https://github.com/scalamacros/paradise/commit/0dc4e35883d357b7cbcdfd83b5b4821c1dcc0bb1. When doing something non-standard with contexts, we usually have to keep in mind that new contexts are created not only for trees that demarcate blocks of code, but also for imports.
* Merge pull request #3452 from xeno-by/topic/palladium0Jason Zaugg2014-02-191-6/+3
|\ | | | | SI-8063 and its seventy friends
| * SI-6732 deprecates internal#Symbol.isPackageEugene Burmako2014-02-141-1/+1
| | | | | | | | | | | | | | | | This is the first step in disentangling api#Symbol.isPackage, which is supposed to return false for package classes, and internal#Symbol.isPackage, which has traditionally being used as a synonym for hasPackageFlag and hence returned true for package classes (unlike isModule which is false for module classes).
| * disambiguates uses of “local” in internal symbol APIEugene Burmako2014-02-121-5/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There’s been a conflation of two distinct meanings of the word “local” in the internal symbol API: the first meaning being “local to this” (as in has the LOCAL flag set), the second meaning being “local to block” (as in declared in a block, i.e. having owner being a term symbol). Especially confusing is the fact that sym.isLocal isn’t the same as sym.hasFlag(LOCAL), which has led to now fixed SI-6733. This commit fixes the semantic mess by deprecating both Symbol.isLocal and Symbol.hasLocalFlag (that we were forced to use, because Symbol.isLocal had already been taken), and replacing them with Symbol.isLocalToThis and Symbol.isLocalToBlock. Unfortunately, we can’t remove the deprecated methods right away, because they are used in SBT, so I had to take small steps.
* | SI-7707 SI-7712 Exclude unused warnings from -XlintJason Zaugg2014-02-171-2/+2
|/ | | | | | | | | | | | | | | | | | | | | | Experience building open source projects like Specs that use `-Xlint` suggests that this warning is too noisy to lump in with the others. We are lacking in more fine-grained control of these things, so simply turning of `-Xlint` in favour of its underlying `-Y` options ends up *losing* some other important warnings that are predicated directly on `-Xlint`. Furthermore, bug reports against M8, SI-7707 SI-7712, show that unused private/local warnings, while far less noisy, are still in need of polish. This commit moves these warnings to a pair of new -Y options, neither of which is part of `-Xlint`.. Let's ask people to opt in for 2.11, and as it stabilizes, we can consider adding it to Xlint (or the desirable evolution of that) in the next release.
* Merge pull request #3502 from retronym/ticket/8258Grzegorz Kossakowski2014-02-101-0/+2
|\ | | | | Fix regression for using Scala IDE on scala-library
| * SI-8258 Revert "SI-7335 Remove special case for import of Predef._Jason Zaugg2014-02-101-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit 66904556ef34dc81cbb7c09257b013b3ddb76f78. Conflicts: src/reflect/scala/reflect/internal/TreeInfo.scala As evidenced by the highlights of the stack trace in Scala IDE, my assertion in the 66904556e wasn't universally true. The change was only motivated by removing a special case, not in order to fix some other problem. So the revert is the most straight forward course of action for now. I haven't pinned this down with a test outside of Eclipse, and given the lateness of the hour wrt 2.11.0, I'll have to submit without one. 2013-03-10 08:38:04,690 ERROR [main] - org.scala-ide.sdt.core - org.scala-ide.sdt.core - org.scala-ide.sdt.core - 0 - Error during askOption scala.reflect.internal.Symbols$CyclicReference: illegal cyclic reference involving object Predef ... at scala.reflect.internal.Symbols$Symbol.lock(Symbols.scala:482) at scala.reflect.internal.Symbols$Symbol.info(Symbols.scala:1216) at scala.reflect.internal.Symbols$Symbol.tpe(Symbols.scala:1200) at scala.reflect.internal.Symbols$Symbol.tpeHK(Symbols.scala:1201) at scala.reflect.internal.Types$Type.computeMemberType(Types.scala:784) at scala.reflect.internal.Types$Type.memberType(Types.scala:781) at scala.reflect.internal.TreeGen.mkAttributedSelect(TreeGen.scala:203) ... at scala.reflect.internal.TreeGen.mkAttributedStableRef(TreeGen.scala:162) at scala.tools.nsc.ast.TreeGen.mkWildcardImport(TreeGen.scala:39) at scala.tools.nsc.typechecker.Contexts$Context.makeNewImport(Contexts.scala:308) at scala.tools.nsc.typechecker.Contexts$class.rootContext(Contexts.scala:69) at scala.tools.nsc.Global$$anon$1.rootContext(Global.scala:492) at scala.tools.nsc.typechecker.Contexts$class.rootContext(Contexts.scala:64) at scala.tools.nsc.Global$$anon$1.rootContext(Global.scala:492) at scala.tools.nsc.typechecker.Analyzer$namerFactory$$anon$1.apply(Analyzer.scala:43) at scala.tools.nsc.Global$GlobalPhase.applyPhase(Global.scala:463) ... at scala.tools.nsc.Global$Run.compileLate(Global.scala:1681) at scala.tools.nsc.Global$Run.compileLate(Global.scala:1671) at scala.tools.nsc.symtab.SymbolLoaders$SourcefileLoader.doComplete(SymbolLoaders.scala:284) at scala.tools.nsc.symtab.SymbolLoaders$SymbolLoader.complete(SymbolLoaders.scala:187) at scala.reflect.internal.Symbols$Symbol.info(Symbols.scala:1229) at scala.reflect.internal.Symbols$Symbol.tpe(Symbols.scala:1200) at scala.reflect.internal.Symbols$Symbol.tpeHK(Symbols.scala:1201) at scala.reflect.internal.Types$Type.computeMemberType(Types.scala:784) at scala.reflect.internal.Types$Type.memberType(Types.scala:781) at scala.reflect.internal.TreeGen.mkAttributedSelect(TreeGen.scala:203) at scala.reflect.internal.TreeGen.mkAttributedRef(TreeGen.scala:124) at scala.reflect.internal.TreeGen.mkAttributedRef(TreeGen.scala:130) at scala.reflect.internal.TreeGen.mkAttributedStableRef(TreeGen.scala:162) at scala.tools.nsc.ast.TreeGen.mkWildcardImport(TreeGen.scala:39) ... at scala.tools.nsc.Global$$anon$1.rootContext(Global.scala:492) at scala.tools.nsc.typechecker.Analyzer$namerFactory$$anon$1.apply(Analyzer.scala:43) at scala.tools.nsc.Global$GlobalPhase.applyPhase(Global.scala:463) ... at scala.tools.nsc.Global$Run.compileLate(Global.scala:1671) at scala.tools.nsc.symtab.SymbolLoaders$SourcefileLoader.doComplete(SymbolLoaders.scala:284) at scala.tools.nsc.symtab.SymbolLoaders$SymbolLoader.complete(SymbolLoaders.scala:187) at scala.reflect.internal.Symbols$Symbol.info(Symbols.scala:1229) at scala.reflect.internal.Symbols$Symbol.initialize(Symbols.scala:1365) ... at scala.collection.immutable.HashSet$HashSet1.foreach(HashSet.scala:153) at scala.collection.immutable.HashSet$HashTrieSet.foreach(HashSet.scala:306) at scala.tools.eclipse.javaelements.ScalaJavaMapper$class.initializeRequiredSymbols(ScalaJavaMapper.scala:29) ... at scala.tools.nsc.util.InterruptReq.execute(InterruptReq.scala:26) at scala.tools.nsc.interactive.Global.pollForWork(Global.scala:340)
* | SI-8245 Fix regression in interplay between lazy val, returnJason Zaugg2014-02-081-1/+3
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In 4c86dbbc492 / SI-6358, synthesis of lazy val accessors trees was moved into the typer phase (in MethodSynthesis). Before that point, the symobl for the accessor *was* created early, but the tree was not. This led to crashes in intervening phases (extensionmethods) as `changeOwner` calls didn't catch the smuggled symbol. Moving the accessor generation forward, however, brought a problem: we now introduce a DefDef around the RHS of the lazy val, but we're not actually guaranteed that the body has already been typechecked. If it happened to be typechecked for the purposes of return type inference, we'll pick up the typechecked tree from `transformed`: // LazyValGetter#derivedTree val rhs1 = transformed.getOrElse(rhs0, rhs0) But if the method had an explicit return type (which must *always* be the case if it contains a `return`!), `rhs0` will be untyped. This leads to, e.g.: def foo(o: Option[Int]): Int = { lazy val i = o.getOrElse(return -1) i + 1 } def foo(o: Option[Int]): Int = { lazy <artifact> var i$lzy: Int = _; <stable> <accessor> lazy def i: Int = { i$lzy = o.getOrElse(return -1); i$lzy }; i.+(1) }; When this is typechecked, the `return` binds to the closest enclosing `DefDef`, `lazy def i`. This commit changes `Context#enclMethod` to treat `DefDef`s as transparent. `enclMethod` is only used in one other spot that enforces the implementation restriction that "module extending its companion class cannot use default constructor arguments".
* Avoid generic collections operations hot pathsJason Zaugg2014-01-311-1/+1
| | | | | | | | | | | | | | - Use a specialized version of List#{map, collectFirst} These special case mapping over an empty list and avoid allocating. - Avoid nonEmpty in favor of `ne Nil` I see in the order of 2% speedup. Perhaps more useful is that these methods no longer dominate the YourKit profiles, even though profiler bias due to safepoints at allocation of the ListBuffer might have been overstating their significance.
* moves analyzer.ImportType into scala.reflect.internalEugene Burmako2014-01-211-3/+2
| | | | | This cute little type is necessary for importers to work correctly. I wonder how we could overlook its existence for almost 2 years.
* Merge pull request #3214 from retronym/ticket/8024Adriaan Moors2013-12-131-1/+1
|\ | | | | SI-8024 Fix inaccurate message on overloaded ambiguous ident
| * SI-8024 Fix inaccurate message on overloaded ambiguous identJason Zaugg2013-12-121-1/+1
| | | | | | | | | | | | | | | | | | | | `Symbol#owner` of an overloaded symbol doesn't necessarily correspond to the owner of any of the alternatives, and as such it shouldn't be used in error message. neg/t8024.scala actually represents a progression since 2.10.3; the ambiguity was not reported. I bisected the change to https://github.com/scala/scala/pull/1554.
* | SI-6780 Refactor Context#implicitssJason Zaugg2013-12-111-30/+33
| | | | | | | | | | | | | | - split out a method for the part concernted with implicits from the current context - leaving the outer code to handle caching, cycle detection, and recursion up the context chain.
* | SI-6780 Better handling of cycles in in-scope implicit searchJason Zaugg2013-12-111-9/+24
|/ | | | | | | | | | | | | | | | Implicit searches in the body of implicit members with inferred types were leading to cycles. Before we used to resolve that by saying there were no implicits in scope at all; now we just skip the current context and still include the enclosing implicits. Care is taken not to cache results under these circumstances. This entails reworking `Context#implicitss` so that: - the implicit info cache only contains implicits from the current level. The List[List[_]] is now contructed on demand; - we can detect cycles by setting `implicitsCacheRunId` to -1 during the computation. The outer implicits when we encounter that. - we avoid caching when we hit a cycle or when the owner is uninitialized.
* SI-8002 private access for local companionsJason Zaugg2013-11-241-1/+4
| | | | | | We go through similar gymnastics to make companion implicits work for local class/object pairings, so we ought to be consistent when it comes to access
* SI-7895 Issue all buffered errors after silent mode.Jason Zaugg2013-10-091-0/+1
| | | | | | | Rather than just the first. For example, `foo(wizzle, wuzzle, woggle)` should report all three not-found symbols.
* Updating Position call sites.Paul Phillips2013-09-271-1/+1
| | | | | | Calling position factories rather than instantiating these particular classes. Not calling deprecated methods. Added a few position combinator methods.
* SI-6762 rename emptyValDef to noSelfType.Paul Phillips2013-09-271-2/+2
| | | | | Looks like emptyValDef.isEmpty was already changed to return false, so now all that's left is a name which means something.
* Noise reduction + minor enhance in TreeCheckers.Paul Phillips2013-09-091-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | Misc irrelevant work, which I can only offer as-is. It lowers the noise in -Ycheck:* output and performs some common sense chillaxes like not screaming ERROR IN INTERNAL CHECKING! WE'RE ALL GOING TO DIE! when a tree doesn't hit all nine points at the Jiffy Tree. You can see some reasonably well reduced symbol flailing if you run the included pending tests: test/partest --show-diff test/pending/pos/treecheckers Example output, Out of scope symbol reference { tree TypeTree Factory[Traversable] position OffsetPosition test/pending/pos/treecheckers/c5.scala:3 with sym ClassSymbol Factory: Factory[CC] and tpe ClassArgsTypeRef Factory[Traversable] encl(1) ModuleSymbol object Test5 ref to AbstractTypeSymbol X (<deferred> <param>) }
* Logging cleanup.Paul Phillips2013-08-251-1/+1
| | | | | | | | | | | | | | Reduced the amount of extraneous logging noise at the default logging level. Was brought to my usual crashing halt by the discovery of identical logging statements throughout GenASM and elsewhere. I'm supposing the reason people so grossly underestimate the cost of such duplication is that most of the effects are in things which don't happen, aka "silent evidence". An example of a thing which isn't happening is the remainder of this commit, which exists only in parallel universes.
* No longer crash on NoSymbol.owner.Paul Phillips2013-08-191-9/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Historically calling NoSymbol.owner has crashed the compiler. With this commit, NoSymbol owns itself. This is consistent with the way ownership chains are handled elsewhere in the compiler (e.g. NoContext.owner is NoContext, NoSymbol.enclClass is NoSymbol, and so on) and frees every call site which handles symbols from having to perform precondition tests against NoSymbol. Since calling NoSymbol.owner sometimes (not always) indicates a bug which we'd like to catch sooner than later, I have introduced a couple more methods for selected call sites. def owner: Symbol // NoSymbol.owner is self, log if -Xdev def safeOwner: Symbol // NoSymbol.owner is self, ignore def assertOwner: Symbol // NoSymbol.owner is fatal The idea is that everyone can call sym.owner without undue anxiety or paranoid null-like tests. When compiling under -Xdev calls to `owner` are logged with a stack trace, so any call sites for which that is an expected occurrence should call safeOwner instead to communicate the intention and stay out of the log. Conversely, any call site where crashing on the owner call was a desirable behavior can opt into calling assertOwner. This commit also includes all the safeOwner calls necessary to give us a silent log when compiling scala.
* SI-7624 Fix -feature warnings and build with -featureSimon Ochsenreither2013-08-151-0/+1
| | | | | | | | | | | | | | | I added a language.existential import to LazyCombiner.scala which should not be necessary, but causes a spurious warning otherwise: scala/src/library/scala/collection/parallel/mutable/LazyCombiner.scala:33: warning: the existential type scala.collection.parallel.mutable.LazyCombiner[_$1,_$2,_$3] forSome { type _$1; type _$2; type _$3 <: scala.collection.generic.Growable[_$1] with scala.collection.generic.Sizing }, which cannot be expressed by wildcards, should be enabled by making the implicit value scala.language.existentials visible. if (other.isInstanceOf[LazyCombiner[_, _, _]]) { ^ I created ticket SI-7750 to track this issue.
* SI-7690 ghost error message fails compilePaul Phillips2013-08-111-1/+1
| | | | | | I won't even try to explain the error reporting code, because it would have no basis in reality. However this change appears to fix the symptom reported.
* Make -Ytyper-debug output readable.Paul Phillips2013-07-171-5/+5
|
* Spin off src/library/scala/xml to src/xml/scala/xml.Adriaan Moors2013-07-051-15/+6
| | | | | | | | | | | | | | | | | | Summary: - Remove the last vestiges of xml from Predef and Contexts. - Change build to compile scala.xml to scala-xml.jar. - Deploy scala-xml module to maven. - Update partest accordingly. Note: An older compiler cannot use the new standard library to compile projects that use XML. Thus, skipping locker will break the build until we use 2.11.0-M4 for STARR. In the future build process, where we drop locker, we would have to release a milestone that supports the old and the new approach to xml. As soon as we'd be using that new milestone for starr, we could drop support for the old approach.
* Set scene for Predef.$scope's demise.Jason Zaugg2013-06-201-2/+24
| | | | | | | | | | | When there's no Predef.$scope but xml is being used, the compiler aliases scala.xml.TopScope to $scope. There must be a scala.xml package when xml literals were parsed. For compatibility with the old library, which relied on $scope being in scope, synthesize a `import scala.xml.{TopScope => $scope}` when xml is needed, but there's no Predef.$scope and the old library is detected (scala.xml.TopScope exists).