Skip to content

Commit 4808f47

Browse files
committed
wip 7: pickle both signatures
1 parent 5597657 commit 4808f47

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
@@ -1177,13 +1177,6 @@ class TreeUnpickler(reader: TastyReader,
11771177
val levels = readNat()
11781178
readTerm().outerSelect(levels, SkolemType(readType()))
11791179
case SELECTin =>
1180-
// tests/run/hashsetremove.scala failed
1181-
import java.io._
1182-
import java.nio.charset.StandardCharsets
1183-
def writeBytes( data : String, file : File ) = {
1184-
val target = new BufferedOutputStream( new FileOutputStream(file) );
1185-
try target.write(data.getBytes(StandardCharsets.UTF_8)) finally target.close;
1186-
}
11871180
var symname = readName()
11881181
var precisesig = readName() match
11891182
case SignedName(_, sig, _) => sig
@@ -1204,14 +1197,6 @@ class TreeUnpickler(reader: TastyReader,
12041197
d.atSignature(precisesig, target).isInstanceOf[MultiDenotation]
12051198
case _ => false
12061199
if isAmbiguous then
1207-
// writeBytes(TastyPrinter.show(reader.bytes), new File("WOW123.txt"))
1208-
// val d0 = pre.nonPrivateMember(name)
1209-
// val d0_1 = d0.atSignature(sig, target)
1210-
// val d0_2 = d0_1.asSeenFrom(pre)
1211-
// val d1 = space.decl(name)
1212-
// val d1_1 = d1.atSignature(sig, target)
1213-
// val d1_2 = d1_1.asSeenFrom(pre)
1214-
// report.echo(s"[$d0, $d0_1, $d0_2] [$d1, $d1_1, $d1_2]")
12151200
makeSelect(qual, name, space.decl(name).atSignature(sig, target).asSeenFrom(pre))
12161201
else
12171202
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
@@ -709,8 +709,8 @@ object TastyFormat {
709709
*/
710710
def numRefs(tag: Int): Int = tag match {
711711
case VALDEF | DEFDEF | TYPEDEF | TYPEPARAM | PARAM | NAMEDARG | RETURN | BIND |
712-
SELFDEF | REFINEDtype | TERMREFin | TYPEREFin | SELECTin | HOLE => 1
713-
case RENAMED | PARAMtype => 2
712+
SELFDEF | REFINEDtype | TERMREFin | TYPEREFin | HOLE => 1
713+
case RENAMED | PARAMtype | SELECTin => 2
714714
case POLYtype | TYPELAMBDAtype | METHODtype => -1
715715
case _ => 0
716716
}

tests/pos-tmp/hashsetremove.scala

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

0 commit comments

Comments
 (0)