aboutsummaryrefslogtreecommitdiff
path: root/src/test/scala/scala/async/run/toughtype
Commit message (Collapse)AuthorAgeFilesLines
* fix procedure syntaxxuwei-k2018-05-091-13/+13
|
* Remove uses of deprecated Future APIsNthPortal2018-02-271-5/+5
|
* copyright 2018 LightbendSeth Tisue2018-02-061-1/+1
|
* Fix compiler crash with value class in result positionJason Zaugg2015-07-061-0/+13
| | | | | | | We were leaking untyped trees out of the macro, which crashed in refchecks. This commit proactively typechecks the tree returned by `mkZero`.
* Fix regression around await of non-class typeGene Novark2014-12-091-0/+15
| | | | E.g. type param, abstrat type.
* Additional tests and comments around mkZero for value classesJason Zaugg2014-10-011-0/+24
|
* Merge branch 'ticket/86-mkZero' into merge/2.10.x-to-master-20140930Jason Zaugg2014-10-011-2/+51
|\ | | | | | | | | | | | | 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
| * Avoid assigning null to vars of derived value typeJason Zaugg2014-09-291-0/+64
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | `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.
* | Test case for already-fixed NPE with value classesJason Zaugg2014-07-211-0/+14
|/ | | | | | | | | | 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
* Avoid NotImplementedError awaiting a Future[Nothing]Jason Zaugg2014-06-141-0/+16
| | | | | | | `gen.mkZero(NothingTpe)` gives the tree `Predef.???`. Instead, we should leave the `await` field uninitialized with `ValDef(..., rhs = EmptyTree)`. Fixes #66
* [backport] Test case for "not a class" crasher in live variableJason Zaugg2014-03-121-0/+28
| | | | | | Works on the 2.10.x branch, so just backprting the test. Cherry picked from 6f6546ebfc26564843621e79d840209a5103d3c8.
* Update copyright years.Jason Zaugg2014-01-141-1/+1
| | | | 2013 must have been unlucky.
* Fix crasher in icode due to symbol mismatches in lifted methodsJason Zaugg2013-11-141-0/+50
| | | | | | | | | 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.
* Use @uncheckedBounds to avoid introducing refchecks errorsJason Zaugg2013-08-221-1/+8
| | | | | | | | | ... 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
* Remove @RunWith annotations from test cases.Jason Zaugg2013-08-151-3/+0
| | | | | These are are at odds with the junit-interface SBT test framework under SBT 0.13.+, and appear to be superfluous.
* Move implementation details to scala.async.internal._.Jason Zaugg2013-07-071-3/+4
| | | | | If we intend to keep CPS fallback around for any length of time it should probably move there too.
* Fix another interation with existentials and a name clash.Jason Zaugg2013-07-071-0/+32
|
* An overdue overhaul of macro internals.Jason Zaugg2013-07-031-0/+38
| | | | | | | | | | | | - 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.
* Workaround non-idempotency of typing pattern matching anonymous functions.Jason Zaugg2012-12-101-0/+31
| | | | | | | - 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
* add missing copyrightJason Zaugg2012-11-241-1/+1
|
* Test with less trivial types.Jason Zaugg2012-11-091-0/+39
Works like it says on the box.