| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
| |
We were leaking untyped trees out of the macro, which crashed
in refchecks.
This commit proactively typechecks the tree returned by `mkZero`.
|
|
|
|
| |
E.g. type param, abstrat type.
|
| |
|
|\
| |
| |
| |
| |
| |
| | |
Conflicts:
src/main/scala/scala/async/internal/AnfTransform.scala
src/main/scala/scala/async/internal/AsyncTransform.scala
src/test/scala/scala/async/run/toughtype/ToughType.scala
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
`TreeGen#mkZero` returns `q"null"` for derived value classes.
```
scala> class V(val a: String) extends AnyVal
defined class V
scala> showRaw(gen.mkZero(typeOf[V]))
res0: String = Literal(Constant(null))
```
We use this API in async to generate the initial value for
ANF-lifted temporary variables.
However, this leads to NPEs, as after posterasure, we call the
unbox method on a null reference:
```
% cat sandbox/Macro.scala; scalac-hash v2.10.4 sandbox/Macro.scala; scala-hash v2.10.4 -e 'val x = Macros.myMacro'
import scala.reflect.macros.Context
import scala.language.experimental.macros
object Macros {
def macroImpl(c: Context): c.Expr[C] = {
import c.universe._
val e1 = c.Expr[C](Literal(Constant(null)).setType(typeOf[C]))
reify(e1.splice.asInstanceOf[C @annotation.unchecked.uncheckedVariance])
}
def myMacro: C = macro macroImpl
}
class C(val a: String) extends AnyVal
java.lang.NullPointerException
at Main$$anon$1.<init>(scalacmd4059893593754060829.scala:1)
at Main$.main(scalacmd4059893593754060829.scala:1)
at Main.main(scalacmd4059893593754060829.scala)
```
This commit installs a custom version of `mkZero` that instead
returns `q"new C[$..targs](${mkZero(wrappedType)})`.
Thanks to @ewiner for pinpointing the problem.
|
|/
|
|
|
|
|
|
|
|
| |
This progressed along with the fix for #66.
`TreeGen.mkZero` is a bit of a minefield: first with `Nothing` and
now with Value Classes. I wonder if we can provoke the same sort of
bug in the compiler in places where this is used.
Closes #83
|
|
|
|
|
|
|
| |
`gen.mkZero(NothingTpe)` gives the tree `Predef.???`. Instead, we should leave
the `await` field uninitialized with `ValDef(..., rhs = EmptyTree)`.
Fixes #66
|
|
|
|
|
|
| |
Works on the 2.10.x branch, so just backprting the test.
Cherry picked from 6f6546ebfc26564843621e79d840209a5103d3c8.
|
|
|
|
| |
2013 must have been unlucky.
|
|
|
|
|
|
|
|
|
| |
These stem from the handling of the internal/external view
or method type parameters by `thisMethodType` in `Namers`.
I've now preseversed the orginal ValDefs favoured the latter
when constructing the new DefDef, and made construction of
all liftables consistent in this regard.
|
|
|
|
|
|
|
|
|
| |
... in code that would otherwise have smuggled through these
slack LUBs in the types of trees but never in a TypeTree.
More details in SI-7694.
Fixes #29
|
|
|
|
|
| |
These are are at odds with the junit-interface SBT test framework
under SBT 0.13.+, and appear to be superfluous.
|
|
|
|
|
| |
If we intend to keep CPS fallback around for any length of time
it should probably move there too.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
- Avoid reset + retypecheck, instead hang onto the original types/symbols
- Eliminated duplication between AsyncDefinitionUseAnalyzer and ExprBuilder
- Instead, decide what do lift *after* running ExprBuilder
- Account for transitive references local classes/objects and lift them
as needed.
- Make the execution context an regular implicit parameter of the macro
- Fixes interaction with existential skolems and singleton types
Fixes #6, #13, #16, #17, #19, #21.
|
|
|
|
|
|
|
| |
- Undo the transformation that takes place in Typers to
leave us with Match(EmptyTree, cases).
- Make sure we don't descend into the cases of such a
tree when peforming the async transform
|
| |
|
|
Works like it says on the box.
|