diff options
author | Jason Zaugg <jzaugg@gmail.com> | 2014-10-08 23:50:59 +1000 |
---|---|---|
committer | Jason Zaugg <jzaugg@gmail.com> | 2014-10-09 00:28:12 +1000 |
commit | 24a0777219d647ec310a0b6da305f619f69950cd (patch) | |
tree | 1a1e02b629a6f15dceeaf8186ea837831270d032 /test/files | |
parent | 8d25e84c9123fe9784ec9844b5184aa1b697b429 (diff) | |
download | scala-24a0777219d647ec310a0b6da305f619f69950cd.tar.gz scala-24a0777219d647ec310a0b6da305f619f69950cd.tar.bz2 scala-24a0777219d647ec310a0b6da305f619f69950cd.zip |
SI-8871 Fix specialization under REPL / FSC
The transformation of applications to specialized methods
relies on the owner of said method having had the specialization
info transform run which stashes a bunch of related data into
per-run caches such as `SpecializeTypes#{typeEnv}`.
Recently, we found that per-run caches didn't quite live up
to there name, and in fact weren't being cleaned up before
a new run. This was remedied in 00e11ff.
However, no good deed goes unpunished, and this led to a
regression in specialization in the REPL and FSC.
This commit makes two changes:
- change the specialization info tranformer to no longer
directly enter specialized methods into the `info` of whatever
the current phase happens to be. This stops them showing up
`enteringTyper` of the following run.
- change `adaptInfos` to simply discard all but the oldest
entry in the type history when bringing a symbol from one
run into the next. This generalizes the approach taken to
fix SI-7801. The specialization info transformer will now
execute in each run, and repopulate `typeEnv` and friends.
I see that we have a seemingly related bandaid for this sort
of problem since 08505bd4ec. In a followup, I'll try to revert
that.
Diffstat (limited to 'test/files')
-rw-r--r-- | test/files/res/t8871.check | 5 | ||||
-rw-r--r-- | test/files/res/t8871.res | 4 | ||||
-rw-r--r-- | test/files/res/t8871/tag.scala | 3 | ||||
-rw-r--r-- | test/files/res/t8871/usetag.scala | 6 |
4 files changed, 18 insertions, 0 deletions
diff --git a/test/files/res/t8871.check b/test/files/res/t8871.check new file mode 100644 index 0000000000..bbd9331b16 --- /dev/null +++ b/test/files/res/t8871.check @@ -0,0 +1,5 @@ + +nsc> +nsc> +nsc> +nsc> diff --git a/test/files/res/t8871.res b/test/files/res/t8871.res new file mode 100644 index 0000000000..9b1a5fb57f --- /dev/null +++ b/test/files/res/t8871.res @@ -0,0 +1,4 @@ +t8871/tag.scala +t8871/usetag.scala +t8871/usetag.scala + diff --git a/test/files/res/t8871/tag.scala b/test/files/res/t8871/tag.scala new file mode 100644 index 0000000000..1a1803b77d --- /dev/null +++ b/test/files/res/t8871/tag.scala @@ -0,0 +1,3 @@ +class Tag { + @inline def apply[@specialized A, T](a: A): A = a +} diff --git a/test/files/res/t8871/usetag.scala b/test/files/res/t8871/usetag.scala new file mode 100644 index 0000000000..139d768552 --- /dev/null +++ b/test/files/res/t8871/usetag.scala @@ -0,0 +1,6 @@ +trait Foo + +object Test { + val y = new Tag().apply[Double, Foo](3.3) + // under FSC, this gave t8871/usetag.scala:4: error: wrong number of type parameters for method apply$mDc$sp: [T](a: Double)Double +} |