aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools
diff options
context:
space:
mode:
authorGuillaume Martres <smarter@ubuntu.com>2016-02-06 16:22:31 +0100
committerGuillaume Martres <smarter@ubuntu.com>2016-02-06 16:22:31 +0100
commitffcc27baddb02f3c92e9d22ddfb56d0d30f277d8 (patch)
tree8a7a24b5fe18abc4917a32790a1ef0b7fa247abc /src/dotty/tools
parent2c08c72a7f9b968e1f659d1d3d811f3166524983 (diff)
parent534e4ad9f6ef1dfb767adc89c9544484cab4f48a (diff)
downloaddotty-ffcc27baddb02f3c92e9d22ddfb56d0d30f277d8.tar.gz
dotty-ffcc27baddb02f3c92e9d22ddfb56d0d30f277d8.tar.bz2
dotty-ffcc27baddb02f3c92e9d22ddfb56d0d30f277d8.zip
Merge pull request #1064 from dotty-staging/fix-#1044-take-3
Third try for a fix for #1044: handle TypevarsMissContext mode in wildApprox
Diffstat (limited to 'src/dotty/tools')
-rw-r--r--src/dotty/tools/dotc/typer/Implicits.scala2
-rw-r--r--src/dotty/tools/dotc/typer/ProtoTypes.scala14
2 files changed, 11 insertions, 5 deletions
diff --git a/src/dotty/tools/dotc/typer/Implicits.scala b/src/dotty/tools/dotc/typer/Implicits.scala
index 280cc40e9..6cb1f1271 100644
--- a/src/dotty/tools/dotc/typer/Implicits.scala
+++ b/src/dotty/tools/dotc/typer/Implicits.scala
@@ -52,6 +52,8 @@ object Implicits {
mt.paramTypes.length != 1 ||
!(argType relaxed_<:< mt.paramTypes.head)(ctx.fresh.setExploreTyperState)
case poly: PolyType =>
+ // We do not need to call ProtoTypes#constrained on `poly` because
+ // `refMatches` is always called with mode TypevarsMissContext enabled.
poly.resultType match {
case mt: MethodType =>
mt.isImplicit ||
diff --git a/src/dotty/tools/dotc/typer/ProtoTypes.scala b/src/dotty/tools/dotc/typer/ProtoTypes.scala
index db196f0c2..8a758bcc8 100644
--- a/src/dotty/tools/dotc/typer/ProtoTypes.scala
+++ b/src/dotty/tools/dotc/typer/ProtoTypes.scala
@@ -391,11 +391,15 @@ object ProtoTypes {
case tp: TypeAlias => // default case, inlined for speed
tp.derivedTypeAlias(wildApprox(tp.alias, theMap))
case tp @ PolyParam(poly, pnum) =>
- ctx.typerState.constraint.entry(tp) match {
- case bounds: TypeBounds => wildApprox(WildcardType(bounds))
- case NoType => WildcardType(wildApprox(poly.paramBounds(pnum)).bounds)
- case inst => wildApprox(inst)
- }
+ def unconstrainedApprox = WildcardType(wildApprox(poly.paramBounds(pnum)).bounds)
+ if (ctx.mode.is(Mode.TypevarsMissContext))
+ unconstrainedApprox
+ else
+ ctx.typerState.constraint.entry(tp) match {
+ case bounds: TypeBounds => wildApprox(WildcardType(bounds))
+ case NoType => unconstrainedApprox
+ case inst => wildApprox(inst)
+ }
case MethodParam(mt, pnum) =>
WildcardType(TypeBounds.upper(wildApprox(mt.paramTypes(pnum))))
case tp: TypeVar =>