diff options
author | Martin Odersky <odersky@gmail.com> | 2016-05-24 15:57:44 +0200 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2016-07-11 13:34:58 +0200 |
commit | 5866d0d16c79ca5c62507bdcb7d87669426e86d6 (patch) | |
tree | 8bdce25a51cb7c36656e77abce59c6f9132807ca /src/dotty/tools/dotc/core/tasty | |
parent | 6ca5b9d4675c20002ca65dab3cacf32caade3933 (diff) | |
download | dotty-5866d0d16c79ca5c62507bdcb7d87669426e86d6.tar.gz dotty-5866d0d16c79ca5c62507bdcb7d87669426e86d6.tar.bz2 dotty-5866d0d16c79ca5c62507bdcb7d87669426e86d6.zip |
Allow refinements of new types
Previously a refinement could only apply to a type bound in
the parent. This restriction needs to be dropped for the new
encoding of hk type parameters.
Diffstat (limited to 'src/dotty/tools/dotc/core/tasty')
-rw-r--r-- | src/dotty/tools/dotc/core/tasty/TastyFormat.scala | 3 | ||||
-rw-r--r-- | src/dotty/tools/dotc/core/tasty/TreePickler.scala | 6 | ||||
-rw-r--r-- | src/dotty/tools/dotc/core/tasty/TreeUnpickler.scala | 5 |
3 files changed, 11 insertions, 3 deletions
diff --git a/src/dotty/tools/dotc/core/tasty/TastyFormat.scala b/src/dotty/tools/dotc/core/tasty/TastyFormat.scala index 221170622..a42958e75 100644 --- a/src/dotty/tools/dotc/core/tasty/TastyFormat.scala +++ b/src/dotty/tools/dotc/core/tasty/TastyFormat.scala @@ -129,7 +129,7 @@ Standard-Section: "ASTs" TopLevelStat* SUPERtype Length this_Type underlying_Type REFINEDtype Length underlying_Type refinement_NameRef info_Type APPLIEDtype Length tycon_Type arg_Type* - TYPEBOUNDS Length low_Type high_Type + TYPEBOUNDS Length low_Type high_Type bindingKind_Nat? TYPEALIAS Length alias_Type (COVARIANT | CONTRAVARIANT)? ANNOTATED Length underlying_Type fullAnnotation_Term ANDtype Length left_Type right_Type @@ -494,6 +494,7 @@ object TastyFormat { SELFDEF | REFINEDtype => 1 case RENAMED | PARAMtype => 2 case POLYtype | METHODtype => -1 + case TYPEBOUNDS => -2 case _ => 0 } } diff --git a/src/dotty/tools/dotc/core/tasty/TreePickler.scala b/src/dotty/tools/dotc/core/tasty/TreePickler.scala index 37b9341eb..4cfd7727c 100644 --- a/src/dotty/tools/dotc/core/tasty/TreePickler.scala +++ b/src/dotty/tools/dotc/core/tasty/TreePickler.scala @@ -233,7 +233,11 @@ class TreePickler(pickler: TastyPickler) { } case tpe: TypeBounds => writeByte(TYPEBOUNDS) - withLength { pickleType(tpe.lo, richTypes); pickleType(tpe.hi, richTypes) } + withLength { + pickleType(tpe.lo, richTypes) + pickleType(tpe.hi, richTypes) + if (tpe.bindingKind != NoBinding) writeNat(tpe.bindingKind.n) + } case tpe: AnnotatedType => writeByte(ANNOTATED) withLength { pickleType(tpe.tpe, richTypes); pickleTree(tpe.annot.tree) } diff --git a/src/dotty/tools/dotc/core/tasty/TreeUnpickler.scala b/src/dotty/tools/dotc/core/tasty/TreeUnpickler.scala index 91ac4ea3e..2b8e5f019 100644 --- a/src/dotty/tools/dotc/core/tasty/TreeUnpickler.scala +++ b/src/dotty/tools/dotc/core/tasty/TreeUnpickler.scala @@ -266,7 +266,10 @@ class TreeUnpickler(reader: TastyReader, tastyName: TastyName.Table) { case APPLIEDtype => readType().appliedTo(until(end)(readType())) case TYPEBOUNDS => - TypeBounds(readType(), readType()) + val lo = readType() + val hi = readType() + val bk = ifBefore(end)(new BindingKind(readNat().toByte), NoBinding) + TypeBounds(lo, hi, bk) case TYPEALIAS => val alias = readType() val variance = |