| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
| |
If an error occurs afer a Dynamic rewriting, augment the error message
with the rewritten tree and a hint to check the Dynamic method
signature.
|
|\
| |
| | |
Scala reflection now supports Java CRTP
|
| |
| |
| |
| | |
All javac-produced artifacts are now placed into test/files/lib
|
| |
| |
| |
| |
| | |
Enum members are static and, therefore, they need to be looked up in
classSymbol(<enum>).companionModule, rather than in classSymbol(<enum>).
|
| |
| |
| |
| |
| |
| |
| |
| | |
Because of using plain ExistentialType factory of a case class
typeToScala sometimes returned existentials with empty quantifieds.
Changing ExistentialType to newExistentialType, which simply returns
the underlying types if params are empty, fixed the problem.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Translation of Java types to Scala types has previously been
existentionalizing raw types of ParameterizedType arguments.
As shown in https://issues.scala-lang.org/browse/SI-6374
this leads to cyclic reference errors. If you wonder about the
mechanism of the error, take a look at the comments to the
aforementioned issue - there's a detailed explanation.
However calling rawToExistential is completely unnecessary, because
existential parameters of the results are immediately discarded,
and only prefix and symbol are used later on (which means that
existential extrapolation performed by rawToExistential also doesn't
after the result).
Finding out this was tough, but the rest was a piece of cake.
Getting rid of the call to rawToExistential when translating ParameterizedType
fixed the problem.
|
|\ \
| | |
| | | |
SI-5767 fix + protecting public FlatHashMap API
|
| | | |
|
|\ \ \
| | | |
| | | | |
Revert `@static` annotation
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
This reverts commit 892ee3df93a10ffe24fb11b37ad7c3a9cb93d5de with
exception of keeping `@static` annotation in the library so we
can deploy a new starr that does not depend on it before removing
it completely.
Conflicts:
src/compiler/scala/tools/nsc/backend/icode/GenICode.scala
src/compiler/scala/tools/nsc/backend/jvm/GenJVM.scala
src/compiler/scala/tools/nsc/transform/CleanUp.scala
|
| | | |
| | | |
| | | |
| | | | |
This reverts commit 227239018b38ab7218ee6b30493c9c8e1836c8c9.
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
This reverts commit 5a8dfad583b825158cf0abdae5d73a4a7f8cd997.
Conflicts:
src/compiler/scala/tools/nsc/backend/icode/GenICode.scala
|
| | | |
| | | |
| | | |
| | | | |
This reverts commit faa114e2fb6003031efa2cdd56a32a3c44aa71fb.
|
| | | |
| | | |
| | | |
| | | | |
This reverts commit 373f22a2022519ab894c1ea77460e6460d7c2ee4.
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
This reverts commit cb393fcbe35d0a871f23189d791b44be1b826ed2.
Conflicts:
src/compiler/scala/tools/nsc/backend/icode/GenICode.scala
|
|\ \ \ \
| | | | |
| | | | | |
SI-5692 better error message
|
| |/ / /
| | | |
| | | |
| | | |
| | | |
| | | | |
Doesn't fix the underlying issue with macros and type inference,
but at least now the error message says exactly what needs to be done
to make the error go away.
|
|/ / /
| | |
| | |
| | |
| | | |
FrontEnd => Reporter proxy now correctly redirects
flush and reset back to the underlying front end.
|
|\ \ \
| | | |
| | | | |
Fixed SI-6353: applyDynamic with sugared applications
|
| | |/
| |/|
| | |
| | |
| | |
| | |
| | | |
- Accept sugared applications such as x(1) if x implements Dynamic,
so x(1) gets re-written to x.apply(1).
- When picking a dynamic rewrite for x.apply(1), favor applyDynamic
instead of the default selectDynamic.
|
|\ \ \
| | | |
| | | | |
moves isImplicit from TermSymbol to Symbol
|
| | | |
| | | |
| | | |
| | | | |
Because classes can also be implicit.
|
|\ \ \ \
| | | | |
| | | | | |
Topic/empty array
|
| | |/ /
| |/| |
| | | |
| | | | |
This reverts most of commit 9d84e89d2 .
|
|\ \ \ \
| |/ / /
|/| | | |
SI-6336 Disallows value types in structuralal refinements
|
| | | |
| | | |
| | | |
| | | |
| | | | |
Structural refinements already have a number of restrictions, e.g. cannot refer to
type parameters of enclosing classes. We need to disallow value classes as well.
|
|\ \ \ \
| |_|/ /
|/| | | |
test suite for SI-6329
|
| | | | |
|
| |/ /
|/| |
| | |
| | |
| | | |
Except for one thingie: java enums are currently not understood
by Scala reflection, hence they aren't yet supported in annotations.
|
|\ \ \
| | | |
| | | | |
cleaning up reflection
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
1) parseExpr => parse
2) runExpr => eval
3) Introduces compile(Tree): () => Any, since it has frequent uses
|
|\ \ \ \
| | | | |
| | | | | |
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.
|
|\ \ \ \ \
| | | | | |
| | | | | | |
Fix for SI-6245 with workaround for SI-2296.
|
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | | |
protected/super accessor issue: Don't subvert the creation of the
standard protected accessor with the java interop accessor. For
SI-2296, the compiler emits an error instead of causing an illegal
access error at runtime.
|
|\ \ \ \ \ \
| |_|_|/ / /
|/| | | | | |
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.
|
|\ \ \ \ \
| | | | | |
| | | | | | |
SI-6331 deconst If type / refine equality of floating point Constant types.
|
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | | |
For the examples I've constructed, they are consistent, but
I put this down to good luck, rather than good management.
The next commit will address this.
|
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | | |
The constant types for 0d and -0d should not be equal.
This is implemented by checking equality of the result of
doubleToRawLongBits / floatToRawIntBits, which also correctly
considers two NaNs of the same flavour to be equal.
Followup to SI-6331.
|
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | | |
The fast path in typedIf added in 8552740b avoided lubbing the if/else branch types
if they are identical, but this fails to deconst the type. This could lead to the entire
if expression being replaced by a constant.
Also introduces a new tool in partest for nicer checkfiles.
// in Test.scala
trace(if (t) -0d else 0d)
// in Test.check
trace> if (Test.this.t)
-0.0
else
0.0
res: Double = -0.0
|
|\ \ \ \ \ \
| | | | | | |
| | | | | | | |
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.
|
|\ \ \ \ \ \
| | | | | | |
| | | | | | | |
improvements for type tags
|
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | | |
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.
|
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | | |
Free types are no longer acceptable in normal type tags.
Like type parameters or abstract type members they don't map on any real type,
therefore I think this is a justified change.
The main reason for doing is this is to prohibit people from using `typeOf`
on local classes. Sure, the guard introduced in the previous commit will raise
runtime errors about that, but this commit provides static checking.
Those especially persistent might use `absTypeOf` and then try to play around
with the weak type it returns, but that's advanced usage scenario, and I don't
worry much about it.
Bottom line: `typeOf` should just work.
Things that work with additional effort should be explicitly marked as such.
|
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | | |
One of the use cases for free types is reification of local classes.
The result is very seamless. Despite that local classes are not pickled,
free types recreated the symbols referenced by local classes, so that we
get our own symbol table, which can be analyzed with usual precision of
pickled symbols and types.
However when we try to use those symbols for reflection, we hit a problem.
Scala runtime reflection uses its own mechanism for dealing with non-pickled
types, which is incompatible with mini symbol tables used in free types.
Therefore to prevent confusion, I prohibit using those symbols for reflection.
|
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | | |
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.
|
|\ \ \ \ \ \ \
| |/ / / / / /
|/| | | | | | |
Fix for SI-6340, error message regression.
|