diff options
author | Dmitry Petrashko <dmitry.petrashko@gmail.com> | 2014-04-04 12:14:43 +0200 |
---|---|---|
committer | Dmitry Petrashko <dmitry.petrashko@gmail.com> | 2014-04-11 14:51:20 +0200 |
commit | 6ebf6e2c3ef270f226a0fb42ebd59d24449942cf (patch) | |
tree | 66c35ac55cb4d4aad5c09d5a074894e682aabdd7 /test/dotc | |
parent | 4a3b96282584c77c85ae51f5d29cf7c6082cd7fb (diff) | |
download | dotty-6ebf6e2c3ef270f226a0fb42ebd59d24449942cf.tar.gz dotty-6ebf6e2c3ef270f226a0fb42ebd59d24449942cf.tar.bz2 dotty-6ebf6e2c3ef270f226a0fb42ebd59d24449942cf.zip |
TailRec phase and tests for it.
Ported tailcall phase from scalac with such changes:
- all transformation is done in the phase itself
(previously half of the work was done in backend)
- it is now able to run before uncurry
- it is now a treeTransform
- renamed to tailrec to make it more obvious that
this phase transforms only recursive calls.
For now this is a single phase which speculatively
transforms DefDefs.
Speculation can be potentially removed by
splitting into 2 phases:
one detecting which methods should be transformed
second performing transformation.
But, as transformation requires as same amount of work
as detection, I believe it will be simpler to maintain
it as a single phase.
Conflicts:
tests/pos/typers.scala
Diffstat (limited to 'test/dotc')
-rw-r--r-- | test/dotc/tests.scala | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/test/dotc/tests.scala b/test/dotc/tests.scala index 3228c3474..29c50c556 100644 --- a/test/dotc/tests.scala +++ b/test/dotc/tests.scala @@ -47,6 +47,9 @@ class tests extends CompilerTest { @Test def pos_i39 = compileFile(posDir, "i39", doErase) @Test def pos_overloadedAccess = compileFile(posDir, "overloadedAccess", doErase) @Test def pos_approximateUnion = compileFile(posDir, "approximateUnion", doErase) + @Test def pos_tailcall = compileDir(posDir + "tailcall/", doErase) + + @Test def pos_all = compileFiles(posDir, twice) @Test def new_all = compileFiles(newDir, twice) @@ -69,6 +72,12 @@ class tests extends CompilerTest { @Test def neg_t0625_structural = compileFile(negDir, "t0625", xerrors = 1) @Test def neg_t0654_polyalias = compileFile(negDir, "t0654", xerrors = 2) @Test def neg_t1192_legalPrefix = compileFile(negDir, "t1192", xerrors = 1) + @Test def neg_tailcall_t1672b = compileFile(negDir, "tailcall/t1672b", xerrors = 6) + @Test def neg_tailcall_t3275 = compileFile(negDir, "tailcall/t3275", xerrors = 1) + @Test def neg_tailcall_t6574 = compileFile(negDir, "tailcall/t6574", xerrors = 4) + @Test def neg_tailcall = compileFile(negDir, "tailcall/tailrec", xerrors = 7) + @Test def neg_tailcall2 = compileFile(negDir, "tailcall/tailrec-2", xerrors = 2) + @Test def neg_tailcall3 = compileFile(negDir, "tailcall/tailrec-3", xerrors = 2) @Test def dotc = compileDir(dotcDir + "tools/dotc", twice) @Test def dotc_ast = compileDir(dotcDir + "tools/dotc/ast", twice) |