aboutsummaryrefslogtreecommitdiff
path: root/src/dotty
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2016-11-17 18:56:16 +0100
committerMartin Odersky <odersky@gmail.com>2016-11-17 18:56:16 +0100
commit5637720ea8769faa86b2cfedbfe9fe705e3f5b28 (patch)
treee8e2c8fee9df05fa10d54e78464532122e214dec /src/dotty
parentfe20b9064fca765a38345a09aa484bfb537aa3c0 (diff)
downloaddotty-5637720ea8769faa86b2cfedbfe9fe705e3f5b28.tar.gz
dotty-5637720ea8769faa86b2cfedbfe9fe705e3f5b28.tar.bz2
dotty-5637720ea8769faa86b2cfedbfe9fe705e3f5b28.zip
Address reviewer's comments.
Diffstat (limited to 'src/dotty')
-rw-r--r--src/dotty/tools/dotc/core/tasty/TastyFormat.scala4
-rw-r--r--src/dotty/tools/dotc/core/tasty/TastyPickler.scala9
-rw-r--r--src/dotty/tools/dotc/core/tasty/TreeBuffer.scala5
-rw-r--r--src/dotty/tools/dotc/core/tasty/TreePickler.scala2
-rw-r--r--src/dotty/tools/dotc/printing/RefinedPrinter.scala4
5 files changed, 11 insertions, 13 deletions
diff --git a/src/dotty/tools/dotc/core/tasty/TastyFormat.scala b/src/dotty/tools/dotc/core/tasty/TastyFormat.scala
index 80bd39841..5e84c7428 100644
--- a/src/dotty/tools/dotc/core/tasty/TastyFormat.scala
+++ b/src/dotty/tools/dotc/core/tasty/TastyFormat.scala
@@ -89,10 +89,10 @@ Standard-Section: "ASTs" TopLevelStat*
BIND Length boundName_NameRef patType_Type pat_Term
ALTERNATIVE Length alt_Term*
UNAPPLY Length fun_Term ImplicitArg* pat_Type pat_Term*
- IDENTtpt NameRef Type // used when type ident's type is not a TypeRef
+ IDENTtpt NameRef Type // used for all type idents
SELECTtpt NameRef qual_Term
SINGLETONtpt Path
- REFINDtpt Length underlying_Term refinement_Stat*
+ REFINEDtpt Length underlying_Term refinement_Stat*
APPLIEDtpt Length tycon_Term arg_Term*
POLYtpt Length TypeParam* body_Term
TYPEBOUNDStpt Length low_Term high_Term
diff --git a/src/dotty/tools/dotc/core/tasty/TastyPickler.scala b/src/dotty/tools/dotc/core/tasty/TastyPickler.scala
index 55fe232c0..c750a7bb3 100644
--- a/src/dotty/tools/dotc/core/tasty/TastyPickler.scala
+++ b/src/dotty/tools/dotc/core/tasty/TastyPickler.scala
@@ -54,12 +54,9 @@ class TastyPickler {
all.bytes
}
- /**
- * Addresses in TASTY file of trees, stored by pickling.
- * Note that trees are checked for reference equality,
- * so one can reliably use this function only directly after `pickler`.
- * Note that a tree can have several addresses, if it is shared,
- * i.e. accessible from different paths. Any such sharing is undone by pickling.
+ /** The address in the TASTY file of a given tree, or None if unknown.
+ * Note that trees are looked up by for reference equality,
+ * so one can reliably use this function only directly after `pickler`.
*/
var addrOfTree: tpd.Tree => Option[Addr] = (_ => None)
diff --git a/src/dotty/tools/dotc/core/tasty/TreeBuffer.scala b/src/dotty/tools/dotc/core/tasty/TreeBuffer.scala
index 67dc6076f..6c7982d78 100644
--- a/src/dotty/tools/dotc/core/tasty/TreeBuffer.scala
+++ b/src/dotty/tools/dotc/core/tasty/TreeBuffer.scala
@@ -17,10 +17,7 @@ class TreeBuffer extends TastyBuffer(50000) {
private var delta: Array[Int] = _
private var numOffsets = 0
- /** A map from trees to the address(es) at which a tree is pickled. There may be several
- * such addresses if the tree is shared. To keep the map compact, the value type is a
- * disjunction of a single address (which is the common case) and a list of addresses.
- */
+ /** A map from trees to the address at which a tree is pickled. */
private val treeAddrs = new java.util.IdentityHashMap[Tree, Any] // really: Addr | Null
def registerTreeAddr(tree: Tree): Addr = treeAddrs.get(tree) match {
diff --git a/src/dotty/tools/dotc/core/tasty/TreePickler.scala b/src/dotty/tools/dotc/core/tasty/TreePickler.scala
index 1838bc5bb..279ab5026 100644
--- a/src/dotty/tools/dotc/core/tasty/TreePickler.scala
+++ b/src/dotty/tools/dotc/core/tasty/TreePickler.scala
@@ -537,7 +537,7 @@ class TreePickler(pickler: TastyPickler) {
}
case AppliedTypeTree(tycon, args) =>
writeByte(APPLIEDtpt)
- withLength { pickleTree(tycon); args.foreach(pickleTree(_)) }
+ withLength { pickleTree(tycon); args.foreach(pickleTree) }
case AndTypeTree(tp1, tp2) =>
writeByte(ANDtpt)
withLength { pickleTree(tp1); pickleTree(tp2) }
diff --git a/src/dotty/tools/dotc/printing/RefinedPrinter.scala b/src/dotty/tools/dotc/printing/RefinedPrinter.scala
index 4818c6eee..279dda9a1 100644
--- a/src/dotty/tools/dotc/printing/RefinedPrinter.scala
+++ b/src/dotty/tools/dotc/printing/RefinedPrinter.scala
@@ -148,6 +148,10 @@ class RefinedPrinter(_ctx: Context) extends PlainPrinter(_ctx) {
case JavaArrayType(elemtp) =>
return toText(elemtp) ~ "[]"
case tp: AnnotatedType if homogenizedView =>
+ // Positions of annotations in types are not serialized
+ // (they don;t need to because we keep the original type tree with
+ // the original annotation anyway. Therefore, there will always be
+ // one version of the annotation tree that has the correct positions).
withoutPos(super.toText(tp))
case tp: SelectionProto =>
return "?{ " ~ toText(tp.name) ~ (" " provided !tp.name.decode.last.isLetterOrDigit) ~