Closed scabug closed 7 years ago
Imported From: https://issues.scala-lang.org/browse/SI-8402?orig=1 Reporter: @paulp See #8403, #8265
@paulp said: I did notice some issues have already been flushed out, e.g. this doesn't compile without the -Xsource:2.10 because of the implicit conversion of Null.
% pscalac -Xsource:2.10 /l/trunk1/src/library/scala/Option.scala
@paulp said: For reference the variance soundness fix was in a419799f87 . Also I noticed retronym considering maybe it's not so bad to fix scalaz re: https://github.com/scala/scala/pull/3178 re that subsequent variance soundness fix. I'm going to assume everyone agrees it's worlds better for migration if people can compile their 2.10 sources as-is with -Xsource:2.10. I think that github comment thread predates the realization that -Xsource:2.10 was a really good idea.
@retronym said: I think the first part of the request dups #8265.
BTW, [~garillot] has a jenkins job that typechecks a few projects with -Xsource:2.10
. https://jenkins.scala-ide.org:8496/jenkins/view/Scala%20Xsource%20flag%20nightlies/
We know that we don't have the resources to be completely bug-compatible with 2.10 under this flag, so we are relying on the data from these builds to figure out where we get the most bang for our buck.
The primary use case for this flag is to use the 2.11 IDE for 2.10 code bases.
@retronym said: See also https://github.com/scala/scala/pull/3359, which backported the variance compliance to 2.10.x.
@paulp said: Yes I figured some of this would exist in other tickets. Well if it helps rest assured that #8265 will hit many projects. The convenience of invisible unsoundness has an accidental allure like few others.
@paulp said: Using the 2.11 IDE on 2.10 code bases is the same use case as mine, except that maybe it gives up more quickly.
@paulp said: I'll wrap the variance check if I can talk you into the ambiguity check (I don't even know what is the origin of that.)
@paulp said (edited on Mar 12, 2014 5:21:09 PM UTC): After I patch past the variance issue there is only one more issue before compilation succeeds. To me that says it's easily worth making this work and testing it.
The last problem is a change in the scala.runtime support java classes, introduced in 265fc6b230 . Now it generates calls to "create" which doesn't exist in the 2.10 sources.
error: scala.reflect.internal.FatalError: object VolatileFloatRef does not have a member create
at scala.reflect.internal.Definitions$DefinitionsClass.scala$reflect$internal$Definitions$DefinitionsClass$$fatalMissingSymbol(Definitions.scala:1165)
at scala.reflect.internal.Definitions$DefinitionsClass$$anonfun$getMember$1.apply(Definitions.scala:1188)
at scala.reflect.internal.Definitions$DefinitionsClass$$anonfun$getMember$1.apply(Definitions.scala:1183)
at scala.reflect.internal.Symbols$Symbol.orElse(Symbols.scala:2433)
at scala.reflect.internal.Definitions$DefinitionsClass.getMember(Definitions.scala:1182)
at scala.reflect.internal.Definitions$DefinitionsClass.getMemberMethod(Definitions.scala:1217)
It's relatively easy to work around by substituting the 2.11 scala/runtime/*.java classes for the 2.10 ones.
@retronym said (edited on Mar 12, 2014 5:27:38 PM UTC):
Yeah, the interaction with ScalaRuntime
is why this is only really supported until typer phase. Name based patmat has a bunch of new calls there, for example.
I'm happy to accept a patch for the variance loosening for RC2 (scheduled on Friday, I think).
I'll see if I can pin down the ambiguity change.
@paulp said: Maybe I can reorient this ticket toward the future. How about requiring that scala continue to be able to compile the 2.11 release under -Xsource:2.11 ? I'm sure it would be welcome come 2.12.
@retronym said: I've lodged the ambiguity error as #8403. Looks like its a regression after my refactoring of Contexts.
@paulp said: https://github.com/scala/scala/pull/3623
Should be fixed by https://github.com/scala/scala/pull/3623
It's hard to know how many more places -Xsource 2.10 might need to be respected for what I want to work, because compilation tends to halt before one has a clear picture. But there are at least the two shown here. First:
That compiles in 2.10 but not in 2.11.
"What I want to work" is to be able to compile the 2.10 sources with 2.11. For y'all to push through the errors seems like an easy way to find some of the holes in -Xsource.
The other place, which arises first:
It only became possible to even try this after 0fbd4422b2 which fixed "scala.reflect.internal.FatalError: class Universe does not have a member Quasiquote", thanks for that.
In case you want to pursue this I made a script to embody what I think should work, which might even serve as the basis of a test.