From b89738672662863168453a1bd6c6c47a6ff07f11 Mon Sep 17 00:00:00 2001 From: Martin Odersky Date: Tue, 14 Feb 2017 16:53:41 +0100 Subject: Avoid automatism for passing variances to PolyTypes We used to "fill-in" with zeroes if variances were missing. I now think that;'s too error-prone. Better define all variances explicitly. --- compiler/src/dotty/tools/dotc/core/Definitions.scala | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'compiler/src/dotty/tools/dotc/core/Definitions.scala') diff --git a/compiler/src/dotty/tools/dotc/core/Definitions.scala b/compiler/src/dotty/tools/dotc/core/Definitions.scala index 2797bb8a6..c61e92f3a 100644 --- a/compiler/src/dotty/tools/dotc/core/Definitions.scala +++ b/compiler/src/dotty/tools/dotc/core/Definitions.scala @@ -9,6 +9,7 @@ import scala.annotation.{ switch, meta } import scala.collection.{ mutable, immutable } import PartialFunction._ import collection.mutable +import util.common.alwaysZero import scala.reflect.api.{ Universe => ApiUniverse } object Definitions { @@ -152,7 +153,7 @@ class Definitions { resultTypeFn: PolyType => Type, flags: FlagSet = EmptyFlags) = { val tparamNames = tpnme.syntheticTypeParamNames(typeParamCount) val tparamBounds = tparamNames map (_ => TypeBounds.empty) - val ptype = PolyType(tparamNames)(_ => tparamBounds, resultTypeFn) + val ptype = PolyType(tparamNames, tparamNames.map(alwaysZero))(_ => tparamBounds, resultTypeFn) enterMethod(cls, name, ptype, flags) } -- cgit v1.2.3