diff options
author | odersky <odersky@gmail.com> | 2017-04-13 12:28:17 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-04-13 12:28:17 +0200 |
commit | 6b041ee7b5df98a84c3fbf31b8392fe77152529d (patch) | |
tree | ac7856bb41ae216d5aa2972d3e26b02badc9292f /compiler/src/dotty/tools/dotc/core | |
parent | b8ed254e38480eb8892eccd897d525d977d9e6a7 (diff) | |
parent | aaff621f552e6824db4f7c1d73d9e8941e088d96 (diff) | |
download | dotty-6b041ee7b5df98a84c3fbf31b8392fe77152529d.tar.gz dotty-6b041ee7b5df98a84c3fbf31b8392fe77152529d.tar.bz2 dotty-6b041ee7b5df98a84c3fbf31b8392fe77152529d.zip |
Merge pull request #2209 from dotty-staging/fix-#2152
Fix #2152: Instantiate dependent result type parameters
Diffstat (limited to 'compiler/src/dotty/tools/dotc/core')
-rw-r--r-- | compiler/src/dotty/tools/dotc/core/NameKinds.scala | 2 | ||||
-rw-r--r-- | compiler/src/dotty/tools/dotc/core/TypeOps.scala | 7 | ||||
-rw-r--r-- | compiler/src/dotty/tools/dotc/core/Types.scala | 2 |
3 files changed, 8 insertions, 3 deletions
diff --git a/compiler/src/dotty/tools/dotc/core/NameKinds.scala b/compiler/src/dotty/tools/dotc/core/NameKinds.scala index 0f08e4701..81ac3a02f 100644 --- a/compiler/src/dotty/tools/dotc/core/NameKinds.scala +++ b/compiler/src/dotty/tools/dotc/core/NameKinds.scala @@ -209,7 +209,7 @@ object NameKinds { val InlineAccessorName = new UniqueNameKind("$_inlineAccessor_$") val TempResultName = new UniqueNameKind("ev$") val EvidenceParamName = new UniqueNameKind("evidence$") - val DepParamName = new UniqueNameKind("<param>") + val DepParamName = new UniqueNameKind("(param)") val LazyImplicitName = new UniqueNameKind("$_lazy_implicit_$") val LazyLocalName = new UniqueNameKind("$lzy") val LazyLocalInitName = new UniqueNameKind("$lzyINIT") diff --git a/compiler/src/dotty/tools/dotc/core/TypeOps.scala b/compiler/src/dotty/tools/dotc/core/TypeOps.scala index 9593bfe93..4a1c3d044 100644 --- a/compiler/src/dotty/tools/dotc/core/TypeOps.scala +++ b/compiler/src/dotty/tools/dotc/core/TypeOps.scala @@ -7,6 +7,7 @@ import SymDenotations._, Denotations.SingleDenotation import config.Printers.typr import util.Positions._ import NameOps._ +import NameKinds.DepParamName import Decorators._ import StdNames._ import Annotations._ @@ -158,7 +159,11 @@ trait TypeOps { this: Context => // TODO: Make standalone object. case tp1 => tp1 } case tp: TypeParamRef => - typerState.constraint.typeVarOfParam(tp) orElse tp + if (tp.paramName.is(DepParamName)) { + val bounds = ctx.typeComparer.bounds(tp) + if (bounds.lo.isRef(defn.NothingClass)) bounds.hi else bounds.lo + } + else typerState.constraint.typeVarOfParam(tp) orElse tp case _: ThisType | _: BoundType | NoPrefix => tp case tp: RefinedType => diff --git a/compiler/src/dotty/tools/dotc/core/Types.scala b/compiler/src/dotty/tools/dotc/core/Types.scala index c8c1886cc..955a5a11c 100644 --- a/compiler/src/dotty/tools/dotc/core/Types.scala +++ b/compiler/src/dotty/tools/dotc/core/Types.scala @@ -3509,7 +3509,7 @@ object Types { def apply(tp: Type): Type - protected var variance = 1 + protected[core] var variance = 1 protected def derivedSelect(tp: NamedType, pre: Type): Type = tp.derivedSelect(pre) |