diff options
author | Martin Odersky <odersky@gmail.com> | 2013-12-19 08:40:59 +0100 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2013-12-19 08:40:59 +0100 |
commit | 6be96724899f9c34db2e6c2617534dc9c4a15528 (patch) | |
tree | e396c405b43c6fc6f4fc8a124cb19acefb4dc755 /src/dotty/tools/dotc/typer/Implicits.scala | |
parent | 56d8347bcd606443dde576480325677a89f5c809 (diff) | |
download | dotty-6be96724899f9c34db2e6c2617534dc9c4a15528.tar.gz dotty-6be96724899f9c34db2e6c2617534dc9c4a15528.tar.bz2 dotty-6be96724899f9c34db2e6c2617534dc9c4a15528.zip |
Following type aliases when pattern matching.
Faced with a pattern like
Apply(x, xs)
we first look for an Apply object which is an extractor. If this fails, we now
interprete Apply as a type. If it is a type alias which points to a class type that
has a companion module, we then try that companion module as an extractor.
Scala 2.x does ot that way, and it's used widely within dotty itself. Think tpd.Apply as the found object,
Trees.Apply as the extractor.
Also, added a fix to normalization which made normalization go deep into a method type.
Diffstat (limited to 'src/dotty/tools/dotc/typer/Implicits.scala')
-rw-r--r-- | src/dotty/tools/dotc/typer/Implicits.scala | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/dotty/tools/dotc/typer/Implicits.scala b/src/dotty/tools/dotc/typer/Implicits.scala index a6cbd58d1..c236f8335 100644 --- a/src/dotty/tools/dotc/typer/Implicits.scala +++ b/src/dotty/tools/dotc/typer/Implicits.scala @@ -40,7 +40,7 @@ object Implicits { /** Return those references in `refs` that are compatible with type `pt`. */ protected def filterMatching(pt: Type)(implicit ctx: Context): List[TermRef] = track("filterMatching") { - def refMatches(ref: TermRef)(implicit ctx: Context) = isCompatible(normalize(ref), pt) + def refMatches(ref: TermRef)(implicit ctx: Context) = isCompatible(normalize(ref, pt), pt) refs filter (refMatches(_)(ctx.fresh.withExploreTyperState)) // create a defensive copy of ctx to avoid constraint pollution } |