| Commit message (Collapse) | Author | Age | Files | Lines |
|\
| |
| | |
A little cleanup along the Any to AnyRef trail.
|
| |
| |
| |
| |
| |
| |
| |
| | |
Followup to 35316be and d3f879a.
- Remove obsolete comments and replace them with a test.
- Don't emit error addendum unless we know we're dealing
with a value class.
|
|\ \
| | |
| | | |
Topic/empty array optimization
|
| | |
| | |
| | |
| | |
| | |
| | | |
Because there are lots of times when you just need an
array and shouldn't have to allocate one every time or
pick a random spot to cache yet another empty array.
|
|/ /
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
These things are killing me. Constructions like
package scala.foo.bar.baz
import foo.Other
DO NOT WORK in general. Such files are not really in the
"scala" package, because it is not declared
package scala
package foo.bar.baz
And there is a second problem: using a relative path name means
compilation will fail in the presence of a directory of the same
name, e.g.
% mkdir reflect
% scalac src/reflect/scala/reflect/internal/util/Position.scala
src/reflect/scala/reflect/internal/util/Position.scala:9: error:
object ClassTag is not a member of package reflect
import reflect.ClassTag
^
src/reflect/scala/reflect/internal/util/Position.scala:10: error:
object base is not a member of package reflect
import reflect.base.Attachments
^
As a rule, do not use relative package paths unless you have
explicitly imported the path to which you think you are relative.
Better yet, don't use them at all. Unfortunately they mostly work
because scala variously thinks everything scala.* is in the scala
package and/or because you usually aren't bootstrapping and it
falls through to an existing version of the class already on the
classpath.
Making the paths explicit is not a complete solution -
in particular, we remain enormously vulnerable to any directory
or package called "scala" which isn't ours - but it greatly
limts the severity of the problem.
|
|\ \
| | |
| | | |
Made 'def clone()' consistent with parens everywhere.
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
For the reference of others,
ack --files-with-matches 'def clone[:\s]' src
is how you might find out who needs fixing.
|
|\ \ \
| | | |
| | | | |
Fix SI-4813 - Clone doesn't work on LinkedList.
|
| |/ /
| | |
| | |
| | |
| | | |
* Added extensive test for clone across all standard mutable collections
* Fixed clone implementations when needed so they work.
|
| | |
| | |
| | |
| | |
| | | |
Updates the starr with the changes introduced by the previous commit.
Cleans up obsolete symbols required by the previous starr.
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
The new name for AbsTypeTag was a matter of a lengthy discussion:
http://groups.google.com/group/scala-internals/browse_thread/thread/fb2007e61b505c4d
I couldn't decide until having fixed SI-6323 today, which is about
trying to reflect against a local class using typeOf.
The problem with local classes is that they aren't pickled, so their metadata
isn't preserved between Scala compilation runs. Sure, we can restore some of
that metadata with Java reflection, but you get the idea.
Before today typeOf of a local class created a free type, a synthetic symbol,
with a bunch of synthetic children that remember the metadata, effectively
creating a mini symbol table. That might be useful at time, but the problem is
that this free type cannot be reflected, because the global symbol table of
Scala reflection doesn't know about its mini symbol table.
And then it struck me. It's not the presence of abs types (type parameters and
abs type members) that differentiates arbitrary type tags from good type tags.
It's the presence of types that don't map well on the runtime world - ones that
can't be used to instantiate values, ones that can't be reflected.
So we just need a name for these types. Phantom types are compile-time only
concept, whereas our types can have partial correspondence with the runtime.
"Weak types" sound more or less okish, so let's try them out.
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
1) Free symbols no longer carry signatures in their constructors.
Previously to reify a free symbol (i.e. to generate a ValDef that creates it)
one had to reify sym.info first. However reification of sym.info might lead to
unexpected side effects, including stack overflows, if reification of sym.info
recursively required reifying sym itself.
Now it's not a problem. First we reify a "header" of a free symbol
by emitting something like:
val free$Foo1 = build.newFreeTerm("Foo", Foo.this, NoFlags)`
Afterwards, when doing code generation for the reification symbol table, we
populate free symbols by inserting calls to `build.setTypeSignature($sym.info)`
This techniques transforms recursion into memoized iteration, because even if
reifying sym.info indirectly requires reification of sym itself, we remember
that we already reified sym and simply return things like Ident(free$Foo1).
2) Unfortunately I haven't been able to get rid of recursion completely.
Since some symbols (e.g. local classes) aren't pickled, we need to recreate
them during reification (this is necessary e.g. to reify RefinedTypes).
Reifier uses a special function, named `reifySymDef`, for that purpose.
Here's an example of how it works:
val symdef$_1 = build.newNestedSymbol(free$U1, newTypeName("_"),
NoPosition, DEFERRED | PARAM, false);
`reifySymDef` expands into a call to `newNestedSymbol`, which requires an owner
This essentially turns `reifySymDef` into a recursion of `reifySymDef` calls,
so that the entire owner chain get reified.
This is an implementation strategy that was employed in the first revision
of the reifier written by Martin, and personally I have no clue whether it's
really necessary to reify the parents. I leave this as a future work.
3) When working with free symbols, it's necessary to attach free symbols
to their reification. This is required in obscure nested reification scenarios,
when a symbol that was free for an inner reifee is no longer free for an outer
reifee. In that case we need to remove that free symbol from the symbol table
of the inner reification.
Back then we didn't have tree attachments, so I had to introduce a phantom
"value" parameter for `newFreeType` to keep track of the original symbols for
free types. Now when we have attachments, this is no longer necessary and
allowed me to clean up the code.
|
|/ /
| |
| |
| |
| |
| | |
build.newFreeType does exactly the same, so we don't have a need
in two different methods. Type parameters and existentially bound syms
can later be distinguished using flags.
|
|\ \
| | |
| | | |
Fix t6114 - ++ on JList wrapper modifies underlying collection.
|
| | |
| | |
| | |
| | |
| | |
| | | |
We solve this by overriding clone for JListWrapper to actually do a full clone.
Note: This fix may need to be included other places, *but* we're not sure we've cloned the collection sensibly. I.e. is ArrayList a good default?
|
| | |
| | |
| | |
| | |
| | | |
- also use type FiniteDuration due to a previous change to
Deadline’s type signature
|
|\ \ \
| | |/
| |/| |
|
| |\ \
| | | |
| | | | |
fix usage of Duration in Promise impl
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
- scaladoc the exceptions thrown by Await.* and Awaitable.*
- move intercept[Exception] into partest’s TestUtil object
- improve Promise.tryAwait implementation following Viktor’s comments
and make use of Deadline to avoid calling System.nanoTime too often
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
- correctly treat MinusInf and Undefined
- don't toMillis in the timeout message (could be MinusInf)
- also notice that Inf did not actually wait unbounded
- and further notice that tryAwait swallows InterruptedException instead
of bailing out early => changed to do so and added throws annotation
- also removed some unused imports of Duration
|
| |\ \ \
| | | | |
| | | | | |
Fixes SI-6271 - Missing isEmpty override for views.
|
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
GenIterableView didn't override isEmpty for views to look at *filtered* iterator, but was instead pulling
unfiltered iterator and causing issues. Chalk up another bizzare bug to lack of insight/visibility into
linearization and what havoc overriding new methods can spew on our library.
|
| |\ \ \ \
| | |_|_|/
| |/| | | |
SI-6162 Adds private[scala] @deprecatedInheritance/@deprecatedOverriding
|
| | | | | |
|
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
While they ought to be generalized to aribirary modifier
changes before being offered in the standard library, the
opportunity to use them in 2.10 is too important to pass up.
So for now, they're private[scala].
En route:
- made the error messages more concise
- fix positioning of inheritance error
- improve test coverage
|
| | | | | |
|
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
These annotations are meant to warn from inheriting a class or
from overriding a member, due to the reasons given in `msg`.
The naming and placement of the methods is in line with
@deprecated and @deprecatedName.
|
| |\ \ \ \
| | | | | |
| | | | | | |
Wip/si 6333
|
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | | |
Specifically, avoid reinstantiating an immutable object to alter the type parameter *IF*
that type parameter has nothing to do with the contents of the object.
|
| | | |_|/
| | |/| |
| | | | |
| | | | |
| | | | |
| | | | | |
* Added more comprehensive tests to Try.
* Delineated what methods do and don't catch exceptions in docs.
* Fixed combinator methods that should catch exceptions.
|
| |/ / / |
|
| |\ \ \
| | | | |
| | | | | |
SI-6318 fixes ClassTag.unapply for primitives
|
| | |/ /
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
ClassTag.unapply now has overloads for primitive value classes
so that it can preserve boxiness when performing subtyping tests.
First I wanted to annotate ClassTag.unapply with a ClassTag itself,
i.e. to transform its signature from "def unapply(x: Any): Option[T]"
to "def unapply[U: ClassTag](x: U): Option[T]".
But then virtpatmat_typetag.scala exhibited a nasty problem.
When pattern matching with this unapply, patmat first infers U as something
and then tries to pattern match against this inferred type. And if U gets
inferred as an abstract type itself, bad things happen:
warning: The outer reference in this type test cannot be checked at run time.
That's why I decided to drop the ClassTag idea and go with 9 extra overloads.
Not very beautiful, but definitely robust.
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
Also introduces an important change to Manifest.Nothing and Manifest.Null.
Previously their `erasure` was equal to classOf[Object]. Now it's correctly
set to classOf[scala.runtime.Nothing$] and classOf[scala.runtime.Null$]
correspondingly.
See a discussion here:
https://groups.google.com/forum/#!topic/scala-internals/Y0ALGo7QPqE
|
| |/ /
| | |
| | |
| | |
| | | |
Aliases ClassTag.XXX to Manifest.XXX to reuse already existing
implementations of deprecated APIs.
|
| | | |
|
| | | |
|
| | | |
|
| | | |
|
| | |
| | |
| | |
| | |
| | | |
- copy partest TestUtil.intercept change from PR 1279 branch
- add comment on non-obvious match cases
|
| | |
| | |
| | |
| | |
| | | |
- make constants for fromNanos(Long) actually inlined constants
- clarify origin of require() check constants in FiniteDuration
|
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
- Inf / Zero == Inf
- add some more missing test cases
- clarify magic constant
- move exception descriptions into proper @throws docs
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
- make Duration behave consistent with Double's non-finite semantics
- add ScalaDoc
- add complete test suite
- change overflow protection impl after review comments
- clean up code
|
|/ /
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
- add test cases (migrated from Akka sources)
- add overflow checking (will throw IllegalArgumentException instead of
giving wrong results)
- make string parsing more precise when giving >100days in nanoseconds
- make method signatures more precise in retaining FiniteDuration
throughout calculations
- fix mul/div of infinities by negative number
- add Ordering for Deadline (was accidentally left out earlier)
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
I don't know what good it is to have code review if we are checking
in code like this. We must raise the bar, people. When the
justification for code being in the standard library is borderline
at best - as it is here - then the code must be of exceptional
quality. This code is not of exceptional quality.
Mostly these are not behavioral changes, but:
- I removed finite_? as it is a gratuitous deviation from
every isXXX method in the world. This isn't ruby.
- I removed all the regexps, which only made things complicated
- I removed all the unnecessary casts, which is to say, all of them
- I made more things final, sealed, and private
- The unapply structure was all wrong; returning Option[Duration]
on the string unapply meant you'd have to say
case Duration(Duration(x, y)) => ...
So I fixed apply and unapply to be symmetric.
- And I removed the "parse" method, since it was doing what
apply is supposed to do.
There's a test case to exercise accessing it from java,
which also reveals what I hope are bugs.
Thanks to viktor klang for DurationConversions.
|
|\ \
| | |
| | | |
More worksheet nstrumentation changes
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
Made instrumenter more robust by taking into account the positions of the tokens in the source. This allows us to reliably put instrumentation code at the end of the previous token, which tends to put it at end of lines. Furthermore, we now skip left parents. Previously, the instrumenter got confused for a statement like
( x + 1 )
because it thought that the statement started at the `x` and not at the `(`.
Another small change is that we now use decoded names in the worksheet. So ??? will show as ??? not $qmark$qmark$qmark.
|
|\ \ \
| | | |
| | | | |
Fixes typos in the ScalaDoc of StringContext
|
| | | | |
|
| |_|/
|/| | |
|