From 98b466c14cda8ea5a9d2e8efdfada5b735bb4d95 Mon Sep 17 00:00:00 2001 From: Martin Odersky Date: Mon, 20 Jun 2016 13:01:16 +0200 Subject: Ensure wildApprox maintains kinds When approximating the constructor of an ak apply to a wildcard type, approximate the whole application by WildcardType. Otherwise we might have a wildcardtype with hk bounds as result. --- src/dotty/tools/dotc/typer/ProtoTypes.scala | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/dotty/tools/dotc/typer/ProtoTypes.scala') diff --git a/src/dotty/tools/dotc/typer/ProtoTypes.scala b/src/dotty/tools/dotc/typer/ProtoTypes.scala index 9a1337022..3a13212a3 100644 --- a/src/dotty/tools/dotc/typer/ProtoTypes.scala +++ b/src/dotty/tools/dotc/typer/ProtoTypes.scala @@ -405,6 +405,11 @@ object ProtoTypes { WildcardType(TypeBounds.upper(wildApprox(mt.paramTypes(pnum)))) case tp: TypeVar => wildApprox(tp.underlying) + case tp @ HKApply(tycon, args) => + wildApprox(tycon) match { + case _: WildcardType => WildcardType // this ensures we get a * type + case tycon1 => tp.derivedAppliedType(tycon1, args.mapConserve(wildApprox(_))) + } case tp: AndType => val tp1a = wildApprox(tp.tp1) val tp2a = wildApprox(tp.tp2) -- cgit v1.2.3