Skip to content

Commit b34d57c

Browse files
committed
Don't keep SkolemTypes in TASTY
SkolemTypes are no longer needed when Pickling because they exist only for checking type-safety. After the typer, we can safely eliminate them. Not having skolem types in TASTY simplifies the format and avoids having to explain a difficult concept.
1 parent d982038 commit b34d57c

File tree

5 files changed

+14
-18
lines changed

5 files changed

+14
-18
lines changed

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

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,6 @@ Standard-Section: "ASTs" TopLevelStat*
104104
TERMREF possiblySigned_NameRef qual_Type
105105
THIS clsRef_Type
106106
REFINEDthis refinedType_ASTRef
107-
SKOLEMtype Type_ASTRef
108107
SHARED path_ASTRef
109108
110109
Constant = UNITconst
@@ -261,17 +260,16 @@ object TastyFormat {
261260
final val TYPEREFdirect = 66
262261
final val TERMREFpkg = 67
263262
final val TYPEREFpkg = 68
264-
final val SKOLEMtype = 69
265-
final val REFINEDthis = 70
266-
final val BYTEconst = 71
267-
final val SHORTconst = 72
268-
final val CHARconst = 73
269-
final val INTconst = 74
270-
final val LONGconst = 75
271-
final val FLOATconst = 76
272-
final val DOUBLEconst = 77
273-
final val STRINGconst = 78
274-
final val IMPORTED = 79
263+
final val REFINEDthis = 69
264+
final val BYTEconst = 70
265+
final val SHORTconst = 71
266+
final val CHARconst = 72
267+
final val INTconst = 73
268+
final val LONGconst = 74
269+
final val FLOATconst = 75
270+
final val DOUBLEconst = 76
271+
final val STRINGconst = 77
272+
final val IMPORTED = 78
275273

276274
final val THIS = 96
277275
final val CLASSconst = 97
@@ -421,7 +419,7 @@ object TastyFormat {
421419
case TYPEREFdirect => "TYPEREFdirect"
422420
case TERMREFpkg => "TERMREFpkg"
423421
case TYPEREFpkg => "TYPEREFpkg"
424-
case SKOLEMtype => "SKOLEMtype"
422+
case REFINEDthis => "REFINEDthis"
425423
case BYTEconst => "BYTEconst"
426424
case SHORTconst => "SHORTconst"
427425
case CHARconst => "CHARconst"

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,6 @@ class TreePickler(pickler: TastyPickler) {
202202
writeByte(REFINEDthis)
203203
writeRef(pickledTypes.get(tpe.binder).asInstanceOf[Addr])
204204
case tpe: SkolemType =>
205-
writeByte(SKOLEMtype)
206205
pickleType(tpe.info)
207206
case tpe: RefinedType =>
208207
val args = tpe.argInfos(interpolate = false)

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -256,8 +256,6 @@ class TreeUnpickler(reader: TastyReader, tastyName: TastyName.Table) {
256256
ThisType.raw(readType().asInstanceOf[TypeRef])
257257
case REFINEDthis =>
258258
RefinedThis(readTypeRef().asInstanceOf[RefinedType])
259-
case SKOLEMtype =>
260-
SkolemType(readTypeRef())
261259
case SHARED =>
262260
val ref = readAddr()
263261
typeAtAddr.getOrElseUpdate(ref, forkAt(ref).readType())

src/dotty/tools/dotc/printing/PlainPrinter.scala

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,8 @@ class PlainPrinter(_ctx: Context) extends Printer {
231231
case tp: RefinedThis =>
232232
s"${nameString(tp.binder.typeSymbol)}{...}.this"
233233
case tp: SkolemType =>
234-
"<unknown instance of type " ~ toTextGlobal(tp.info) ~ ">"
234+
if (homogenizedView) toText(tp.info)
235+
else "<unknown instance of type " ~ toTextGlobal(tp.info) ~ ">"
235236
}
236237
}
237238

src/dotty/tools/dotc/printing/RefinedPrinter.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ class RefinedPrinter(_ctx: Context) extends PlainPrinter(_ctx) {
179179
*
180180
* The body is simplified as follows
181181
* - if it is a TypeAlias, follow it
182-
* - replace all references to of the form <skolem>.HK$i by references
182+
* - replace all references to of the form <refined-this>.HK$i by references
183183
* without a prefix, because the latter print nicer.
184184
*
185185
*/

0 commit comments

Comments
 (0)