-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Compiler support for scala-async, with a state machine transform phase running after erasure [ci: last-only] #8816
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
lrytz
merged 94 commits into
scala:2.12.x
from
retronym:topic/scala-integrate-async-review2
Jun 18, 2020
Merged
Changes from 1 commit
Commits
Show all changes
94 commits
Select commit
Hold shift + click to select a range
9a0cbe8
make xprompt work in sbt's scalac task
adriaanm 3d09049
Import async
adriaanm 9535c94
patch for async debugging
adriaanm 6a665e9
Implement async transform with a macro and a post-erasure phase
adriaanm a7bbec5
Improvements to async phase
retronym 008137d
Move to scala.async.Async for compatibility with existing macros
szeiger 5dd9495
Add JUnit support to partest
szeiger 08fa083
Add tests from scala-async
szeiger 3b38d95
Fix bug in StateSet and add a remove operation
retronym b61e65b
Delete dead code.
retronym 5a9517b
Convert tests to ScalaConcurrent Future System
retronym 50150ca
Fix nested async transforms
retronym 8de6b1b
We'll never see `isAsync` again in nested trees.
retronym 9666175
Deal with await in ArrayValue
retronym e82ed14
Live variables: detect usages in Awaitable.expr
retronym 0619d4e
8000
Companion Detection should be post-erasure aware
retronym 2b580ed
Look for references in types as well as in terms.
retronym ec81663
A simpler and faster ANF transform
retronym b1c43ce
Reduce allocations in name freshening.
retronym d0ac056
Fix broken attempt to elide nulling in final state
retronym ee66301
Sort cases by state ID
retronym c7cb301
Fix .dot output when code contains ampersand
retronym 210bfac
Use reporter.error directly
retronym 90568be
Cleanup AsyncPhase's transformer
retronym 2d20aeb
Harden Context.make debug logging against null trees.
retronym e276921
Integrate async's logging into debuglog
retronym 588cab4
Refactor and document UseFields transform
retronym 528ffd2
Avoid overhead in tree attachments
retronym b617575
Reduce number of states in async state machine
retronym 7fdeed3
Use faster attachment lookups in ThicketTransformer
retronym 1db7f9d
Reinstate live variables test and fix null assignment
retronym 32e15bb
Use compiler APIs.
retronym c62fb75
Deal in typed trees in ExprBuilder.
retronym ffc613b
Remove PhasedTransform
retronym 789811a
Remove legacy future system methods.
retronym b86f268
Remove unused imports
retronym 2f75120
Allow a nested TypingTransformer to use an existing local typer.
retronym 4753b39
Merge AsyncTransformState with SymLookup
retronym bcf25d7
Add a fast path to the async phase
retronym f512e2f
Split some async implementation classes into files
retronym dd0001b
Refactor lifting to to change owner sooner
retronym ad00a91
Refactor field nulling.
retronym 60db8f9
Remove unused imports.
retronym 5755c74
Remove dead cases from adaptToUnit
retronym ef04e59
Move AsyncTransform code into AsyncPhase.scala
retronym 6f1546c
Use of AnfTransformer directly.
retronym 93748bd
Refactor asyncTransform
retronym 22014fc
Refactor addFutureSystemAttachment
retronym 0cea808
Remove dead code.
retronym 02bbc1d
Avoid allocating containsAwaitTraverser so often.
retronym a3aaeda
Avoid logging string allocation
retronym 1285669
Comment out debugging toString.
retronym 4124c25
More efficient Contains-/No-Await cleanup
retronym aabe723
Avoid overload resolution in typing default case of state handler.
retronym 01a83cb
Limit UseFields transform to relevent subtrees.
retronym c89c21b
More typed sub-trees avoiding working in `typed(...)`
retronym 33ca19f
Inline case class Awaitable
retronym c5bc867
StateSet: Allocate caseSet lazily
retronym 2631d47
Be explicit about lambdaLift following the async phase.
retronym 11733cb
Overhaul integration with front end macros
retronym 791c015
Don't insert null assignments for the terminal state.
retronym 36ad222
Remove dead code or make things more private.
retronym d7a2764
Local TypeDef no longer make it to the async phase.
retronym 36d452e
Allow compilation of async's partest suite in Junit
retronym dd463d1
Test and simplify ANF transform of Nothing-typed if/match
retronym de4fc23
Fix detection of ill-nested awaits
retronym 7d46e6b
Move ThicketTransformer to s.t.n.transform
retronym 469cfc1
Add tests from scala/scala-async#210
retronym 074b480
Add tests from scala/scala-async#206
retronym 3a2882f
Fix regression with non-awaiting patterns in tail position
retronym b68e118
More granular fresh names.
retronym 0775a0d
erasure: push casts into LabelDefs to simplify async phase
retronym d1d3daa
Avoid VerifyErrors wrapping Try in Assign.
retronym 8c770f2
await in by-name function arg is repoted as ill-nested.
retronym 4d0f6bb
Improve error reporting in asynj junit test.
retronym a5298c5
Support state getter/setter methods
retronym 499296c
Better integration with compiler fresh names
retronym e73f502
Position synthetic trees accurately
retronym bcb5dc6
Overhaul/fix live variables
retronym d81ef53
Add an another example of a Writer/Option monad
retronym 502c127
Fixup remove stray .log files from partest suite
retronym e63a133
Move async run tests to jvm category
retronym f9d7952
Add a Scala.js compatible smoke test.
retronym 215f173
Move some async test cases to partest
retronym 5455445
Tweak names in generated code
retronym db3ea69
Avoid exotic use of Labels to gain Scala.js compat
retronym 923e57b
Add missing source file headers
retronym b76a0ec
Fix an edge case for value classes
retronym c94951e
Fix an edge case for while in expr position
retronym 7f22119
Rework async expression wrapping
retronym 230684d
Avoid generating dead code for terminal state
retronym 0e27334
remove old ThicketTransformer
lrytz ae91a3c
Address review comments (remove dead/debug code, +comments)
retronym 89f48d2
Refactor detection of ill nested await calls
retronym File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Rework async expression wrapping
Wrap the async expression in `locally { ... }` to force value class boxing. This seems to work better than `{ ... }: Any`, which ends up with `Function` trees typed with `Any` which violoates an assumption in `delambdafy`.
- Loading branch information
commit 7f22119a95b4e72713a04a707d8fd11c5d64b2b0
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
-Xasync |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import scala.tools.partest.async.OptionAwait._ | ||
//import org.junit.Assert._ | ||
|
||
object Test { | ||
def main(args: Array[String]): Unit = { | ||
lambda() | ||
} | ||
|
||
private def lambda() = { | ||
val l = optionally{ | ||
value(Some(1)) | ||
(a: String) => a.length | ||
}.get | ||
//assertEquals(1, l("a")) | ||
} | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.