| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
|\
| |
| | |
SI-7345 Refactoring Contexts
|
| |\
| | |
| | |
| | |
| | |
| | | |
Conflicts:
src/compiler/scala/tools/nsc/typechecker/Contexts.scala
src/compiler/scala/tools/nsc/typechecker/Typers.scala
|
| | | |
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
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
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
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.
|
| | | |
|
| | |
| | |
| | |
| | | |
Also refactored `handleOverloaded` to avoid use of a mutable Buffer
|
| | |
| | |
| | |
| | |
| | | |
According to Hubert, during normal operation we can start buffering
errors in a context with existing errors. So the warning would be noisy.
|
| | | |
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
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`.
|
| | | |
|
| | | |
|
| | | |
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
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.
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
- 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.
|
| | |
| | |
| | |
| | |
| | | |
- Collapse overloads of `rootContext`
- make `atOwner` more concise
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
- 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.
|
| | |
| | |
| | |
| | |
| | |
| | | |
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`.
|
| | | |
|
| | |
| | |
| | |
| | | |
Obsolete since ee02ad59c, as best as I can judge.
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
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.
|
| | |
| | |
| | |
| | |
| | |
| | | |
- 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.
|
|\ \ \
| | | |
| | | | |
SI-7402 List extends Serializable
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
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.
|
|\ \ \ \
| |/ / /
|/| | | |
Par-Test allows redefinition of srcDir by Ant
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
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.
|
|\ \ \ \
| | | | |
| | | | | |
Disabled failing bitset test.
|
|/ / / /
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
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.
|
|\ \ \ \
| | | | |
| | | | | |
SI-6898 Document AnyVal box and unbox implemention by BoxesRunTime
|
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
- Added @boxRunTimeDoc@ and @unboxRunTimeDoc@ tokens to AnyVals
- Doc comments refer to BoxesRunTime.java in the Scala repo
- No comment for Unit
|
| | |/ /
| |/| |
| | | |
| | | | |
- Since the generator was not changed, the classes no longer represent the generated versions
|
|\ \ \ \
| | | | |
| | | | | |
Simplify type bounds.
|
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
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.
|
|\ \ \ \ \
| |_|_|/ /
|/| | | | |
SI-7408 Fix test by sorting results of getDeclaredClasses
|
|/ / / /
| | | |
| | | |
| | | |
| | | |
| | | | |
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).
|
|\ \ \ \
| | | | |
| | | | | |
SI-7376 Scaladoc warns when discarding local doc comments with API tags
|
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
For a bad $variable, the caret is positioned at the variable
in the doc instead of at the symbol being documented.
|
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
Horizontal rule is ---- not ==== (which means header).
Sample dollars must be escaped.
|
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
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.
|
| | |/ /
| |/| |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
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.
|
|\ \ \ \
| | | | |
| | | | | |
SI-7080 improve boundary value checking for BitSet
|
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
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
|
|\ \ \ \ \
| | | | | |
| | | | | | |
Change unrecognized scaladoc comments to C-style
|
| | |/ / /
| |/| | | |
|
|\ \ \ \ \
| | | | | |
| | | | | | |
SI-7324 jvm not cool with 255+ parameters
|
| | |_|_|/
| |/| | |
| | | | |
| | | | | |
Fail those monster methods rather than generating bad bytecode.
|
|\ \ \ \ \
| |/ / / /
|/| | | | |
Fix BigDecimal documentation for primitive conversion methods.
|
|/ / / / |
|
|\ \ \ \
| | | | |
| | | | | |
SI-7337 Error out on missing -d directory.
|