| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
| |
Removes the stubs left out to appease the old starr, fixes macro tests.
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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]].
|
|
|
|
|
|
|
| |
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)).
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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).
|
|\
| |
| | |
ClassTag.Nothing now throws an exception
|
| |
| |
| |
| |
| | |
Nothing is a bottom type, so it doesn't make much sense for it to have
a meaningful erasure (ClassTag.Nothing.runtimeClass).
|
|\ \
| |/
|/| |
IDE improvements, with particular focus on making worksheets work.
|
| |
| |
| |
| | |
Debug changes
|
| |
| |
| |
| | |
Adds a raw string interpolator raw"..." which does not do any escape sequence processing.
|
| |
| |
| |
| | |
This pretty much takes us down to deprecation and inliner warnings.
|
| |
| |
| |
| |
| |
| |
| |
| | |
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.
|
| | |
|
|\ \
| | |
| | | |
SI-6075 cleans up api.StandardNames
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
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.
|
|\ \ \
| |/ /
|/| | |
SI-6117 regression involving import ambiguity.
|
| |/
| |
| |
| | |
"If the names don't fit, do not commit!"
|
|\ \
| | |
| | | |
[doc] Fix example of `Ordering.on` usage.
|
| |/ |
|
|/
|
|
|
| |
* 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
|
|\
| |
| | |
Implement @static annotation on singleton object fields.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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.
|
|\ \
| | |
| | | |
SIP-14 - Fix critical Java compatibility issue in scala.concurrent.Await
|
| | |
| | |
| | |
| | | |
Patch contributed by @viktorklang
|
|\ \ \
| | | |
| | | | |
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
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
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.
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
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.
|
| |/ /
|/| | |
|
|\ \ \
| | | |
| | | | |
fixes field mirrors and also improves docs and exceptions for all mirrors
|
| |/ /
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
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.
|
| | | |
|
| | | |
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
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
|
|\ \ \
| | | |
| | | | |
SI-5937: Vector updated, +:, and :+ ignore provided builder, breaking type safety
|
| | | | |
|
| |/ / |
|
|\ \ \
| |_|/
|/| | |
SI-6095, SI-6098 - clean up public API, add deprecations
|
| |/
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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
|
|\ \
| | |
| | | |
SI-5731 a few fixes for value classes
|
| |/
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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).
|
|/
|
|
|
|
| |
Slower than the original one but does comparison in the same spirit as IntOrdering.
Review by @axel22.
|
|\
| |
| | |
Implicits to encourage more Name-dropping.
|
| |\ |
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
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 .
|
| | |
| | |
| | |
| | | |
for the global execution context
|
| | | |
|
| | |
| | |
| | |
| | | |
to DelayedLazyVal, removing currentExecutionContext, removing impl.Future.isFutureThrowable, implementing asExecutionContext, giving a decent fallback if ForkJoinPool cannot be created
|
| | | |
|