summaryrefslogtreecommitdiff
path: root/src/library
Commit message (Collapse)AuthorAgeFilesLines
* evicts last traces of makro from our codebaseEugene Burmako2012-08-021-11/+0
| | | | Removes the stubs left out to appease the old starr, fixes macro tests.
* reflect.makro => reflect.macros (Step I)Eugene Burmako2012-08-023-6/+17
| | | | | | | | | Builds a starr that uses stuff from scala.reflect.macros for macro activities. Crucial makro thingies (such as makro.Context or makro.internal.macroImpl) are temporarily left in place, because they are necessary for previous starr. Macro tests will be fixed in a dedicated commit, so that they don't pollute meaningful commits, making the life easy for reviewers and spelunkers.
* prepares our macro defs for refactoring (Step II)Eugene Burmako2012-08-023-8/+4
| | | | | | | | | | Since the previous commit the compiler doesn't need any help to find out that fast-tracked macros are macros. Hence I'm replacing their RHSes with the universal ??? body. This way macro definitions defined in scala (for example, tag materialization macros or certain string formatters) won't stand in the way of the changes to the macro system.
* more refinements of reflection APIEugene Burmako2012-08-021-16/+0
| | | | | | | | | | | | | | Added a bunch of test methods to symbols to cover public flags: (e.g. isPrivate, isFinal, isOverride, isImplicit, etc). I'd argue that the API duplication w.r.t flag sets is trumped by unified interface to tests and better encapsulation. Also updated the API to be easier to understand after prior exposure to Java or .NET reflection APIs: 1) Added typeParams to TypeSymbol and ClassSymbol. 2) Renamed MethodSymbol.resultType to returnType. 3) Removed the distinction between MethodSymbol.params vs MethodSymbol.allParams now we just have MethodSymbol.params: List[List[Symbol]].
* renames asType to toType and asXXXSymbol to asXXXEugene Burmako2012-08-022-23/+43
| | | | | | | This renaming arguably makes the intent of `asType` more clear, but more importantly it shaves 6 symbols off pervasive casts that are required to anything meaningful with reflection API (as in mirror.reflectMethod(tpe.member(newTermName("x")).asMethodSymbol)).
* simplifies flag APIEugene Burmako2012-08-023-5/+7
| | | | | | | | Flag ops now only include | and hasFlag, flag bearer ops now only include flags and hasFlag. These abstractions are enough to implement everything else, so let's stick to them for the sake of minimalism.
* SI-5732 members and derivatives now return ScopeEugene Burmako2012-08-022-5/+30
| | | | | | | | | | | | | Firstly this unifies the reflection API - now both decls and members return Scope (not Scope and List[Symbol] as it were before). Secondly this fixes SI-5732 without having to sort the result of members. Type.members now returns Scope, a distinguished type, which has the `sorted` method, which does the required sorting if necessary. Also removes nonPrivateMembers and nonPrivateDeclarations to keep the API minimalistic (as can be seen from their implementation in internal.Types they are just members and decls with bridges and private members removed).
* Merge pull request #1018 from scalamacros/topic/classtag-of-nothingJosh Suereth2012-07-301-2/+7
|\ | | | | ClassTag.Nothing now throws an exception
| * ClassTag.Nothing now throws an exceptionEugene Burmako2012-07-301-2/+7
| | | | | | | | | | Nothing is a bottom type, so it doesn't make much sense for it to have a meaningful erasure (ClassTag.Nothing.runtimeClass).
* | Merge pull request #1005 from odersky/topic/worksheetodersky2012-07-302-4/+107
|\ \ | |/ |/| IDE improvements, with particular focus on making worksheets work.
| * New Worksheet mixing schemeMartin Odersky2012-07-271-0/+87
| | | | | | | | Debug changes
| * Raw string interpolatorMartin Odersky2012-07-271-4/+20
| | | | | | | | Adds a raw string interpolator raw"..." which does not do any escape sequence processing.
* | Eliminated all the current feature warnings.Paul Phillips2012-07-277-4/+8
| | | | | | | | This pretty much takes us down to deprecation and inliner warnings.
* | Eliminated remainder of "catches Throwable" warnings.Paul Phillips2012-07-272-1/+2
| | | | | | | | | | | | | | | | And also non-exhaustive matches. And added -nowarn to the build options for scalacheck, we don't need to hear the warnings for code we aren't able to fix.
* | Cleared the remaining unchecked warnings in trunk.Paul Phillips2012-07-271-4/+4
| |
* | Merge pull request #986 from scalamacros/ticket/6075Adriaan Moors2012-07-252-16/+22
|\ \ | | | | | | SI-6075 cleans up api.StandardNames
| * | SI-6075 cleans up api.StandardNamesEugene Burmako2012-07-242-16/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | I removed most of the stuff from api.StandardNames and reorganized all names. In the new scheme of things (as documented in the comments to StandardNames): 1) base.StandardNames contains names necessary for building trees. For example, tpnme.WILDCARD_STAR is necessary to build some invocations of varargs methods, and nme.CONSTRUCTOR is necessary to build invocations of constructors. 2) api.StandardNames hosts names that are core to doing reflection. E.g., to get to a package object, you need to find a member named nme.PACKAGE, to strip off the whitespace from the name of an underlying field of a val, you need nme.LOCAL_SUFFIX_STRING. Note that we don't need nme.MODULE_SUFFIX_STRING, because module name mangling is encapsulated in java mirrors.
* | | Merge pull request #966 from paulp/issue/6117Adriaan Moors2012-07-241-0/+0
|\ \ \ | |/ / |/| | SI-6117 regression involving import ambiguity.
| * | Renaming files to please ant.Paul Phillips2012-07-211-0/+0
| |/ | | | | | | "If the names don't fit, do not commit!"
* | Merge pull request #978 from adriaanm/haraldme-patch-1Adriaan Moors2012-07-241-1/+1
|\ \ | | | | | | [doc] Fix example of `Ordering.on` usage.
| * | [doc] Fix example of `Ordering.on` usage.haraldme2012-07-231-1/+1
| |/
* / Small changes to reflection API to make it safe for IDE use.Iulian Dragos2012-07-232-15/+4
|/ | | | | * Removed `typeSymbol` and `termSymbol` from `reflect.api.base`, and pushed them down to `reflect.api`. * extracted `TypeTree.symbol` to a top-level method so it can be overridden in other layers
* Merge pull request #894 from axel22/topic/static-annot-cherry-2.10.xLukas Rytz2012-07-201-0/+20
|\ | | | | Implement @static annotation on singleton object fields.
| * Implement @static annotation on singleton object fields.Aleksandar Prokopec2012-07-181-0/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit introduces the `@static` annotation on fields of static singleton objects. A static singleton object is a top-level singleton object or an object nested within a static singleton object. The field annotated with `@static` is generated as a true static field in the companion class of the object. The initialization of the field is done in the static initializer of the companion class, instead of the object itself. Here's an example. This: object Foo { @static val FIELD = 123 } class Foo generates : object Foo { def FIELD(): Int = Foo.FIELD } class Foo { <static> val FIELD = 123 } The accessor in `object Foo` is changed to return the static field in `class Foo` (the companion class is generated if it is not already present, and the same is done for getters if `FIELD` is a `var`). Furthermore, all the callsites to accessor `Foo.FIELD` are rewritten to access the static field directly. It is illegal to annotate a field in the singleton object as `@static` if there is already a member of the same name in `class Foo`. This allows better Java interoperability with frameworks which rely on static fields being present in the class. The `AtomicReferenceFieldUpdater`s are one such example. Instead of having a Java base class holding the `volatile` mutable field `f` and a static field containing a reference to the `AtomicReferenceFieldUpdater` that mutates `f` atomically, and extending this Java base class from Scala, we can now simply do: object Foo { @static val arfu = AtomicReferenceUpdater.newUpdater( classOf[Foo], classOf[String], "f" ) } class Foo { @volatile var f = null import Foo._ def CAS(ov: String, nv: String) = arfu.compareAndSet(this, null, "") } In summary, this commit introduces the following: - adds the `@static` annotation - for objects without a companion class and `@static` members, creates a companion class (this is done in `CleanUp`) - checks for conflicting names and if `@static` is used on static singleton object member - creates the `static` field in the companion class for `@static` members - moves the field initialization from the companion object to the static initializer of the class (the initialization of `@static` members is bypassed in the `Constructors` phase, and added to static ctors in `CleanUp`) - all callsites to the accessors of `@static` are rewritten to access the static fields directly (this is done in `GenICode`) - getters and setters to `@static` fields access the static field directly, and the field in the singleton object is not emitted (this is done in `GenICode`) - changes in `GenJVM`, `GenASM` - now computing local var indices in static initializers as well - this was an oversight before, now is necessary Future work: allow the `@static` annotation on methods as well - this will be added in a future commit. Review by @odersky, @dragos, @paulp, @heathermiller.
* | Merge pull request #956 from phaller/topic/sip14-critical-fix-awaitJosh Suereth2012-07-201-36/+42
|\ \ | | | | | | SIP-14 - Fix critical Java compatibility issue in scala.concurrent.Await
| * | SIP-14 - Fix critical Java compatibility issue in scala.concurrent.Awaitphaller2012-07-201-36/+42
| | | | | | | | | | | | Patch contributed by @viktorklang
* | | Merge pull request #925 from VladUreche/issue/scaladocAdriaan Moors2012-07-203-3/+4
|\ \ \ | | | | | | | | Fix a bunch of scaladoc issues: SI-3314 SI-4888 SI-5235 SI-5558 SI-4324 SI-5780 SI-4887 SI-3695 SI-4224 SI-4497 SI-5079 SI-6073 SI-5533 SI-5784
| * | | SI-5235 Correct usecase variable expansionVlad Ureche2012-07-163-3/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The bug is related to a couple of other annoyances, also fixed: - usecases without type params were crashing scaladoc due to a change in the PolyTypes class (not allowing empty tparams list) - properly getting rid of backticks (even if the link is not valid) - correct linking for usecases with $Coll = `immutable.Seq` (the symbol searching algorithm was too of restrictive, now we search the entire ownerchain - and the empty package at the end) - give a warning if the type lookup fails - finally, added a $Coll variable to List, for some reason it wasn't there and we were getting immutable.Seq as the result of use cases.
* | | | SI-5999 a real fix to the packageless problemEugene Burmako2012-07-202-1/+51
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | After a discussion on a reflection meeting on Jul 17 we concluded that we should split staticModule into staticModule and staticPackage to remove the ambiguity between packageless objects and packageless packages (more in the comments in the body of the commit). The motivation is verbosely outlined in the comments, but the bottom line is that Scala allows packages and packageless objects to have the same name within the same program. Therefore at times we need to disambiguate, hence the introduction of the staticPackage method. As of such staticModule no longer works for packages. In the same fashion staticPackage doesn't work for modules. This is done to ensure robustness of reification. I would like to do the same for getModule in Definitions, but we have to maintain backward compatibility. That's why I retained the old behavior, but replaced getModule invocations with getPackage where appropriate to be in line with staticModule and staticPackage. Another important thing that follows from the discussion is that both staticClass and staticModule prefer parent packages over parent objects in cases of ambiguity. Say, if we have the following snippet of code: object B { class C } next to package B { class C } then staticClass("B.C") will never even consider a C inside the object B. This is how scalac operates, so we decided to be consistent here. Finally reification logic got changed to distinguish between staticModule and staticPackage, and to allow for the fact that staticClass and staticModule prefer parent packages to parent objects.
* | | | SI-5949 updates documentation of staticClassEugene Burmako2012-07-201-0/+18
| |/ / |/| |
* | | Merge pull request #929 from scalamacros/ticket/5895Adriaan Moors2012-07-201-0/+3
|\ \ \ | | | | | | | | fixes field mirrors and also improves docs and exceptions for all mirrors
| * | | SI-5984 improves error reporting in JavaMirrorsEugene Burmako2012-07-191-0/+3
| |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | Factors out error raising code and introduces a special exception class for Scala reflection errors. Also adds membership sanity checks to reflectXXX. Previously reflectField, reflectMethod, reflectClass and reflectModule in InstanceMirror didn't check that the symbols being passed to them actually correspond to some member of the related class.
* | | Clean ups in impl.Futurephaller2012-07-192-13/+4
| | |
* | | Critical bugfixes/leak fixes/API corrections + ScalaDoc for SIP-14Viktor Klang2012-07-197-427/+66
| | |
* | | Removes Float.Epsilon and Double.EpsilonDominik Gruntz2012-07-192-6/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Float.Epsilon and Double.Epsilon contain the wrong value. Epsilon should be an upper bound on the relative error due to rounding errors in floating point arithmetic, i.e. it is 1/2 ULP (unit in the last position) which is 2^(-24) for Float and 2^(-53) for Double. This was discussed in detail in https://issues.scala-lang.org/browse/SI-3791 and it was decided to deprecate Epsilon for 2.9 and to remove it for 2.10 and to reintroduce it with the correct value for 2.11. See also the discussion (and comment from Martin) on https://groups.google.com/forum/?fromgroups#!topic/scala-internals/m763WjBdfyo
* | | Merge pull request #940 from axel22/issue/5937Adriaan Moors2012-07-181-10/+16
|\ \ \ | | | | | | | | SI-5937: Vector updated, +:, and :+ ignore provided builder, breaking type safety
| * | | Make field strict and private.Aleksandar Prokopec2012-07-181-1/+1
| | | |
| * | | Fix SI-5937.Aleksandar Prokopec2012-07-181-10/+16
| |/ /
* | | Merge pull request #938 from phaller/topic/scala-concurrent-deprecate-cleanupAdriaan Moors2012-07-1813-107/+23
|\ \ \ | |_|/ |/| | SI-6095, SI-6098 - clean up public API, add deprecations
| * | SI-6095, SI-6098 - clean up public API, add deprecationsphaller2012-07-1813-107/+23
| |/ | | | | | | | | | | | | | | | | | | | | Remove Scheduler, Cancellable, and Task trait. Hide impl.Promise object. Deprecate managedBlock methods in TaskRunners. Remove duplicate toBoxed method and pointless renaming import. Remove duplicate import of CanBuildFrom and Builder in Future. Organize imports in impl.Promise. Review by @axel22 and @heathermiller
* | Merge pull request #933 from scalamacros/ticket/5731Adriaan Moors2012-07-181-4/+4
|\ \ | | | | | | SI-5731 a few fixes for value classes
| * | SI-5731 a few fixes for value classesEugene Burmako2012-07-171-4/+4
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | I've faced two gotchas. First of all posterasure, which is supposed to erase ErasedValueType types, didn't look into ConstantType.value that is known to be smuggling types (hi Paul that's a plus one). Secondly ClassManifest.classType[T] assumed that its T is bound by AnyRef, which is not the case for value types. Here I had two choices: a) introduce a special method for manifests of value types, b) remove the upper bound of the type parameter and call it a day. Since manifests are already deprecated and there's no difference which method was used to create which manifest, I went for option b).
* / Fixes SI-5588. Correct compare for Enumeration.Hubert Plociniczak2012-07-171-2/+5
|/ | | | | | Slower than the original one but does comparison in the same spirit as IntOrdering. Review by @axel22.
* Merge pull request #902 from paulp/topic/name-implicitsAdriaan Moors2012-07-141-0/+3
|\ | | | | Implicits to encourage more Name-dropping.
| * Merge branch '2.10.x' into topic/name-implicitsPaul Phillips2012-07-1316-254/+268
| |\
| * | Implicits to encourage more Name-dropping.Paul Phillips2012-07-061-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This creates implicits in cakes across the land from: String => TermName String => TypeName And also from: Name => NameOps[Name] // lower priority TermName => NameOps[TermName] TypeName => NameOps[TypeName] What this is all about, using "drop" as a motivating example, is that these should all work: "abc" drop 1 // "bc": String ("abc": TermName) drop 1 // "bc": TermName ("abc": TypeName) drop 1 // "bc": TypeName (("abc": TypeName): Name) drop 1 // "bc": Name But this should not: ("bc": Name) // ambiguity error This requires drop not being directly on Name; peer implicits from String => TermName and String => TypeName; implicit classes to install drop on TermName and TypeName; and a lower priority implicit class to allow ops on Names. Review by @xeno.by .
* | | Changing to scala.concurrent.context. as namespace for the system properties ↵Viktor Klang2012-07-131-6/+5
| | | | | | | | | | | | for the global execution context
* | | Fixing oversight in propagating the runnable into the newly created thread.Viktor Klang2012-07-131-1/+1
| | |
* | | Squashed critical enhancements to SIP-14: daemonizing global EC, giving EC ↵Viktor Klang2012-07-1310-132/+110
| | | | | | | | | | | | to DelayedLazyVal, removing currentExecutionContext, removing impl.Future.isFutureThrowable, implementing asExecutionContext, giving a decent fallback if ForkJoinPool cannot be created
* | | fix Right,Left and Either scaladoc linksxuwei-k2012-07-133-11/+11
| | |