aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVladimirNik <vladimir.nikolaev9@gmail.com>2015-11-27 15:24:13 +0100
committerVladimirNik <vladimir.nikolaev9@gmail.com>2015-11-27 18:27:28 +0100
commit317ca3e4d45dfe31f50f87f60194ce2506c86fa8 (patch)
treea86776441761fc1a1192463eef3417ecf444286a
parent2bb73c3bf1a6fef8bd77d762c99d02d499621ea3 (diff)
downloaddotty-317ca3e4d45dfe31f50f87f60194ce2506c86fa8.tar.gz
dotty-317ca3e4d45dfe31f50f87f60194ce2506c86fa8.tar.bz2
dotty-317ca3e4d45dfe31f50f87f60194ce2506c86fa8.zip
Add pickling/unpickling of stable modifier
Pickling/unpickling of STABLE modifier allows to fix problem with unpickling of path-dependent types (#982)
-rw-r--r--src/dotty/tools/dotc/core/tasty/TastyFormat.scala6
-rw-r--r--src/dotty/tools/dotc/core/tasty/TreePickler.scala1
-rw-r--r--src/dotty/tools/dotc/core/tasty/TreeUnpickler.scala1
-rw-r--r--test/dotc/tests.scala1
-rw-r--r--tests/tasty/i982.scala8
5 files changed, 16 insertions, 1 deletions
diff --git a/src/dotty/tools/dotc/core/tasty/TastyFormat.scala b/src/dotty/tools/dotc/core/tasty/TastyFormat.scala
index 1f24397c6..f3dabb517 100644
--- a/src/dotty/tools/dotc/core/tasty/TastyFormat.scala
+++ b/src/dotty/tools/dotc/core/tasty/TastyFormat.scala
@@ -172,6 +172,7 @@ Standard-Section: "ASTs" TopLevelStat*
SCALA2X // Imported from Scala2.x
DEFAULTparameterized // Method with default params
INSUPERCALL // defined in the argument of a constructor supercall
+ STABLE // Method that is assumed to be stable
Annotation
Annotation = ANNOTATION Length tycon_Type fullAnnotation_Term
@@ -220,7 +221,7 @@ object TastyFormat {
final val DEFAULTGETTER = 7
final val SHADOWED = 8
-// AST tags
+ // AST tags
final val UNITconst = 2
final val FALSEconst = 3
@@ -252,6 +253,7 @@ object TastyFormat {
final val SCALA2X = 29
final val DEFAULTparameterized = 30
final val INSUPERCALL = 31
+ final val STABLE = 32
final val SHARED = 64
final val TERMREFdirect = 65
@@ -362,6 +364,7 @@ object TastyFormat {
| SCALA2X
| DEFAULTparameterized
| INSUPERCALL
+ | STABLE
| ANNOTATION
| PRIVATEqualified
| PROTECTEDqualified => true
@@ -409,6 +412,7 @@ object TastyFormat {
case SCALA2X => "SCALA2X"
case DEFAULTparameterized => "DEFAULTparameterized"
case INSUPERCALL => "INSUPERCALL"
+ case STABLE => "STABLE"
case SHARED => "SHARED"
case TERMREFdirect => "TERMREFdirect"
diff --git a/src/dotty/tools/dotc/core/tasty/TreePickler.scala b/src/dotty/tools/dotc/core/tasty/TreePickler.scala
index dae201a79..d98ebb4d1 100644
--- a/src/dotty/tools/dotc/core/tasty/TreePickler.scala
+++ b/src/dotty/tools/dotc/core/tasty/TreePickler.scala
@@ -534,6 +534,7 @@ class TreePickler(pickler: TastyPickler) {
if (flags is Accessor) writeByte(FIELDaccessor)
if (flags is CaseAccessor) writeByte(CASEaccessor)
if (flags is DefaultParameterized) writeByte(DEFAULTparameterized)
+ if (flags is Stable) writeByte(STABLE)
} else {
if (flags is Sealed) writeByte(SEALED)
if (flags is Abstract) writeByte(ABSTRACT)
diff --git a/src/dotty/tools/dotc/core/tasty/TreeUnpickler.scala b/src/dotty/tools/dotc/core/tasty/TreeUnpickler.scala
index 71f51d9a1..eadccb2a3 100644
--- a/src/dotty/tools/dotc/core/tasty/TreeUnpickler.scala
+++ b/src/dotty/tools/dotc/core/tasty/TreeUnpickler.scala
@@ -465,6 +465,7 @@ class TreeUnpickler(reader: TastyReader, tastyName: TastyName.Table) {
case SCALA2X => addFlag(Scala2x)
case DEFAULTparameterized => addFlag(DefaultParameterized)
case INSUPERCALL => addFlag(InSuperCall)
+ case STABLE => addFlag(Stable)
case PRIVATEqualified =>
readByte()
privateWithin = readType().typeSymbol
diff --git a/test/dotc/tests.scala b/test/dotc/tests.scala
index 48e9bba5d..2bbbacd2f 100644
--- a/test/dotc/tests.scala
+++ b/test/dotc/tests.scala
@@ -231,4 +231,5 @@ class tests extends CompilerTest {
@Test def tasty_dotc_reporting = compileDir(dotcDir, "reporting", testPickling)
@Test def tasty_dotc_util = compileDir(dotcDir, "util", testPickling)
@Test def tasty_tools_io = compileDir(toolsDir, "io", testPickling)
+ @Test def tasty_tests = compileDir(testsDir, "tasty", testPickling)
}
diff --git a/tests/tasty/i982.scala b/tests/tasty/i982.scala
new file mode 100644
index 000000000..838b250d9
--- /dev/null
+++ b/tests/tasty/i982.scala
@@ -0,0 +1,8 @@
+trait Z {
+ type Q
+ def test: Q
+}
+class X(val x: Z)
+class Y(x: Z) extends X(x) {
+ x.test
+}