-
Notifications
You must be signed in to change notification settings - Fork 1.1k
partest: Enable separate compilation #1289
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
Conversation
@@ -93,6 +102,8 @@ class ExpandPrivate extends MiniPhaseTransform with IdentityDenotTransformer { t | |||
case Apply(sel @ Select(_: Super, _), _) | |||
if sym.is(PrivateParamAccessor) && sel.symbol.is(ParamAccessor) && sym.name == sel.symbol.name => | |||
sym.ensureNotPrivate.installAfter(thisTransform) | |||
case _ if (isVCPrivateParamAccessor(sym)) => |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just do:
case _ =>
if (isVC...)
Instead of two case _
cases
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed. Thank you!
c9dfeb2
to
27733bd
Compare
@smarter: is this ready for review after the tests pass? |
Turns out there's more issues than the three I listed above, so not yet |
27733bd
to
3872ab8
Compare
OK, after fixing some stuff, there are two remaining test failure, I've updated the PR description with the details. |
/rebuild |
@@ -217,7 +217,7 @@ object CollectionStrawMan4 { | |||
def fromIterable[B](coll: Iterable[B]): ListBuffer[B] = coll match { | |||
case pd @ View.Partitioned(partition: View.Partition[B]) => | |||
partition.distribute(new ListBuffer[B]()) | |||
pd.forced.get.asInstanceOf[ListBuffer[B]] | |||
new ListBuffer[B] ++= pd.forced.get.asInstanceOf[List[B]] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You don't even need the cast, pd.forced.get
works, but it would be interesting to know if this is what @odersky intented or if there's a design flaw somewhere. Also please squash your commits related to this into one commit
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The code looks correct to me. The cast seems to be a left-over from a
previous version.
On Fri, Jun 3, 2016 at 2:45 PM, Guillaume Martres [email protected]
wrote:
In tests/run/colltest4/CollectionStrawMan4_1.scala
#1289 (comment):@@ -217,7 +217,7 @@ object CollectionStrawMan4 {
def fromIterable[B](coll: Iterable[B]): ListBuffer[B] = coll match {
case pd @ View.Partitioned(partition: View.Partition[B]) =>
partition.distribute(new ListBufferB)
pd.forced.get.asInstanceOf[ListBuffer[B]]
new ListBuffer[B] ++= pd.forced.get.asInstanceOf[List[B]]
You don't even need the cast, pd.forced.get works, but it would be
interesting to know if this is what @odersky https://github.com/odersky
intented or if there's a design flaw somewhere. Also please squash your
commits related to this into one commit—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/lampepfl/dotty/pull/1289/files/61ce7bb9be6a74d19b246e621f8fbc02581684e5..8f3b4bf6cc2927dc2b1d9e9515dd0451b5359233#r65700740,
or mute the thread
https://github.com/notifications/unsubscribe/AAwlVoqkdv3GnuHJWa4SDmvsTQq6NGcfks5qICHWgaJpZM4IrGUX
.
Prof. Martin Odersky
LAMP/IC, EPFL
906374f
to
58607c1
Compare
/rebuild |
partest can separately compile files based on their suffix (_1, _2, ...), it turns out that this feature was never enabled in the dotty version of partest and no one noticed (it prints warnings in ./tests/partest-generated/gen.log which no one reads), tests with *.java files should be compiled both with javac and dotty, but compiling with javac was also disabled. Enabling this revealed some latent bugs that will be fixed in the next few commits.
This is necessary to unbox the value class when accessing it from separate compilation units
This test failed before because strawman.collections.CollectionStrawMan5 is defined in two places: - src/strawman/collections/CollectionStrawMan5.scala - tests/run/colltest5/CollectionStrawMan5_1.scala The first will be compiled by scalac (unless the tests are run through a bootstrapped dotty) and the second will be compiled by dotty, the value class encoding of scalac and dotty are not binary compatible. This would not be a problem if we always used the `CollectionStrawMan5` coming from the partest output directory and ignored the one in the dotty sources, but which one gets picked depends on the classpath and whether compilation is joined or separate, see scala#1301. For now, it's safer and simpler to just avoid having tests which define a class that is also defined in the sources of dotty. Also, fix a bug in colltest4 where it was importing CollectionStrawMan5 instead of CollectionStrawMan4
This lead to inference failures when separately compiling t1751 and t294, this did not happen under joint compilation because JavaParser does not create the overloaded constructor
Some java tests require the scala-library to be present on the classpath, this fixes tests/pos/java-interop/{t1186, t1235, t1254, t1642}. Also correctly redirect the output of javac so that it will be displayed by partest --verbose
javac wants the public class name to match the filename.
Currently, the classfiles emitted by dotty do not contain the type parameters information that javac relies on. Fixing this is tracked by scala#1303.
Java's naming convention is different from Scala's.
58607c1
to
4b0cc8a
Compare
Fixed issue with t0288 and rebased to latest master. |
/rebuild |
In this case, supertype is not stable and should not be cached.
@smarter Your commits LGTM. Would you like to review the rest? |
@@ -2645,6 +2645,9 @@ object Types { | |||
if (ctx.period != validSuper) { | |||
cachedSuper = tycon match { | |||
case tp: TypeLambda => defn.AnyType | |||
case tp: TypeVar => | |||
// supertype not stable, since underlying might change |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The supertype should be stable if tp.inst.exists
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point. Fixed in latest commit.
LGTM, good to have this in! |
partest can separately compile files based on their suffix (_1, _2,
...), it turns out that this feature was never enabled in the dotty
version of partest and no one noticed (it prints warnings in
./tests/partest-generated/gen.log which no one reads).
Enabling this revealed some latent separate compilation bugs that will need to
be fixed in the next few commits.
There are four (edit: actually more than that) test failures after this commit: https://gist.github.com/smarter/5cfff93170dae8864b9920e0d0398b63
I don't know if I'll have time to look at all of them, so it would be nice if people could assign themselves (ping @DarkDimius, @felixmulder, @liufengyun, @odersky, @VladimirNik) to try to fix one of them and push it to this PR (you can edit this issue to assign yourself):
t1751
andt294
colltest5
StringOps
has an overloaded method++
, we replace overloading by numbers in the corresponding extension methods ($extension0
,$extension1
, ...) to avoid dealing with overloading after Typer (I'm no longer a fan of that scheme that we copied from scalac and considered replacing it by overloading). It seems to have gone wrong here (we emitted$plus$plus$extension0(String, String)
when compiling the first file but when compiling the second file we looked for$plus$plus$extension1(String, String)
:t7859
x
in the value classA
should not beprivate
because we need to access it from separate compilation units to unbox the value class:t1186, t1235, t1254, t1642
volatile
t1263, t1745
colltest4
CollectionStrawMan4
:The cast is wrong,
pd.forced.get
returns aList
, not aListBuffer
, this should be fixed both in./tests/run/colltest4/CollectionStrawMan4_1.scala
and./src/strawman/collections/CollectionStrawMan4.scala
, stacktrace: https://gist.github.com/smarter/5aab6857a20b0979b2909355171ab341t0288
test$Outer$Inner$$$outer
which is weird because Outer.Inner is a java inner class so it doesn't have an$outer
field, someone familiar with how we deal with outer accessors should have a look.