| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
| |
Reverts this line: 9c09c17#L50L671. That value was
apparantly discarded intentionally.
|
|\
| |
| | |
Resolving new merge conflicts between #1844 and master.
|
| |\
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
* commit 'refs/pull/1844/head':
macroExpandAll is now triggered by typed
SI-5923 adapt macros when they are deferred
generalizes macroExpand
typedPrimaryConstrBody now returns supercall
more precise errors for macros
parentTypes => typedParentTypes
changes isTermMacro checks to something more universal
fixes printing of AppliedTypeTree
adds Trees.replace(Tree, Tree)
makes macro override error more consistent
refactors handling of macros in repl
SI-5903 extractor macros do work
adds c.macroRole
Conflicts:
src/compiler/scala/tools/nsc/typechecker/Macros.scala
src/compiler/scala/tools/nsc/typechecker/Typers.scala
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
Previously delayed macro expansions (the sole purpose of macroExpandAll)
were triggered by `typedArgs`. Probably I wanted to save CPU cycles on
not checking whether we have pending macro expansions on every iteration
of typecheck.
However this optimization is uncalled for, because the check just entails
reading a var, therefore benefits of the current approach are negliible,
whereas the robustness hit is tangible.
After delayed macro expansion mechanism became more robust, it exposed
a bug, well-hidden before. If one first delays a macro and then finds out
that the expandee is erroneous, subsequent `macroExpandAll` will crash,
because it expects a macro runtime attachment to be present. Previously
the erroneous code path never got triggered, because the macro expansion
never commenced. Luckily the fix was easy.
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
Amazingly enough, the fix for the "macro not expanded" problem was super
easy. (And I remember spending a day or two trying to find a quick fix
somewhen around Scala Days 2012!)
The problem was in the implementation of the macro expansion trigger,
which was buried in a chain of if-elif-elif. This meant that macro
expansion was mutually exclusive with a lot of important adaptations, e.g.
with `instantiate`.
More precisely, if an expandee contains an undetparam, its expansion
should be delayed until all its undetparams are inferred and then retried
later. Sometimes such inference can only happen upon a call to instantiate
in one of the elif's coming after the macro expansion elif. However this
elif would never be called for expandees, because control flow would always
enter the macro expansion branch preceding the inference branch.
Consequences of this fix are vast. First of all, we can get rid of the
"type parameter must be specified" hack. Secondly and most importantly,
we can now remove the `materializeImplicit` method from Implicits and
rely on implicit macros to materialize tags for us. (This is a tricky
change, and I'll do it later after we merge as much of my pending work
as possible). Finally, we learn that the current scheme of interaction
between macros, type inference and implicits is, in principle, sound!
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
Changes macroExpand to accommodate expansion schemes different from the
currently supported one.
As a bonus, which follows clarification of the macro expansion logic,
this refactoring fixes suppression of macro expansions, which
previously didn't work with delayed expansion.
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
Previously this method returned the entire block with supercall being
potentially wrapped in early defs.
However when implementing type macros, I found it more convenient to have
typedPrimaryConstrBody to only return the supercall itself. This doesn't
make any difference for our current codebase, since the only time anyone
cares about the return value, it's only to inspect its tpe.
Therefore I'm submitting this patch in a preparatory pull request to
reduce the surface of changes in the upcoming type macros pull request.
|
| | | |
|
| | |
| | |
| | |
| | |
| | | |
I felt really uncomfortable having to stare at `parentTypes`, when
everyone else in Typers.scala is named typedSomething.
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
Previously I wanted to be as precise as possible, but as the experience
with type macros shows, a lot of isTermMacro checks should also extend
to include type macros.
Therefore I'm changing the checks to isMacro. This doesn't make any
difference for existing code, but will reduce the amount of changes
in the upcoming type macro pull request.
|
| | | |
|
| | |
| | |
| | |
| | |
| | | |
Currently dead code. Has proven to be useful to implement type macros,
therefore I'm moving it to scala.reflect.internal.Trees.
|
| | | |
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
Macros now have a dedicated member handler, so that the logic of their
processing doesn't get mixed up with vanilla DefHandler.
I've also factored out an abstract MacroHandler to provides a basis
to build the upcoming type macro handler upon.
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
Apparently it is already possible to use macros to customize pattern
matching as described in the comments to the aforementioned JIRA issue.
What's even better - with the incoming addition of c.introduceTopLevel
it becomes possible to generate arbitrarily complex unappliers, even
with heterogeneous types of arguments varying from expansion to expansion
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
Currently there's only one flavor of macros - def macros, and the plan
was to gradually introduce additional flavors, such as type macros and
macro annotations.
However as shown by the experience with type macros, it makes sense
to distinguish subflavors of macros that tell us in which context the
macro gets expanded. For def macros we have the only role - expansion
of an application. But for type macros there are multiple.
|
|\ \ \
| | | |
| | | | |
sbt-git-plugin has moved.
|
| | | |
| | | |
| | | |
| | | |
| | | | |
We need to eliminate these sort of shifting sands to make
the SBT build a viable option.
|
|\ \ \ \
| |_|/ /
|/| | | |
SI-6641 Cull scala.swing.SwingWorker
|
| |/ /
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
It appears to do nothing much at all, refers to the now-deprecated
scala.actor package, and has a name clash with an important class
from java.swing.
Note that the POM for scala-swing does not declare the dependency.
The final nail in the coffin is it aides and abets the crash in
the crash in SI-6440.
Attempts to remove or even deprecate this in 2.10.0 were
missed the boat.
This commit removes them for 2.11.0, in contravention of
the deprecation policy. Given that they rely on the
scala-actors module which _is_ deprecated in 2.10.0,
and will likely be removed in 2.11.0, I contend that
this is a reasonable exception.
Actor.scala
|
|\ \ \
| | | |
| | | | |
Made "mode" into a value class.
|
| | |/
| |/|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
This is an obvious place to apply value class goodness and
collect some safety/sanity in typing modes. It does show off
a challenge in introducing value classes without disruption:
there's no way to deprecate the old signature of 'typed',
'adapt', etc. because they erase the same.
class Bippy(val x: Int) extends AnyVal
class A {
@deprecated("Use a bippy") def f(x: Int): Int = 5
def f(x: Bippy): Int = x.x
}
./a.scala:5: error: double definition:
method f:(x: Bippy)Int and
method f:(x: Int)Int at line 4
have same type after erasure: (x: Int)Int
An Int => Mode implicit handles most uses, but nothing can
be done to avoid breaking anything which e.g. extends Typer
and overrides typed.
|
|\ \ \
| | | |
| | | | |
Moved repl javap tests into pending.
|
|/ / /
| | |
| | |
| | | |
For not passing on java6.
|
|\ \ \
| | | |
| | | | |
a painstaking examination of Variance
|
| | | | |
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
As the comment says:
Not enough to look for abstract types; have to recursively check
the bounds of each abstract type for more abstract types. Almost
certainly there are other exploitable type soundness bugs which
can be seen by bounding a type parameter by an abstract type which
itself is bounded by an abstract type.
SPECIAL: BUY ONE UNSOUNDNESS, GET ONE FREE
In refinement types, only the first parameter list of methods
was being analyzed for unsound uses of abstract types. Second
parameter list and beyond had free unsoundness reign. That bug
as well is fixed here.
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
This wasn't as bad as it could have been. All these changes
plug soundness holes in trunk. Mostly we're looking at type
aliases which were merely protected when they had to be
protected[this] not to allow unsound variance crossover.
|
| | | | |
|
| | | | |
|
| | | |
| | | |
| | | |
| | | | |
It had repeated all the TypeMap logic. I made it a TypeMap.
|
| | | | |
|
| | | |
| | | |
| | | |
| | | | |
It's strictly based on the symbol, not the type.
|
| | | | |
|
| | | |
| | | |
| | | |
| | | |
| | | | |
Made variance tracking a constructor parameter to TypeMap.
Eliminated more variance duplication.
|
| | | | |
|
| | | | |
|
| | | |
| | | |
| | | |
| | | | |
So I can centralize all the redundant variance code.
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
The variance code in Refchecks is 75+% redundant with
our eventually canonical variance traversing code now in
Variances, but as usual it is time consuming to stamp out
this damaging redundancy so for the moment I am simply
moving it into close proximity with def variancesInType
to abet future work.
|
| | | |
| | | |
| | | |
| | | |
| | | | |
No one will ever know what it took for me to refine
Variances into its current condition. A LONELY QUEST.
|
| |/ /
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
This will be instead of passing numbers like -1 and 1 around,
also instead of a variety of named constants like AnyVariance
and CoVariance, and also instead of sometimes using the flags
Flag.COVARIANT and Flag.CONTRAVARIANT for things.
1, 2, 3, go-type-safety-rah!
|
|\ \ \
| |/ /
|/| | |
Repl javap decodes various synthetic names for us (fixing SI-6894)
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
For instance, javap -app Test is equivalent to javap Test$delayedInit$App
with the correct line and iw prepended. This works by taking Test as a
name in scope, translating that, and then supplying the suffix.
Then javap -fun Test shows Test$$anonfun*, and for member m,
javap -fun Test#m shows Test$$anonfun$$m*.
This also works for classes and values defined in the repl.
javap -fun -raw m shows $line3.$read$$iw$$iw$$anonfun$m$1.
E.g., javap -fun scala.Enumeration obviates knowing or guessing
scala/Enumeration$$anonfun$scala$Enumeration$$populateNameMap$1.class.
Also, scala> :javap -fun scala.Array#concat
but still to do is using imported syms.
Both files and replout are supported for searching for artifacts.
The trigger is detecting the synthetic name (has an interior dollar).
Still to do, filter the output on Test#m to show only m.
Need a way to explore the list of artifacts; ideally, related symbols
would be available reflectively.
Prefer companion class to object, otherwise it's not showable;
for object, require dollar when both exist.
A JavapTest is supplied that is a ReplTest that asserts something about
its output instead of printing it.
|
|\ \ \
| |_|/
|/| | |
Merge 2.10.x
|
|/| |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
Patches applied:
- rename of `dropRepeatedParamType` to `dropIllegalStarTypes` -- required since 8886d22cd6
- fixed test/files/neg/t6406-regextract.flags -- how could this have worked before?
Conflicts:
src/compiler/scala/tools/nsc/interpreter/TypeStrings.scala
src/library/scala/collection/LinearSeqOptimized.scala
src/library/scala/util/Properties.scala
test/files/run/streams.check
test/files/run/streams.scala
|
| |\ \
| | | |
| | | | |
SI-6915 Updates copyright properties to 2002-2013
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
The .scala header files had the right copyright dates
but properties used to generate the information in
e.g. "scala -version" hadn't been updated.
review @adriaanm
|
| |\ \ \
| | | | |
| | | | | |
Backport 1821
|
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
the manifests for Any, Object/AnyRef, AnyVal, Null and Nothing
now have their `newArray` methods overridden to avoid reflective overhead
of array instantiation.
(backport of 45ef0514e, part 2)
|
| | | | |
| | | | |
| | | | |
| | | | | |
(backport of 45ef0514e, part 1)
|