Skip to content

Commit d5f699a

Browse files
committed
wip 7: pickle both signatures
1 parent 5e6944a commit d5f699a

File tree

6 files changed

+6
-48
lines changed

6 files changed

+6
-48
lines changed

compiler/src/dotty/tools/dotc/core/tasty/TastyPrinter.scala

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,9 @@ class TastyPrinter(bytes: Array[Byte]) {
9090
printName(); printName()
9191
case VALDEF | DEFDEF | TYPEDEF | TYPEPARAM | PARAM | NAMEDARG | BIND =>
9292
printName(); printTrees()
93-
case REFINEDtype | TERMREFin | TYPEREFin | SELECTin =>
93+
case SELECTin =>
94+
printName(); printName(); printTree(); printTrees()
95+
case REFINEDtype | TERMREFin | TYPEREFin =>
9496
printName(); printTree(); printTrees()
9597
case RETURN | HOLE =>
9698
printNat(); printTrees()

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

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -409,11 +409,6 @@ class TreePickler(pickler: TastyPickler) {
409409
case _ =>
410410
val sig = tree.tpe.signature
411411
var ename = tree.symbol.targetName
412-
// val isAmbiguous =
413-
// sig != Signature.NotAMethod
414-
// && qual.tpe.nonPrivateMember(name).match
415-
// case d: MultiDenotation => d.atSignature(sig, ename).isInstanceOf[MultiDenotation]
416-
// case _ => false
417412
if name.isTypeName then
418413
writeByte(SELECTtpt)
419414
pickleNameAndSig(name, sig, ename)
@@ -424,7 +419,7 @@ class TreePickler(pickler: TastyPickler) {
424419
pickleNameAndSig(name, tree.symbol.signature, ename)
425420
pickleNameAndSig(name, sig, ename)
426421
pickleTree(qual)
427-
if tree.symbol.exists then
422+
if tree.symbol.exists then // TODO: `1.unary_+` has no symbol
428423
pickleType(tree.symbol.owner.typeRef)
429424
}
430425
}

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

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1179,13 +1179,6 @@ class TreeUnpickler(reader: TastyReader,
11791179
val levels = readNat()
11801180
readTerm().outerSelect(levels, SkolemType(readType()))
11811181
case SELECTin =>
1182-
// tests/run/hashsetremove.scala failed
1183-
import java.io._
1184-
import java.nio.charset.StandardCharsets
1185-
def writeBytes( data : String, file : File ) = {
1186-
val target = new BufferedOutputStream( new FileOutputStream(file) );
1187-
try target.write(data.getBytes(StandardCharsets.UTF_8)) finally target.close;
1188-
}
11891182
var symname = readName()
11901183
var precisesig = readName() match
11911184
case SignedName(_, sig, _) => sig
@@ -1206,14 +1199,6 @@ class TreeUnpickler(reader: TastyReader,
12061199
d.atSignature(precisesig, target).isInstanceOf[MultiDenotation]
12071200
case _ => false
12081201
if isAmbiguous then
1209-
// writeBytes(TastyPrinter.show(reader.bytes), new File("WOW123.txt"))
1210-
// val d0 = pre.nonPrivateMember(name)
1211-
// val d0_1 = d0.atSignature(sig, target)
1212-
// val d0_2 = d0_1.asSeenFrom(pre)
1213-
// val d1 = space.decl(name)
1214-
// val d1_1 = d1.atSignature(sig, target)
1215-
// val d1_2 = d1_1.asSeenFrom(pre)
1216-
// report.echo(s"[$d0, $d0_1, $d0_2] [$d1, $d1_1, $d1_2]")
12171202
makeSelect(qual, name, space.decl(name).atSignature(sig, target).asSeenFrom(pre))
12181203
else
12191204
select(name, precisesig, target)

compiler/test/dotty/tools/dotc/FromTastyTests.scala

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,6 @@ class FromTastyTests {
1313
import TestConfiguration._
1414
import FromTastyTests._
1515

16-
// @Test def posTmpTestFromTasty: Unit = {
17-
// // Can be reproduced with
18-
// // > sbt
19-
// // > scalac -Ythrough-tasty -Ycheck:all <source>
20-
21-
// implicit val testGroup: TestGroup = TestGroup("posTmpTestFromTasty")
22-
// compileTastyInDir(s"tests${JFile.separator}pos-tmp", defaultOptions,
23-
// fromTastyFilter = FileFilter.exclude(TestSources.posFromTastyBlacklisted)
24-
// ).checkCompile()
25-
// }
26-
2716
@Test def posTestFromTasty: Unit = {
2817
// Can be reproduced with
2918
// > sbt

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -806,8 +806,8 @@ object TastyFormat {
806806
*/
807807
def numRefs(tag: Int): Int = tag match {
808808
case VALDEF | DEFDEF | TYPEDEF | TYPEPARAM | PARAM | NAMEDARG | RETURN | BIND |
809-
SELFDEF | REFINEDtype | TERMREFin | TYPEREFin | SELECTin | HOLE => 1
810-
case RENAMED | PARAMtype => 2
809+
SELFDEF | REFINEDtype | TERMREFin | TYPEREFin | HOLE => 1
810+
case RENAMED | PARAMtype | SELECTin => 2
811811
case POLYtype | TYPELAMBDAtype | METHODtype => -1
812812
case _ => 0
813813
}

tests/pos-tmp/hashsetremove.scala

Lines changed: 0 additions & 13 deletions
This file was deleted.

0 commit comments

Comments
 (0)