Skip to content

Change/simplify tasty #638

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 3 commits into from
Jun 19, 2015
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
58 changes: 26 additions & 32 deletions src/dotty/tools/dotc/core/tasty/TastyFormat.scala
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,6 @@ Standard-Section: "ASTs" TopLevelStat*
TERMREF possiblySigned_NameRef qual_Type
THIS clsRef_Type
REFINEDthis refinedType_ASTRef
SKOLEMtype Type_ASTRef
SHARED path_ASTRef

Constant = UNITconst
Expand Down Expand Up @@ -158,7 +157,6 @@ Standard-Section: "ASTs" TopLevelStat*
LAZY
OVERRIDE
INLINE // macro
ABSOVERRIDE // abstract override
STATIC // mapped to static Java member
OBJECT // an object or its class
TRAIT // a trait
Expand Down Expand Up @@ -239,39 +237,37 @@ object TastyFormat {
final val LAZY = 14
final val OVERRIDE = 15
final val INLINE = 16
final val ABSOVERRIDE = 17
final val STATIC = 18
final val OBJECT = 19
final val TRAIT = 20
final val LOCAL = 21
final val SYNTHETIC = 22
final val ARTIFACT = 23
final val MUTABLE = 24
final val LABEL = 25
final val FIELDaccessor = 26
final val CASEaccessor = 27
final val COVARIANT = 28
final val CONTRAVARIANT = 29
final val SCALA2X = 30
final val DEFAULTparameterized = 31
final val INSUPERCALL = 32
final val STATIC = 17
final val OBJECT = 18
final val TRAIT = 19
final val LOCAL = 20
final val SYNTHETIC = 21
final val ARTIFACT = 22
final val MUTABLE = 23
final val LABEL = 24
final val FIELDaccessor = 25
final val CASEaccessor = 26
final val COVARIANT = 27
final val CONTRAVARIANT = 28
final val SCALA2X = 29
final val DEFAULTparameterized = 30
final val INSUPERCALL = 31

final val SHARED = 64
final val TERMREFdirect = 65
final val TYPEREFdirect = 66
final val TERMREFpkg = 67
final val TYPEREFpkg = 68
final val SKOLEMtype = 69
final val REFINEDthis = 70
final val BYTEconst = 71
final val SHORTconst = 72
final val CHARconst = 73
final val INTconst = 74
final val LONGconst = 75
final val FLOATconst = 76
final val DOUBLEconst = 77
final val STRINGconst = 78
final val IMPORTED = 79
final val REFINEDthis = 69
final val BYTEconst = 70
final val SHORTconst = 71
final val CHARconst = 72
final val INTconst = 73
final val LONGconst = 74
final val FLOATconst = 75
final val DOUBLEconst = 76
final val STRINGconst = 77
final val IMPORTED = 78

final val THIS = 96
final val CLASSconst = 97
Expand Down Expand Up @@ -351,7 +347,6 @@ object TastyFormat {
| LAZY
| OVERRIDE
| INLINE
| ABSOVERRIDE
| STATIC
| OBJECT
| TRAIT
Expand Down Expand Up @@ -399,7 +394,6 @@ object TastyFormat {
case LAZY => "LAZY"
case OVERRIDE => "OVERRIDE"
case INLINE => "INLINE"
case ABSOVERRIDE => "ABSOVERRIDE"
case STATIC => "STATIC"
case OBJECT => "OBJECT"
case TRAIT => "TRAIT"
Expand All @@ -421,7 +415,7 @@ object TastyFormat {
case TYPEREFdirect => "TYPEREFdirect"
case TERMREFpkg => "TERMREFpkg"
case TYPEREFpkg => "TYPEREFpkg"
case SKOLEMtype => "SKOLEMtype"
case REFINEDthis => "REFINEDthis"
case BYTEconst => "BYTEconst"
case SHORTconst => "SHORTconst"
case CHARconst => "CHARconst"
Expand Down
3 changes: 1 addition & 2 deletions src/dotty/tools/dotc/core/tasty/TreePickler.scala
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,6 @@ class TreePickler(pickler: TastyPickler) {
writeByte(REFINEDthis)
writeRef(pickledTypes.get(tpe.binder).asInstanceOf[Addr])
case tpe: SkolemType =>
writeByte(SKOLEMtype)
pickleType(tpe.info)
case tpe: RefinedType =>
val args = tpe.argInfos(interpolate = false)
Expand Down Expand Up @@ -523,7 +522,7 @@ class TreePickler(pickler: TastyPickler) {
if (sym.isTerm) {
if (flags is Implicit) writeByte(IMPLICIT)
if ((flags is Lazy) && !(sym is Module)) writeByte(LAZY)
if (flags is AbsOverride) writeByte(ABSOVERRIDE)
if (flags is AbsOverride) { writeByte(ABSTRACT); writeByte(OVERRIDE) }
if (flags is Mutable) writeByte(MUTABLE)
if (flags is Accessor) writeByte(FIELDaccessor)
if (flags is CaseAccessor) writeByte(CASEaccessor)
Expand Down
10 changes: 6 additions & 4 deletions src/dotty/tools/dotc/core/tasty/TreeUnpickler.scala
Original file line number Diff line number Diff line change
Expand Up @@ -256,8 +256,6 @@ class TreeUnpickler(reader: TastyReader, tastyName: TastyName.Table) {
ThisType.raw(readType().asInstanceOf[TypeRef])
case REFINEDthis =>
RefinedThis(readTypeRef().asInstanceOf[RefinedType])
case SKOLEMtype =>
SkolemType(readTypeRef())
case SHARED =>
val ref = readAddr()
typeAtAddr.getOrElseUpdate(ref, forkAt(ref).readType())
Expand Down Expand Up @@ -429,15 +427,19 @@ class TreeUnpickler(reader: TastyReader, tastyName: TastyName.Table) {
case PRIVATE => addFlag(Private)
case INTERNAL => ??? // addFlag(Internal)
case PROTECTED => addFlag(Protected)
case ABSTRACT => addFlag(Abstract)
case ABSTRACT =>
readByte()
nextByte match {
case OVERRIDE => addFlag(AbsOverride)
case _ => flags |= Abstract
}
case FINAL => addFlag(Final)
case SEALED => addFlag(Sealed)
case CASE => addFlag(Case)
case IMPLICIT => addFlag(Implicit)
case LAZY => addFlag(Lazy)
case OVERRIDE => addFlag(Override)
case INLINE => addFlag(Inline)
case ABSOVERRIDE => addFlag(AbsOverride)
case STATIC => addFlag(JavaStatic)
case OBJECT => addFlag(Module)
case TRAIT => addFlag(Trait)
Expand Down
3 changes: 2 additions & 1 deletion src/dotty/tools/dotc/printing/PlainPrinter.scala
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,8 @@ class PlainPrinter(_ctx: Context) extends Printer {
case tp: RefinedThis =>
s"${nameString(tp.binder.typeSymbol)}{...}.this"
case tp: SkolemType =>
"<unknown instance of type " ~ toTextGlobal(tp.info) ~ ">"
if (homogenizedView) toText(tp.info)
else "<unknown instance of type " ~ toTextGlobal(tp.info) ~ ">"
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/dotty/tools/dotc/printing/RefinedPrinter.scala
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ class RefinedPrinter(_ctx: Context) extends PlainPrinter(_ctx) {
*
* The body is simplified as follows
* - if it is a TypeAlias, follow it
* - replace all references to of the form <skolem>.HK$i by references
* - replace all references to of the form <refined-this>.HK$i by references
* without a prefix, because the latter print nicer.
*
*/
Expand Down