Skip to content

Pickle the Erased modifier #4134

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 18, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions compiler/src/dotty/tools/dotc/core/tasty/TastyFormat.scala
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ object TastyFormat {

final val header = Array(0x5C, 0xA1, 0xAB, 0x1F)
val MajorVersion = 5
val MinorVersion = 0
val MinorVersion = 1

/** Tags used to serialize names */
class NameTags {
Expand Down Expand Up @@ -299,6 +299,7 @@ object TastyFormat {
final val DEFAULTparameterized = 30
final val STABLE = 31
final val MACRO = 32
final val ERASED = 33

// Cat. 2: tag Nat

Expand Down Expand Up @@ -424,7 +425,7 @@ object TastyFormat {

/** Useful for debugging */
def isLegalTag(tag: Int) =
firstSimpleTreeTag <= tag && tag <= MACRO ||
firstSimpleTreeTag <= tag && tag <= ERASED ||
firstNatTreeTag <= tag && tag <= SYMBOLconst ||
firstASTTreeTag <= tag && tag <= SINGLETONtpt ||
firstNatASTTreeTag <= tag && tag <= NAMEDARG ||
Expand All @@ -442,6 +443,7 @@ object TastyFormat {
| SEALED
| CASE
| IMPLICIT
| ERASED
| LAZY
| OVERRIDE
| INLINE
Expand Down Expand Up @@ -496,6 +498,7 @@ object TastyFormat {
case SEALED => "SEALED"
case CASE => "CASE"
case IMPLICIT => "IMPLICIT"
case ERASED => "ERASED"
case LAZY => "LAZY"
case OVERRIDE => "OVERRIDE"
case INLINE => "INLINE"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ class TastyPrinter(bytes: Array[Byte])(implicit ctx: Context) {
printName(); printTree(); printTrees()
case RETURN | HOLE =>
printNat(); printTrees()
case METHODtype | POLYtype | TYPELAMBDAtype =>
case METHODtype | IMPLICITMETHODtype | ERASEDMETHODtype | ERASEDIMPLICITMETHODtype | POLYtype | TYPELAMBDAtype =>
printTree()
until(end) { printName(); printTree() }
case PARAMtype =>
Expand Down
1 change: 1 addition & 0 deletions compiler/src/dotty/tools/dotc/core/tasty/TreePickler.scala
Original file line number Diff line number Diff line change
Expand Up @@ -593,6 +593,7 @@ class TreePickler(pickler: TastyPickler) {
if (flags is Scala2x) writeByte(SCALA2X)
if (sym.isTerm) {
if (flags is Implicit) writeByte(IMPLICIT)
if (flags is Erased) writeByte(ERASED)
if ((flags is Lazy) && !(sym is Module)) writeByte(LAZY)
if (flags is AbsOverride) { writeByte(ABSTRACT); writeByte(OVERRIDE) }
if (flags is Mutable) writeByte(MUTABLE)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -565,6 +565,7 @@ class TreeUnpickler(reader: TastyReader,
case SEALED => addFlag(Sealed)
case CASE => addFlag(Case)
case IMPLICIT => addFlag(Implicit)
case ERASED => addFlag(Erased)
case LAZY => addFlag(Lazy)
case OVERRIDE => addFlag(Override)
case INLINE => addFlag(Inline)
Expand Down
8 changes: 0 additions & 8 deletions compiler/test/dotty/tools/dotc/FromTastyTests.scala
Original file line number Diff line number Diff line change
Expand Up @@ -104,14 +104,6 @@ class FromTastyTests extends ParallelTesting {
"phantom-poly-2.scala",
"phantom-poly-3.scala",
"phantom-poly-4.scala",

// Issue with JFunction1$mcI$sp/T
"erased-15.scala",
"erased-17.scala",
"erased-20.scala",
"erased-21.scala",
"erased-23.scala",
"erased-value-class.scala",
)
)
step1.checkCompile() // Compile all files to generate the class files with tasty
Expand Down