| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This deprecates unapplySeq(Any) and adds overloaded
unapplySeq(CharSequence) and unapplySeq(Match), with the
putative advantage that you can't try to extract the unextractable.
Regex is massaged so that the underlying Pattern is primary,
rather than the String-valued expression. Regex and its
unanchored companion (I almost wrote unmoored) share a
Pattern object, so that unapplySeq(Match) can easily test
whether the Match was generated by this Regex; in that case,
the match result is used immediately, instead of reapplying
the regex to the matched string.
The documentation is massaged to reflect unanchored and also to
align with the underlying terminology, e.g., "subgroup" really
just means "group."
|
|\
| |
| | |
Fix for SI-6305 & new actor migration tests
|
| | |
|
| | |
|
|\ \
| |/
|/|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
* origin/2.10.x: (68 commits)
Eliminate breaking relative names in source.
"Hot fix" for broken build.
Fix SI-4813 - Clone doesn't work on LinkedList.
Made 'def clone()' consistent with parens everywhere.
accommodates pull request feedback
SI-6310 redeploys the starr
SI-6310 AbsTypeTag => WeakTypeTag
SI-6323 outlaws free types from TypeTag
SI-6323 prohibits reflection against free types
improvements for reification of free symbols
removes build.newFreeExistential
SI-6359 Deep prohibition of templates in value class
Fixes SI-6259. Unable to use typeOf in super call of top-level object.
Fixes binary repo push for new typesafe repo layouts.
Better error message for pattern arity errors.
Rescued TreeBuilder from the parser.
Pending test for SI-3943
Test case for a bug fixed in M7.
Fix for SI-6367, exponential time in inference.
SI-6306 Remove incorrect eta-expansion optimization in Uncurry
...
Conflicts:
src/compiler/scala/tools/nsc/transform/AddInterfaces.scala
src/compiler/scala/tools/nsc/transform/SpecializeTypes.scala
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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.
|
| | | | | |
|
| |\ \ \ \
| | | | | |
| | | | | | |
SI-6359 Deep prohibition of templates in value class
|
| | |/ / /
| | | | |
| | | | |
| | | | | |
This seems to have been the intent of 95d532 / SI-5882.
|
| | |/ /
| |/| |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
This works around the issue of the inability to use classOf for top-level object classes by inventing a new
anonymous class and instantiating it just to grab its class. Since the class is a nested type of the
top-level object it'll be in the same classloader unless some kind of evil behavior is afoot.
This patch should be undone if ever SI-2453 ever gets fixed, or we wind up with a direct way to grab
the class of an object.
|
| |\ \ \
| | | | |
| | | | | |
Fix for SI-6367, exponential time in inference.
|
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
This pathology is not new - it can be witnessed in 2.9,
where compiling the test case enclosed with this ticket with
-Yinfer-debug will print a line with (pinky to lips) one million
type parameters. 1048576 actually, aka 2^20. But in 2.9 we were
somehow getting away with creating the list, presumably by not
spending much time looking at it. Somewhere between there and M1,
that changed.
I cut it off at the knees - don't create a list of one million
upper bound constraints when 1 will suffice. It would not be too
surprising if this proves to be a boon for performance.
|
| |\ \ \ \
| | | | | |
| | | | | | |
210 errors and trees
|
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | | |
Because friends don't tell friends:
"wrong number of arguments for <none>"
|
| | | | | | |
|
| |\ \ \ \ \
| | |/ / / /
| |/| | | | |
Fix SI-6306 on testcase
|
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | | |
Fix SI-6306 by removing the offending code. Moreover, clarify comment
and add testcase.
This pattern match only matches on testcases triggering SI-6306; the
transformation it performs in that case is unsafe.
The intended optimization is to undo eta-expansion of nullary functions,
that is, transform `() => foo()` to `foo`. But that's only valid when
`foo` is an instance of `Function0`, so the optimization is unsafe.
Moreover, the pattern match will fail because at the end of typer that
code has become `() => foo.apply()`, and `isExprSafeToInline(foo.apply)`
always (correctly) fails the isExprSafeToInline test. The pattern match
should thus be different - this code was dead even when it was
introduced (45bcd02f6ba099277bedbf83ec2bda07435c7797), since it was not
invoked either when building the compiler or when compiling function
attempt2() in the included testcase.
Thanks to all commenters on SI-6306 and
https://github.com/scala/scala/pull/1255, in particular to Jason Zaugg
for diagnosing the underlying fault and Lukas Rytz for understanding the
goal of the code.
|
| |\ \ \ \ \
| | | | | | |
| | | | | | | |
Fix t6114 - ++ on JList wrapper modifies underlying collection.
|
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | | |
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?
|
| |\ \ \ \ \ \
| | | |_|/ / /
| | |/| | | | |
|
| | | |_|/ /
| | |/| | |
| | | | | |
| | | | | | |
Followup to SI-6276.
|
| | |\ \ \ \
| | | | | | |
| | | | | | | |
fix usage of Duration in Promise impl
|
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | | |
- 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
|
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | | |
- 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
|
| | |\ \ \ \ \
| | | | | | | |
| | | | | | | | |
Topic/inliner logging
|
| | | |\ \ \ \ \
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | | |
Conflicts:
src/compiler/scala/tools/nsc/backend/icode/GenICode.scala
|
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | | |
Quieted down many logging statements which contribute
disproportionate noise. Made others emit something more sensible.
Spent lots of time on the inliner trying to find a regular
format to make the logs more readable. Long way to go here but
it'd be so worth it to have readable logs instead of mind-numbing
indiscriminate text dumps.
|
| | |\ \ \ \ \ \ \
| | | | | | | | | |
| | | | | | | | | | |
Disable test t2868
|
| | | | |/ / / / /
| | | |/| | | | |
| | | | | | | | |
| | | | | | | | | |
it keeps failing randomly, e.g. http://scala-webapps.epfl.ch/artifacts/e3b0c7abbf637dacce7bcd7b69d5655820e8e714/buildLog.txt
|
| | |\ \ \ \ \ \ \
| | | |/ / / / / /
| | |/| | | | | | |
Fixes SI-6271 - Missing isEmpty override for views.
|
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | | |
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.
|
| | |\ \ \ \ \ \ \
| | | | | | | | | |
| | | | | | | | | | |
SI-6335 More precise location of the implicit class synthetic method.
|
| | | | | | | | | | |
|
| | | | |_|_|_|_|/
| | | |/| | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | | |
One approach would be to disallow an implicit class in a template
that already has a member with the same name.
But this commit doesn't do this; instead it uses `isSynthetic` to
find the synthesized implicit conversion method from the potentially
overloaded alternatives.
|
| | |\ \ \ \ \ \ \
| | | | | | | | | |
| | | | | | | | | | |
SI-6162 Adds private[scala] @deprecatedInheritance/@deprecatedOverriding
|
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | | |
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
|
| | | |/ / / / / /
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | | |
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.
|
| | |\ \ \ \ \ \ \
| | | |_|_|_|_|/ /
| | |/| | | | | | |
SI-6276 Warn on def or val that trivially loops infinitely
|