summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* check added instruction to ASM MethodNodeMiguel Garcia2013-04-251-0/+8
|
* Merge pull request #2393 from retronym/ticket/7345-2Paul Phillips2013-04-2414-358/+616
|\ | | | | SI-7345 Refactoring Contexts
| * Merge remote-tracking branch 'origin/master' into ticket/7345-2Jason Zaugg2013-04-2169-439/+813
| |\ | | | | | | | | | | | | | | | Conflicts: src/compiler/scala/tools/nsc/typechecker/Contexts.scala src/compiler/scala/tools/nsc/typechecker/Typers.scala
| * | SI-7345 Address review comments.Jason Zaugg2013-04-211-9/+8
| | |
| * | SI-7345 Improved Context.toStringJason Zaugg2013-04-211-4/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ticket/7345-2 ~/code/scala qbin/scala Welcome to Scala version 2.11.0-20130416-231609-7829011884 (Java HotSpot(TM) 64-Bit Server VM, Java 1.6.0_37). Type in expressions to have them evaluated. Type :help for more information. scala> import language.experimental._import language.experimental._ scala> import reflect.macros.Contextimport reflect.macros.Context scala> def showContextImpl(c: Context) = {println(c.asInstanceOf[reflect.macros.runtime.Context].callsiteTyper.context.enclosingContextChain.mkString("\n\n")); c.literalUnit} showContextImpl: (c: scala.reflect.macros.Context)c.Expr[Unit] scala> def showContext = macro showContextImpldefined term macro showContext: Unit scala> object Foo { def foo(a: Any) { {class C { println("") }; showContext } } }Context(<console>) { owner = method foo tree = Block:{ class C extends scala.AnyRef { def <init>(): C = { super.<init>(); ( scope = 1 decls contextMode = AmbiguousErrors ImplicitsEnabled MacrosEnabled ReportErrors outer.owner = method foo } Context(<console>) { owner = method foo tree = DefDef:def foo(a: Any): Unit = { class C extends scala.AnyRef { def <init>(): scope = 1 decls contextMode = AmbiguousErrors ImplicitsEnabled MacrosEnabled ReportErrors outer.owner = object Foo } Context(<console>) { owner = object Foo tree = Template(scala.AnyRef, _, 2 stats) scope = 0 decls contextMode = AmbiguousErrors ImplicitsEnabled MacrosEnabled ReportErrors outer.owner = object Foo } Context(<console>) { owner = object Foo tree = ModuleDef:object Foo extends scala.AnyRef { def <init>(): Foo.type = { super.<in scope = 0 decls contextMode = AmbiguousErrors ImplicitsEnabled MacrosEnabled ReportErrors outer.owner = object $iw } Context(<console>) { owner = object $iw tree = Template(scala.AnyRef, _, 2 stats) scope = 0 decls contextMode = AmbiguousErrors ImplicitsEnabled MacrosEnabled ReportErrors outer.owner = object $iw } Context(<console>) { owner = object $iw tree = ModuleDef:object $iw extends scala.AnyRef { def <init>(): type = { super.<init>( scope = 0 decls contextMode = AmbiguousErrors ImplicitsEnabled MacrosEnabled ReportErrors outer.owner = object $iw } ImportContext { import $line18.$read.$iw.$iw.$iw.$iw.showContext; outer.owner = object $iw } ImportContext { import $line17.$read.$iw.$iw.$iw.$iw.showContextImpl; outer.owner = object $iw } ImportContext { import reflect.macros.Context; outer.owner = object $iw } Context(<console>) { owner = object $iw tree = Template(scala.AnyRef, _, 5 stats) scope = 0 decls contextMode = AmbiguousErrors ImplicitsEnabled MacrosEnabled ReportErrors outer.owner = object $iw } Context(<console>) { owner = object $iw tree = ModuleDef:object $iw extends scala.AnyRef { def <init>(): type = { super.<init>( scope = 0 decls contextMode = AmbiguousErrors ImplicitsEnabled MacrosEnabled ReportErrors outer.owner = object $iw } ImportContext { import language.experimental._; outer.owner = object $iw } Context(<console>) { owner = object $iw tree = Template(scala.AnyRef, _, 3 stats) scope = 0 decls contextMode = AmbiguousErrors ImplicitsEnabled MacrosEnabled ReportErrors outer.owner = object $iw } Context(<console>) { owner = object $iw tree = ModuleDef:object $iw extends scala.AnyRef { def <init>(): type = { super.<init>( scope = 0 decls contextMode = AmbiguousErrors ImplicitsEnabled MacrosEnabled ReportErrors outer.owner = object $iw } Context(<console>) { owner = object $iw tree = Template(scala.AnyRef, _, 2 stats) scope = 0 decls contextMode = AmbiguousErrors ImplicitsEnabled MacrosEnabled ReportErrors outer.owner = object $iw } Context(<console>) { owner = object $iw tree = ModuleDef:object $iw extends scala.AnyRef { def <init>(): type = { super.<init>( scope = 0 decls contextMode = AmbiguousErrors ImplicitsEnabled MacrosEnabled ReportErrors outer.owner = object $read } Context(<console>) { owner = object $read tree = Template(scala.AnyRef, _, 2 stats) scope = 0 decls contextMode = AmbiguousErrors ImplicitsEnabled MacrosEnabled ReportErrors outer.owner = object $read } Context(<console>) { owner = object $read tree = ModuleDef:object $read extends scala.AnyRef { def <init>(): $line19.$read.type = scope = 1 decls contextMode = AmbiguousErrors ImplicitsEnabled MacrosEnabled ReportErrors outer.owner = package $line19 } Context(<console>) { owner = package $line19 tree = PackageDef:package $line19 { object $read extends scala.AnyRef { def <init>(): $l scope = 1 decls contextMode = AmbiguousErrors ImplicitsEnabled MacrosEnabled ReportErrors outer.owner = package <root> } Context(<console>) { owner = package <root> tree = EmptyTree:<empty> scope = 50 decls contextMode = AmbiguousErrors ImplicitsEnabled MacrosEnabled ReportErrors outer.owner = package <root> } ImportContext { import scala.this.Predef._; outer.owner = package <root> } ImportContext { import scala._; outer.owner = package <root> } ImportContext { import java.this.lang._; outer.owner = package <root> } Context(NoCompilationUnit) { owner = package <root> tree = Template(Nil, _, 0 stats) scope = 50 decls contextMode = MacrosEnabled outer.owner = <none> } defined object Foo
| * | SI-7345 Eliminate the `depth` var.Jason Zaugg2013-04-211-20/+30
| | | | | | | | | | | | | | | | | | | | | | | | In favour of a val calculated during construction. Internalizes the depth calculation into the Context constructor rather than leaving it in the hands of the factory method `make`. Also touched a few unrelated doc comments.
| * | SI-7345 Drive by refactoring of pattern matching for `arg: _*`.Jason Zaugg2013-04-215-12/+22
| | |
| * | SI-7345 Factor out method to clear and restore undetparams.Jason Zaugg2013-04-213-36/+35
| | | | | | | | | | | | Also refactored `handleOverloaded` to avoid use of a mutable Buffer
| * | SI-7345 Remove unneeded warning.Jason Zaugg2013-04-211-7/+1
| | | | | | | | | | | | | | | According to Hubert, during normal operation we can start buffering errors in a context with existing errors. So the warning would be noisy.
| * | SI-7345 Doc and TODO comments around Context.Jason Zaugg2013-04-212-1/+45
| | |
| * | SI-7345 Produce Context#imports from the context chainJason Zaugg2013-04-213-37/+55
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Rather than keeping a List[ImportInfo] around as a field. This sort of change reduces our bug exposure by structurally enforcing the invariant that `Context#imports` must mirror the `outer` chain. This entails changing a few elements of Contexts from mutable vars to constructor pararameters, which seems desirable anyway. We no longer need `makeNewImport`, as `make` now inspects the provided tree and determines does import specific things (tracking of used imports / mixin of ImportContext) when appropriate. The only wrinkle in this commit is the unfortunate need to pass `owner = null` in the extends clause of NoContext. I don't see cleaner way around this. Applied minor rework to `implicitss` to avoid needlessly re-evaluating `imports` and `nextOuter`.
| * | SI-7345 Refactor manual iteration to use foreach.Jason Zaugg2013-04-211-4/+2
| | |
| * | SI-7345 Move `inSilentMode` from Infer to Context.Jason Zaugg2013-04-212-16/+14
| | |
| * | SI-7345 remove unused methods.Jason Zaugg2013-04-211-10/+3
| | |
| * | SI-7345 Prefer using a throwaway silent context over buffer flushing.Jason Zaugg2013-04-214-56/+44
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When we are using a throwaway silent context, we can just let it drift out of scope and over the horizon, rather than ceremoniously flushing its buffers on completion. - Applied to Scaladoc. - Applied to Infer#isApplicableSafe. Less manual error buffer management affords greater opportunity to cleanly express the logic. - Applied to `typerReportAnyContextErrors`. The reasoning for the last case is as follows: - There were only two callers to `typerReportAnyContextErrors`, and they both passed in as `c` a child context of `context`. - That child context must share the error reporting mode and buffer with `context`. - Therefore, extracting an error from `c` and issuing it into `context` is a no-op. Because the error buffer is Set, it was harmless. This part will probably textually conflict with the same change made in SI-7319, but the end results are identical.
| * | SI-7345 More refactoring and documentation in ContextsJason Zaugg2013-04-216-130/+238
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Use `firstError match {}` rather than `if (c.hasErrors) c.firstError ..` - Convert implementation comments to doc comments - Add new doc comments - Refactor `Context#make` for better readability. - Note a few TODOs. - Roughly delineate the internal structure of Contexts with comments. - Combine `mode` and `state` methods into `contextMode`. - Move `isNameInScope` closer to its compadres. - Improving alignment, tightening access.
| * | SI-7345 Exploit named/default argsJason Zaugg2013-04-212-4/+2
| | | | | | | | | | | | | | | - Collapse overloads of `rootContext` - make `atOwner` more concise
| * | SI-7345 Encapsulate warning and error buffers in ReportBuffer.Jason Zaugg2013-04-216-42/+100
| | | | | | | | | | | | | | | | | | | | | | | | - merge `Context#{buffer, warningBuffer}` into `Context#reportBuffer`. - only expose immutable copies of the error and warnings buffers - Introduce a convenience method, `firstError`. - replace `condBufferFlush` more specific methods to retain or clear errors by error kind.
| * | SI-7345 Add Context#isLocal, akin to Symbol#isLocalJason Zaugg2013-04-211-8/+4
| | | | | | | | | | | | | | | | | | Out with the old, in with the new. `isLocal()`, which has been removed, was unused. `isLocal`, the new entry, has the same semantics as `Symbol#isLocal`.
| * | SI-7345 Use combinator to find next enclosing non-template.Jason Zaugg2013-04-211-3/+1
| | |
| * | SI-7345 Remove comment that appears obsolete.Jason Zaugg2013-04-211-1/+0
| | | | | | | | | | | | Obsolete since ee02ad59c, as best as I can judge.
| * | SI-7345 Rationalize overloads of Context#makeJason Zaugg2013-04-213-37/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Used default arguments and removed of variations only used in one place. I couldn't eliminate them all: one remaining overload avoids allocating a new context when the scope/owner/tree don't change, but moving this optimizatin to the primary overload of make breaks things. This is noted in a TODO comment.
| * | SI-7345 Represent the boolean modes in Context in ContextMode.Jason Zaugg2013-04-212-91/+131
| | | | | | | | | | | | | | | | | | - This is a value class in the same spirit of Mode. - Code that temporarily changes mode can be simplified by saving and restoring this one field.
* | | Merge pull request #2441 from soc/SI-7402Paul Phillips2013-04-244-7/+9
|\ \ \ | | | | | | | | SI-7402 List extends Serializable
| * | | SI-7402 List extends SerializableSimon Ochsenreither2013-04-244-7/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | While we are all aware of the issues around Serialization, I think in this case it is perfectly sound and safe to make List serializable: - List is not an interface, it is the base type of an ADT. Common behavior of its members should be reflected in the base type. - List is sealed, there is no chance of an user providing a new non-serializable subtype of List.
* | | | Merge pull request #2431 from som-snytt/issue/partest-srcdirPaul Phillips2013-04-241-3/+3
|\ \ \ \ | |/ / / |/| | | Par-Test allows redefinition of srcDir by Ant
| * | | Par-Test allows redefinition of srcDir by AntSom Snytt2013-04-221-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Since srcDir is no longer used to extract the test kind from any given test path, it is especially benign to rely on the defness of srcDir in order to allow redefinition during an Ant run. The parameter is configured via the partest.srcdir property. Maybe the keyword should be def for definite values and red for redefinable values and ind for indefinite values. And ded for dedefinable values optionally reset to None.
* | | | Merge pull request #2438 from paulp/pr/bitset-testPaul Phillips2013-04-232-5/+6
|\ \ \ \ | | | | | | | | | | Disabled failing bitset test.
| * | | | Disabled failing bitset test.Paul Phillips2013-04-232-5/+6
|/ / / / | | | | | | | | | | | | | | | | | | | | | | | | It's a couple orders of magnitude out of whack when a test demands a gigabyte of memory to pass. We might need to start collecting per-test stats to avoid this kind of thing in the future. It's a huge waste of time.
* | | | Merge pull request #2284 from demobox/add-box-unbox-doc-commentJason Zaugg2013-04-2310-9/+59
|\ \ \ \ | | | | | | | | | | SI-6898 Document AnyVal box and unbox implemention by BoxesRunTime
| * | | | SI-6898 Document AnyVal box and unbox implemention by BoxesRunTimeAndrew Phillips2013-04-229-9/+52
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Added @boxRunTimeDoc@ and @unboxRunTimeDoc@ tokens to AnyVals - Doc comments refer to BoxesRunTime.java in the Scala repo - No comment for Unit
| * | | | Reverting changes to AnyVals generated classes in 9a82fc0Andrew Phillips2013-04-223-0/+7
| | |/ / | |/| | | | | | | | | | - Since the generator was not changed, the classes no longer represent the generated versions
* | | | Merge pull request #2417 from paulp/pr/empty-type-boundsJason Zaugg2013-04-2314-48/+39
|\ \ \ \ | | | | | | | | | | Simplify type bounds.
| * | | | Simplify type bounds.Paul Phillips2013-04-2014-48/+39
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | I started out looking to limit the noise from empty type bounds, i.e. the endless repetition of class A[T >: _root_.scala.Nothing <: _root_.scala.Any] This led me to be reminded of all the unnecessary and in fact damaging overreaches which are performed during parsing. Why should a type parameter for which no bounds are specified be immediately encoded with this giant tree: TypeBounds( Select(Select(Ident(nme.ROOTPKG), tpnme.scala_), tpnme.Nothing), Select(Select(Ident(nme.ROOTPKG), tpnme.scala_), tpnme.Any) ) ...which must then be manually recognized as empty type bounds? Truly, this is madness. - It deftly eliminates the possibility of recognizing whether the user wrote "class A[T]" or "class A[T >: Nothing]" or "class A[T <: Any]" or specified both bounds. The fact that these work out the same internally does not imply the information should be exterminated even before parsing completes. - It burdens everyone who must recognize type bounds trees, such as this author - It is far less efficient than the obvious encoding - It offers literally no advantage whatsoever Encode empty type bounds as TypeBounds(EmptyTree, EmptyTree) What could be simpler.
* | | | | Merge pull request #2433 from soc/SI-7408Jason Zaugg2013-04-231-10/+21
|\ \ \ \ \ | |_|_|/ / |/| | | | SI-7408 Fix test by sorting results of getDeclaredClasses
| * | | | SI-7408 Fix test by sorting results of getDeclaredClassesSimon Ochsenreither2013-04-231-10/+21
|/ / / / | | | | | | | | | | | | | | | | | | | | run/t4023 can fail (and has already) because the order of elements in the reflection API is not specified and can differ between platforms (e. g. HotSpot and Avian) or even versions (Java 7 vs. Java 8).
* | | | Merge pull request #2396 from som-snytt/issue/unmoored-docAdriaan Moors2013-04-228-53/+158
|\ \ \ \ | | | | | | | | | | SI-7376 Scaladoc warns when discarding local doc comments with API tags
| * | | | SI-7376 Bad doc variable error is positioned at the variable.Som Snytt2013-04-171-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | | For a bad $variable, the caret is positioned at the variable in the doc instead of at the symbol being documented.
| * | | | SI-7376 Additional trivial Scaladoc format correctionsSom Snytt2013-04-174-19/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Horizontal rule is ---- not ==== (which means header). Sample dollars must be escaped.
| * | | | SI-7376 Unmoored doc has correct positionSom Snytt2013-04-173-25/+61
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The unmoored DocComment is created more eagerly so that its position is correct despite subsequent line comments. (Previously, skipComment would advance docPos.) It looks like the error caret is still off by one when a doc comment shows up in the middle of an operator, and who doesn't scaladoc the interior of expressions? Another bug fixed by Paul's refactor is that additional comments between the doc and the entity no longer breaks the scaladoc. Test added.
| * | | | SI-7376 Scaladoc warns when discarding local doc comments with API tagsSom Snytt2013-04-153-10/+75
| | |/ / | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Double-star doc comments in non-dockable positions at the end of a block will emit a warning only if API tags like @author are present, or under -Xlint. A real comment parser is applied early to probe for tags, to minimize ad hoc testing or duplication, but warnings are suppressed. Residual ad hockiness lies in precisely which tags to warn on. Ad hoc or ad doc. This fix is a stop gap; a richer solution would also report about other doc locations that won't be processed.
* | | | Merge pull request #2360 from ihji/bugfix/SI-7080Jason Zaugg2013-04-214-6/+33
|\ \ \ \ | | | | | | | | | | SI-7080 improve boundary value checking for BitSet
| * | | | SI-7080 improve boundary value checking for BitSetHeejong Lee2013-04-074-6/+33
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When BitSet accepts a very large integer such as Int.MaxValue, integer overflow possibly occurs in the calculation of boundary value "nwords * WordLength". This faulty boundary condition causes empty-iterator problem like following: scala> import collection.mutable.BitSet import collection.mutable.BitSet scala> val x = BitSet(Int.MaxValue) x: scala.collection.mutable.BitSet = BitSet() scala> x.iterator res0: Iterator[Int] = empty iterator
* | | | | Merge pull request #2398 from huitseeker/silence_scaladoc_betterJason Zaugg2013-04-2111-14/+14
|\ \ \ \ \ | | | | | | | | | | | | Change unrecognized scaladoc comments to C-style
| * | | | | Change unrecognized scaladoc comments to C-styleFrançois Garillot2013-04-1611-14/+14
| | |/ / / | |/| | |
* | | | | Merge pull request #2426 from paulp/pr/7324Jason Zaugg2013-04-214-1/+70
|\ \ \ \ \ | | | | | | | | | | | | SI-7324 jvm not cool with 255+ parameters
| * | | | | SI-7324 jvm not cool with 255+ parametersPaul Phillips2013-04-214-1/+70
| | |_|_|/ | |/| | | | | | | | | | | | | Fail those monster methods rather than generating bad bytecode.
* | | | | Merge pull request #2427 from aldenml/bigdecimal-doc-fixJason Zaugg2013-04-211-4/+4
|\ \ \ \ \ | |/ / / / |/| | | | Fix BigDecimal documentation for primitive conversion methods.
| * | | | Fixed BigDecimal documentation for primitive conversion methods.Alden Torres2013-04-211-4/+4
|/ / / /
* | | | Merge pull request #2361 from retronym/ticket/7337Jason Zaugg2013-04-203-2/+21
|\ \ \ \ | | | | | | | | | | SI-7337 Error out on missing -d directory.