| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This test is necessary in the API to tell apart useful synthetic symbols
(such as accessors) and low-level compilation artifacts (such as $outer).
However `isHidden` (as it's currently named in the compiler) is too generic.
Hence I renamed it along with the corresponding flag. Now the test says
`isArtifact` and the flag is named ARTIFACT.
Despite being an improvement over the first version, `isArtifact` is
still a bit unlucky. The name I like is `isImplementationArtifact`, but that's
a mouthful to be used in compiler hacking. Moreover, IMPLEMENTATION_ARTIFACT
looks weird.
For a discussion about related stuff see:
http://groups.google.com/group/scala-internals/browse_thread/thread/d04e762127737968
https://github.com/scala/scala/pull/1114
|
|\
| |
| | |
fixes to existential-related reification problems
|
| | |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
When reifying certain trees/types reifier might decide that it needs to
introduce auxiliary symbols to represent non-locatable components of types
For example, when reifying a refined type we need to reify the symbols
that correspond to its members (aka RefinedType.decls). Since these symbols
are not stored in pickles, we can't do the usual staticClass(scala.Int) stuff,
and are forced to actually create corresponding symbols inside the reificode
(by "create" I mean literally create, by using newXXXSymbol methods).
It looks like a generally good idea to not only create those symbols naked,
but to also export their type signatures and annotations. However this brings
problems with type inference.
Say, a type of a method A depends on a type tag. To get a type of a type tag,
the compiler needs to expand the corresponding macro (when the macro is being
expanded, symbol A is marked as LOCKED). While reification macro expands,
it might want to reify certain symbol definitions (as explained above). If one
of these definitions is a class that contains method A, we're in trouble,
since reifying the corresponding ClassInfoType will eventually call A.info,
which will produce a cyclic reference error, because A is LOCKED.
An obvious solution is to check whether a reified symbol definition is locked.
If the symbol is locked, then the reifier bails (e.g. by reifying NoType
instead of the actual type signature of the symbol).
Being obvious this solution is also incorrect as illustrated by SI-6204.
Sure we can check whether a symbol itself is locked, but we cannot check
whether or not we reify someone who refers to the locked symbol.
As of such I'm telling the reifier to bail whenever it needs to reify a symbol
definition for a symbol that is not yet complete. Therefore reification
can no longer cause inference of method result types, which eliminates the
underlying problem.
This is a harsh measure, but taking into account that we have an RC planned
within a week, stability trumps completeness.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Unlike module classes that are going to be pickled (which are reified
as `<their module reification>.moduleClass), module classes of
local modules need to be reified as symbol defs.
Otherwise we get a stack overflow:
1) Local modules are deemed to be free terms,
2) All free symbols are reified together with their type signature (so that they
can be a) inspected by anyone interested, b) compiled at runtime),
3) Reifying a type signature of a module involves reifying its module class,
4) Reifying a module class involves reifying a module and calling its module class,
<ad infinitum>
This stack overflow doesn't happen for locatable modules, because they don't need
to have their type signatures reified (these signatures can later be loaded from
pickles if it becomes necessary).
|
| |
| |
| |
| |
| |
| | |
It seems that this.type doesn't cut it for stuff declared in a trait.
Downgrading this.type to Symbol and Type correspondingly in
SymbolContextApi and TreeContextApi.
|
|\ \
| | |
| | | |
Allow skipping the xz archives
|
| | |
| | |
| | |
| | | |
Using 'ant -Darchives.skipxz=true'
|
|\ \ \
| | | |
| | | | |
Moved inline logic before pickler.
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
The test case failed due to separate compilation. The problem was
that we don't pickle the fact that the field was made public.
Original patch by @odersky. Cleaned up by me. Changes I made:
* removed stale test-case
* reduced whitespace changes
Supersedes #1089.
Review by @odersky and @moors.
|
|\ \ \ \
| | | | |
| | | | | |
SI-5739 (bis) vals for subpatterns when -g:patmatvars
|
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
To facilitate debugging pattern matches, we store the values for
sub-patterns of extractor (synthetic or user-defined) patterns in local variables.
When performing an optimized build, and when possible, we don't do store but inline them directly.
For soundness, SI-5158, SI-6070, we must always store the values of mutable case class fields.
(Specifying -optimize is the only way to suppress emitting these local variables.
An unoptimized build will always generate them, which was deemed the right default during the meeting.)
(updated flags for t4425 to get consistent runs on optimized and non-optimized partest runs
by always passing -optimize)
|
|\ \ \ \ \
| | | | | |
| | | | | | |
SI-6205 make pt fully defined before inferTypedPattern
|
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | | |
refines my fix for SI-2038 (#981) by making pt fully defined before calling inferTypedPattern,
instead of making the result of inferTypedPattern fully defined
I finally realized my mistake by diffing the -Ytyper-debug output of compiling the variants with:
```
x match {case Holder(k: A[kt]) => (k: A[kt])}
```
and
```
(x: Any) match {case Holder(k: A[kt]) => (k: A[kt])}
```
|
|\ \ \ \ \ \
| |_|_|/ / /
|/| | | | | |
SI-6145 lax typing of args to synthetic case-labels
|
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | | |
Use wildcard for the expected type of the arguments of a jump to a label
synthesized by the pattern matcher... except during erasure: we must take the
expected type into account as it drives the insertion of casts!
It's ok since we're typing the translation of well-typed code. The only "type
errors" we catch are skolem mismatches. (after erasure the existential types that
before caused problems have disappeared.)
It's necessary to balance GADT magic, SI-6145, CPS type-driven transforms and
other existential trickiness. I've exhausted all other semi-clean approaches I
could think of:
- the right thing to do -- packing existential types -- runs into limitations
in subtyping existential types,
- casting breaks SI-6145 (and it's an unnecessary cast at run time),
- not casting breaks GADT typing as it requires sneaking ill-typed trees
past typer
|
|\ \ \ \ \ \
| | | | | | |
| | | | | | | |
Fixes SI-5687.
|
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | | |
Recover from erroneous type alias override to report
more useful error message.
|
|\ \ \ \ \ \ \
| | | | | | | |
| | | | | | | | |
SI-6183 don't crash on type error in outer test
|
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | | |
unfortunately without test case since the report was hard to minimize
since it was a crash on erroneous code, I figured a backstop against a crash should suffice
|
|\ \ \ \ \ \ \ \
| |_|_|_|/ / / /
|/| | | | | | | |
Bases futures on Try instead of Either
|
| | | | | | | | |
|
| | | | | | | | |
|
| | | | | | | | |
|
| |\ \ \ \ \ \ \
| | | | | | | | |
| | | | | | | | |
| | | | | | | | | |
into try-based-futures
|
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | | |
Enables important abstractions to be built on top of futures,
such as Twitter's "Local" for handling data local to a callback chain.
|
| |/ / / / / / /
| | | | | | | |
| | | | | | | |
| | | | | | | | |
Also swaps the arguments to method transform on Try, so as to mirror transform on scala.concurrent.Future.
|
| | | | | | | | |
|
|\ \ \ \ \ \ \ \
| | | | | | | | |
| | | | | | | | | |
reflection now correctly supports inner classes and modules
|
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | | |
Our name mangling scheme w.r.t stuff nested into objects conflicts
with JVM's ideas of beauty, which messes up getDeclaredClasses.
Scala reflection needs getDeclaredClasses to convert between Scala and Java,
so the situation looked grim. Greg suggested a workaround described in:
https://issues.scala-lang.org/browse/SI-4023?focusedCommentId=54759#comment-54759.
Luckily the workaround worked!
|
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | | |
As per referenced issue, this patch implements `instance`
for ModuleMirrors corresponding to nested and inner modules.
|
|\ \ \ \ \ \ \ \ \
| |_|_|_|_|_|/ / /
|/| | | | | | | | |
SI-6040 error on unauthorized extension Dynamic
|
| | |_|/ / / / /
| |/| | | | | |
| | | | | | | |
| | | | | | | | |
authorization is easy to get: `import language.dynamics`
|
|\ \ \ \ \ \ \ \
| | | | | | | | |
| | | | | | | | | |
updating resolveDups() to use MethodTFA.mutatingInterpret()
|
| | |_|_|/ / / /
| |/| | | | | | |
|
|\ \ \ \ \ \ \ \
| | | | | | | | |
| | | | | | | | | |
SI-5933 do the new patmat translation for scaladoc …
|
| | | | | | | | | |
|
| | |_|/ / / / /
| |/| | | | | |
| | | | | | | |
| | | | | | | | |
especially because it benefits from nicer type inference for partial functions
|
|\ \ \ \ \ \ \ \
| | | | | | | | |
| | | | | | | | | |
Enable inlining in constructors.
|
| |/ / / / / / /
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | | |
Inlining in constructors has been disabled a long
time ago due to some VerifyErrors. Unfortunately,
@dragos cannot recall what exactly was the problem.
I tried to enable inlining in constructors and I
didn't see any problem.
`Predef.assert` calls in class constructors are one
of the biggest contributors to closure allocation
in a compiler so we better off get rid of it.
Added a test-case that checks if inlining in
constructors works properly.
Review by @magarciaEPFL and @paulp.
|
|\ \ \ \ \ \ \ \
| |_|_|_|_|_|_|/
|/| | | | | | | |
SI-6186 TypeTags no longer supported in macros
|
| |/ / / / / /
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | | |
The original idea was to support both both TypeTags and ConcreteTypeTags as
context bounds on macro implementations.
Back then TypeTags were the implied default flavor of type tags. Basically
because "TypeTag" is shorter than "ConcreteTypeTag" everyone jumped onto
them and used them everywhere.
That led to problems, because at that time TypeTags could reify unresolved type
parameters ("unresolved" = not having TypeTag annotations for them). This
led to a series of creepy errors, when one forgets to add a context bound
in the middle of a chain of methods that all pass a type tag around, and then
suddenly all the tags turn into pumpkins (because that unlucky method just
reifies TypeRef(NoPrefix, <type parameter symbol>, Nil and passes it down
the chain).
Hence we decided to rename ConcreteTypeTag => TypeTag & TypeTag => AbsTypeTag,
which makes a lot of sense from a reflection point of view.
Unfortunately this broke macros (in a sense), because now everyone writes
TypeTag context bounds on macro implementations, which breaks in trivial
situations like: "def foo[T](x: T) = identity_macro(x)" (the type of x
is not concrete, so macro expansion will emit an error when trying to
materialize the corresponding TypeTag).
Now we restore the broken balance by banning TypeTag from macro impls.
This forces anyone to use AbsTypeTags, and if someone wants to check the input
for presence of abstract types, it's possible to do that manually.
|
|\ \ \ \ \ \ \
| |/ / / / / /
|/| | | | | | |
Removes AnyRef specialization from library
|
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | | |
As discussed in #999, #1025 and
https://groups.google.com/forum/?hl=en&fromgroups#!topic/scala-internals/5P5TS9ZWe_w
instrumented.jar is generated from the current source, there's no need
for a bootstrap commit.
Review by @paulp.
|
|\ \ \ \ \ \ \
| | | | | | | |
| | | | | | | | |
Makes all private variables accessed from an @inline method non-private.
|
| | |_|/ / / /
| |/| | | | |
| | | | | | |
| | | | | | | |
inlining across classes requires that accessed variables from @inline methods are not private.
|
|\ \ \ \ \ \ \
| | | | | | | |
| | | | | | | | |
Ultimate reflection pull request #2
|
| | | | | | | | |
|
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | | |
Since Scala reflection relies on Java reflection to perform member invocations,
it inherits some of the quirks of the underlying platform.
One of such quirks is returning null when invoking a void-returning method.
This is now fixed by introducing a check after calling invoke.
|
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | | |
Previously `checkMemberOf` was blocking base fields and methods
that are overriden in receiver.getClass. Now this is fixed.
The fix also uncovered an issue with field mirrors. Currently
their `get` and `set` methods don't respect overriding and always
return field values from a base class.
After discussing this on a reflection meeting, we decided that this
behavior is desirable and that for overriding people should use
reflectMethod and then apply on getters/setters. See the discussion at:
https://github.com/scala/scala/pull/1054.
|