| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Code like:
val x = if (cond) throw new A else throw new B
Was being transformed to:
val ifRes = ???
if (cond) ifRes = throw new A else ifRes = throw new B
val x = ifRes
by way of the use of `gen.mkZero` which throws `???` if the requested type is `Nothing`
This commit special cases `Nothing` typed expressions in a similar manner to `Unit` type expressions.
The example above is now translated to:
if (cond) throw new A else throw new B
val x = throw new IllegalStateException()
Fixes #120
|
| |
|
|
|
|
| |
2013 must have been unlucky.
|
|
|
|
|
| |
These are are at odds with the junit-interface SBT test framework
under SBT 0.13.+, and appear to be superfluous.
|
|
|
|
| |
Avoids runtime errors like: "java.lang.Double cannot be cast to scala.runtime.BoxedUnit"
|
| |
|
|
|
|
| |
This case already works.
|
| |
|
|
|
|
|
| |
Also support AsyncId.async[Nothing], which was triggering a NPE
in the generated `null.asInstanceOf[Nothing]`.
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Before, we levied an implementation restriction to prevent
this. As it turned out, that needlessly prevented use of
`await` in the receiver of a multi-param-list application.
This commit lifts the restriction altogether, and treats
such applications holistically, being careful to preserve the
left-to-right evaluation order of arguments in the translated
code.
- use `TreeInfo.Applied` and `Type#paramss` from `reflect.internal`
to get the info we need
- use the parameter name for the lifted argument val, rather than
`argN`
- encapsulate handling of by-name-ness and parameter names
in `mapArgumentss`
- test for evaluation order preservation
|
|
|
|
| |
This time in the ANF/Inline transformation.
|
| |
|
|
|
|
|
|
|
|
| |
We need to unwrap and inline `xs`, then
rewrap the result expression with the wildcard
star.
Addresses the first half of #46.
|
| |
|
|
|
|
|
|
|
|
|
| |
We can allow it, but we need to treat nested
Apply trees holistically, in order to lift out
all the arguments and maintain the correct
evaluation order.
Fixes #33.
|
|
|
|
|
|
|
|
| |
- If we lift one arg, we must lift them all.
This preserves evaluation order.
- But, never lift an by-name arg
Addresses the first half of #33.
|
|
|
|
|
|
| |
Adapt the compiler's standard ResetAttrs to keep
This() nodes don't refer to a symbol defined in the
current async block.
|
| |
|
|
|
|
|
|
|
|
| |
Prepend {(); ... } before starting the ANF transform.
Add tracing to the anf/inline transform.
Also enables and addresses SIP-18 warnings.
|
|
|
|
|
|
|
|
| |
- transform the provided tree using reflect.internal.Symbols#Symbol.name_=
and treeCopy.{Ident, Select}.
- not sure if this is possible within the public Symbol API.
- move checking for unsupported nested module/class to AsyncAnalysis.
- make block merging selective (only do so if there are nested await calls.)
|
|
|
|
|
|
|
|
| |
- corrects detection of await calls in the ANF transform.
- Split AsyncAnalyzer into two parts. Unsupported await
detection must happen prior to the async transform to
prevent the ANF lifting out by-name arguments to
vals and hence changing the semantics.
|
|
|
|
|
| |
- Move now-working duplicate definition tests from `neg` to `run`.
- Renames and small code beautification around the var lifting analysis
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Instead of generating an assignment to a Unit-typed variable, just add
the Unit value after the if-else expression:
[async] scala.async.Async.async[Unit]({
val f: scala.concurrent.Future[Int] = AnfTestClass.this.base(y);
if (y.>(0))
State.result_=(scala.async.Async.await[Int](f).+(2))
else
State.result_=(scala.async.Async.await[Int](f).-(2))
})
[async] ANF transform expands to:
{
val f: scala.concurrent.Future[Int] = AnfTestClass.this.base(y);
if (y.>(0))
{
val await$8: Int = scala.async.Async.await[Int](f);
State.result_=(await$8.+(2))
}
else
{
val await$9: Int = scala.async.Async.await[Int](f);
State.result_=(await$9.-(2))
};
()
}
|
|
- Does not descend into class and module defs
- Adds several tests, including tests for if-else
|