summaryrefslogtreecommitdiff
path: root/src/library
Commit message (Collapse)AuthorAgeFilesLines
* SI-6360 revises naming of AnnotationInfo and its membersEugene Burmako2012-09-156-64/+67
| | | | | | | | | Internal face of AnnotationInfos is bound by backward compatibility with compiler plugins and possibly SBT, but the public face can be shaped in whatever fashion we like. Hence I cleaned up the names: AnnotationInfo itself got renamed to just Annotation, AnnotArgs got renamed to just Arguments and so on.
* SI-6372 cleans up the API of AttachmentsEugene Burmako2012-09-151-4/+7
| | | | | | | | | | | | Previously Attachments allowed multiple attachments that correspond to the same attachment type. This created a potential for confusion, given that Attachments.get only searched for the first attachment of a given type. Hence I made Attachments.add overwrite previously existing attachments of a given type and renamed it to Attachments.update, so that the name suits the intention better.
* SI-6371 adds comments for Trees#UnApplyEugene Burmako2012-09-151-3/+23
| | | | | | | | | Unfortunately we cannot remove this node, because it's emitted by typer and, therefore, can be seen by macros and pickled as a part of annotations. Therefore we have to expose UnApply in the API. Experimental status of scala-reflect.jar will give us some leeway to evict it from the compiler (and consequently from the API) by 2.10.1.
* SI-6373 removes Trees#ApplyDynamic from the APIEugene Burmako2012-09-142-35/+0
| | | | | | | | | | | Introduced by erasure - therefore it can be seen neither by macros, nor by runtime reflection. Despite never being pickled, ApplyDynamic is supported by unpickler so I couldn't move it exclusively to scala-compiler.jar. Figuring out the mysterious reason for pickling ApplyDynamic is left to future work.
* Eliminate breaking relative names in source.Paul Phillips2012-09-14229-489/+476
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* Merge pull request #1301 from paulp/clone-parensJosh Suereth2012-09-145-5/+5
|\ | | | | Made 'def clone()' consistent with parens everywhere.
| * Made 'def clone()' consistent with parens everywhere.Paul Phillips2012-09-145-5/+5
| | | | | | | | | | | | | | | | For the reference of others, ack --files-with-matches 'def clone[:\s]' src is how you might find out who needs fixing.
* | Merge pull request #1281 from jsuereth/fix/SI-4813Josh Suereth2012-09-146-6/+40
|\ \ | | | | | | Fix SI-4813 - Clone doesn't work on LinkedList.
| * | Fix SI-4813 - Clone doesn't work on LinkedList.Josh Suereth2012-09-146-6/+40
| |/ | | | | | | | | * Added extensive test for clone across all standard mutable collections * Fixed clone implementations when needed so they work.
* | SI-6310 redeploys the starrEugene Burmako2012-09-142-9/+0
| | | | | | | | | | Updates the starr with the changes introduced by the previous commit. Cleans up obsolete symbols required by the previous starr.
* | SI-6310 AbsTypeTag => WeakTypeTagEugene Burmako2012-09-144-73/+82
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | improvements for reification of free symbolsEugene Burmako2012-09-142-12/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | removes build.newFreeExistentialEugene Burmako2012-09-142-16/+1
|/ | | | | | 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.
* Merge pull request #1247 from jsuereth/fix/SI-6114Josh Suereth2012-09-121-0/+7
|\ | | | | Fix t6114 - ++ on JList wrapper modifies underlying collection.
| * Fix t6114 - ++ on JList wrapper modifies underlying collection.Josh Suereth2012-09-111-0/+7
| | | | | | | | | | | | 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?
* | improve Promise.tryAwait by converting to match statementRoland2012-09-121-10/+9
| | | | | | | | | | - also use type FiniteDuration due to a previous change to Deadline’s type signature
* | Merge remote-tracking branch 'origin/2.10.x' into fix-duration-issues-RKRoland2012-09-1216-111/+215
|\ \
| * \ Merge pull request #1279 from rkuhn/fix-duration-usageJosh Suereth2012-09-117-34/+71
| |\ \ | | | | | | | | fix usage of Duration in Promise impl
| | * | improve docs and Promise implRoland2012-09-113-33/+53
| | | | | | | | | | | | | | | | | | | | | | | | | | | | - 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
| | * | fix usage of Duration in Promise implRoland2012-09-107-15/+32
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - 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
| * | | Merge pull request #1262 from jsuereth/fix/SI-6271Josh Suereth2012-09-111-0/+1
| |\ \ \ | | | | | | | | | | Fixes SI-6271 - Missing isEmpty override for views.
| | * | | Fixes SI-6271 - Missing isEmpty override for views.Josh Suereth2012-09-061-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
| * | | | Merge pull request #1284 from retronym/topic/deprecated-inheritanceGrzegorz Kossakowski2012-09-114-0/+45
| |\ \ \ \ | | |_|_|/ | |/| | | SI-6162 Adds private[scala] @deprecatedInheritance/@deprecatedOverriding
| | * | | Pull request feedbackJason Zaugg2012-09-111-1/+1
| | | | |
| | * | | Rescues @deprecated{Inheritance, Overriding}Jason Zaugg2012-09-112-2/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
| | * | | Adds @deprecatedInheritance to BigInt and BigDecimalSimon Ochsenreither2012-09-102-0/+2
| | | | |
| | * | | SI-6162 Adds @deprecatedInheritance/@deprecatedOverridingSimon Ochsenreither2012-09-102-0/+39
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
| * | | | Merge pull request #1269 from jsuereth/wip/si-6333Josh Suereth2012-09-101-23/+40
| |\ \ \ \ | | | | | | | | | | | | Wip/si 6333
| | * | | | Minor code style alterations and performance fixes.Josh Suereth2012-09-071-10/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
| | * | | | Fix for SI-6333 - Try throws from combinators.Josh Suereth2012-09-071-13/+33
| | | |_|/ | | |/| | | | | | | | | | | | | | | | | | | | | | * 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-6345 Remove scala.runtime.ScalaRunTime.TrySimon Ochsenreither2012-09-101-29/+0
| |/ / /
| * | | Merge pull request #1265 from scalamacros/ticket/6318Josh Suereth2012-09-061-1/+20
| |\ \ \ | | | | | | | | | | SI-6318 fixes ClassTag.unapply for primitives
| | * | | SI-6318 fixes ClassTag.unapply for primitivesEugene Burmako2012-09-061-1/+20
| | |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
| * | | fixes Manifest.Nothing and Manifest.NullEugene Burmako2012-09-062-6/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
| * | | SI-6246 deprecated apis for core class tagsEugene Burmako2012-09-062-23/+32
| |/ / | | | | | | | | | | | | Aliases ClassTag.XXX to Manifest.XXX to reuse already existing implementations of deprecated APIs.
* | | restrict Deadline to finite durations (would have to throw otherwise)Roland2012-09-121-9/+10
| | |
* | | make private methods private[this] to avoid conflicts when importing Duration._Roland2012-09-121-15/+15
| | |
* | | retronym had one more improvement hidden up his sleeve for DurationRoland2012-09-121-7/+9
| | |
* | | factor out more constants in Duration, thanks paulp!Roland2012-09-121-8/+18
| | |
* | | two more minor cleanups to DurationRoland2012-09-111-2/+2
| | | | | | | | | | | | | | | - copy partest TestUtil.intercept change from PR 1279 branch - add comment on non-obvious match cases
* | | fix two minor issues in DurationRoland2012-09-091-15/+14
| | | | | | | | | | | | | | | - make constants for fromNanos(Long) actually inlined constants - clarify origin of require() check constants in FiniteDuration
* | | fix some one more issue in DurationRoland2012-09-071-54/+79
| | | | | | | | | | | | | | | | | | | | | - Inf / Zero == Inf - add some more missing test cases - clarify magic constant - move exception descriptions into proper @throws docs
* | | second round of Duration cleanupRoland2012-09-071-97/+425
| | | | | | | | | | | | | | | | | | | | | | | | - 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
* | | several fixes to scala.concurrent.util.DurationRoland2012-09-051-9/+58
|/ / | | | | | | | | | | | | | | | | | | | | - 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)
* | Removing duplication from Duration.Paul Phillips2012-09-041-328/+178
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | Merge pull request #1219 from odersky/topic/worksheet-instrumenterJosh Suereth2012-09-041-3/+3
|\ \ | | | | | | More worksheet nstrumentation changes
| * | Made instrumenter more robust by looking at tokensMartin Odersky2012-08-301-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | | Merge pull request #1244 from dgruntz/2.10.xJosh Suereth2012-09-041-4/+4
|\ \ \ | | | | | | | | Fixes typos in the ScalaDoc of StringContext
| * | | Fixes typos in the ScalaDoc of StringContextDominik Gruntz2012-09-041-4/+4
| | | |
* | | | Fixes SI-6285 - ParIterableLike no longer says sequential foreach.Josh Suereth2012-09-041-1/+1
| |_|/ |/| |