--
You received this message because you are subscribed to the Google Groups "scala-internals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scala-interna...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
On Mon, Oct 13, 2014 at 3:46 PM, Lukas Rytz <lukas...@gmail.com> wrote:
If you check out the above repo and set scalaVersion to 2.11.2 it compiles.I could not manage to reproduce the failure without using sbt, not sure where to look right now.
Running a quick git bisect with jenkins’ pack.tgz says this regressed in 0ccdb15, but from there I have no idea…
--
In both 2.11.2 and 2.11.3, the Unpickler
creates stub symbols for references of shapless.PolyDefns
to symbols in scala-reflect.jar
if it is not present on the classpath.
The change to isStaticModule
in 0ccdb15 more aggressively executes info transformers on classfile based symbols.
Here’s a minimization and an exploration of how to make our stub symbols even stubbier.
Not sure it that’s a good idea or not yet. An alternative might be to change isModuleNotMethod
to be more selective about when forcing the info makes sense, or perhaps catching the MissingRequirementError and demoting it to a dev warning if the symbol isn’t part of this compilation run. Lukas, WDYT?
def isModuleNotMethod = {
if (isModule) {
if (phase.refChecked) this.info // force completion to make sure lateMETHOD is there.
!isMethod
} else false
}
The problem didn’t show up under the command line scalac, as that always adds scala-reflect.jar to the classpath.
-jason
Why doesn't sbt add scala-reflect.jar to the classpath, if shapeless.jar depends on it? Is that common,or is it something special about scala-reflect?
% git grep '"provided'
project/Build.scala: "org.scala-lang" % "scala-reflect" % sv % "provided",
StubSymbol
s are for more than just annotations. For example, you should not need a classpath to support the signatures of methods you don’t use in a class.
% cat sandbox/stub1.scala && qscalac sandbox/stub1.scala && rm C.class && qscala -e "def test(d: D) = d.zzz"
class C
class D {
def ccc(c: C) = c
def zzz = "z"
}
javac behaves in this manner, too.
We have no need to elaborate the type signature of PolyDefns.Case.materializeFromValueImpl
, we should tread more lightly. In this failing test, we get there in a pretty circuitous manner, so it isn't immediately obvious where to remedy this.
OK, thanks for more details. I fear that we could get unexpected / wrong results whentaking stub symbols too far, because they often give you an answer and don't crash:scala> val stub = new global.StubTermSymbol(NoSymbol, "hai", "msg")stub: $r.global.StubTermSymbol = value haiscala> stub.isMethodres4: Boolean = falsescala> stub.isClassres5: Boolean = falsescala> stub.isModuleres6: Boolean = false(btw, how do you get these nice monospace boxes in gmail?)
So maybe it's better to avoid creating even more?
If you ever call .info
on them they will fail. It is a fine balance, but I can’t really think of an alternative design. It might be interesting to take a look at javac’s implementation of these.
I think we can fix this particular bug by making isModuleNotMethod
only force as far as it needs to get the lateMETHOD
flag installed (ie, to refchecks). I’ll submit a patch and test for this, under the banner of SI-8907.
On 14 Oct 2014 07:08, "Jason Zaugg" <jza...@gmail.com> wrote:
>
> On Tue, Oct 14, 2014 at 3:53 PM, Lukas Rytz <lukas...@gmail.com> wrote:
>>
>> Why doesn't sbt add scala-reflect.jar to the classpath, if shapeless.jar depends on it? Is that common,
>> or is it something special about scala-reflect?
>
>
> Dependencies in the `provided` scope are intransitive.
>
> % git grep '"provided'
> project/Build.scala: "org.scala-lang" % "scala-reflect" % sv % "provided",
Are you suggesting that I should drop the provided scope, either temporarily or permanently?
Cheers,
Miles
>
>
>
>>
>> I have the feeling that the compiler is implemented with the assumption of finding all necesssary
>> dependencies on the classpath, and other problems would pop up after working around this one.
>>
>> (It seems we have to do an exception for annotations: SI-5420 / SI-7551/ SI-7751)
>>
> StubSymbols are for more than just annotations. For example, you should not need a classpath to support the signatures of methods you don’t use in a class.
>
> % cat sandbox/stub1.scala && qscalac sandbox/stub1.scala && rm C.class && qscala -e "def test(d: D) = d.zzz"
> class C
>
> class D {
> def ccc(c: C) = c
>
> def zzz = "z"
> }
>
> javac behaves in this manner, too.
>
> We have no need to elaborate the type signature of PolyDefns.Case.materializeFromValueImpl, we should tread more lightly. In this failing test, we get there in a pretty circuitous manner, so it isn't immediately obvious where to remedy this.
>
>
> -jason
>
--