Skip to content

Commit 0a96cbe

Browse files
committed
Merge pull request #983 from dotty-staging/stable-modifier-pickling
Add pickling/unpickling of stable modifier
2 parents 2bb73c3 + 317ca3e commit 0a96cbe

File tree

5 files changed

+16
-1
lines changed

5 files changed

+16
-1
lines changed

src/dotty/tools/dotc/core/tasty/TastyFormat.scala

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,7 @@ Standard-Section: "ASTs" TopLevelStat*
172172
SCALA2X // Imported from Scala2.x
173173
DEFAULTparameterized // Method with default params
174174
INSUPERCALL // defined in the argument of a constructor supercall
175+
STABLE // Method that is assumed to be stable
175176
Annotation
176177
Annotation = ANNOTATION Length tycon_Type fullAnnotation_Term
177178
@@ -220,7 +221,7 @@ object TastyFormat {
220221
final val DEFAULTGETTER = 7
221222
final val SHADOWED = 8
222223

223-
// AST tags
224+
// AST tags
224225

225226
final val UNITconst = 2
226227
final val FALSEconst = 3
@@ -252,6 +253,7 @@ object TastyFormat {
252253
final val SCALA2X = 29
253254
final val DEFAULTparameterized = 30
254255
final val INSUPERCALL = 31
256+
final val STABLE = 32
255257

256258
final val SHARED = 64
257259
final val TERMREFdirect = 65
@@ -362,6 +364,7 @@ object TastyFormat {
362364
| SCALA2X
363365
| DEFAULTparameterized
364366
| INSUPERCALL
367+
| STABLE
365368
| ANNOTATION
366369
| PRIVATEqualified
367370
| PROTECTEDqualified => true
@@ -409,6 +412,7 @@ object TastyFormat {
409412
case SCALA2X => "SCALA2X"
410413
case DEFAULTparameterized => "DEFAULTparameterized"
411414
case INSUPERCALL => "INSUPERCALL"
415+
case STABLE => "STABLE"
412416

413417
case SHARED => "SHARED"
414418
case TERMREFdirect => "TERMREFdirect"

src/dotty/tools/dotc/core/tasty/TreePickler.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -534,6 +534,7 @@ class TreePickler(pickler: TastyPickler) {
534534
if (flags is Accessor) writeByte(FIELDaccessor)
535535
if (flags is CaseAccessor) writeByte(CASEaccessor)
536536
if (flags is DefaultParameterized) writeByte(DEFAULTparameterized)
537+
if (flags is Stable) writeByte(STABLE)
537538
} else {
538539
if (flags is Sealed) writeByte(SEALED)
539540
if (flags is Abstract) writeByte(ABSTRACT)

src/dotty/tools/dotc/core/tasty/TreeUnpickler.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -465,6 +465,7 @@ class TreeUnpickler(reader: TastyReader, tastyName: TastyName.Table) {
465465
case SCALA2X => addFlag(Scala2x)
466466
case DEFAULTparameterized => addFlag(DefaultParameterized)
467467
case INSUPERCALL => addFlag(InSuperCall)
468+
case STABLE => addFlag(Stable)
468469
case PRIVATEqualified =>
469470
readByte()
470471
privateWithin = readType().typeSymbol

test/dotc/tests.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,4 +231,5 @@ class tests extends CompilerTest {
231231
@Test def tasty_dotc_reporting = compileDir(dotcDir, "reporting", testPickling)
232232
@Test def tasty_dotc_util = compileDir(dotcDir, "util", testPickling)
233233
@Test def tasty_tools_io = compileDir(toolsDir, "io", testPickling)
234+
@Test def tasty_tests = compileDir(testsDir, "tasty", testPickling)
234235
}

tests/tasty/i982.scala

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
trait Z {
2+
type Q
3+
def test: Q
4+
}
5+
class X(val x: Z)
6+
class Y(x: Z) extends X(x) {
7+
x.test
8+
}

0 commit comments

Comments
 (0)