diff options
author | Dmitry Petrashko <dark@d-d.me> | 2015-05-06 16:07:27 +0200 |
---|---|---|
committer | Dmitry Petrashko <dark@d-d.me> | 2015-05-06 16:07:27 +0200 |
commit | 905c541ba39f667f8b08fae85cb875470e283492 (patch) | |
tree | 2ca845e9cdf2307d5d60d63b86356a45f53eef7b /src/dotty | |
parent | a52ca600f2ad427276d1cdabd56133ffd0ed7610 (diff) | |
parent | 8f5f07fd16e5cff662a0b919ba562004b4096925 (diff) | |
download | dotty-905c541ba39f667f8b08fae85cb875470e283492.tar.gz dotty-905c541ba39f667f8b08fae85cb875470e283492.tar.bz2 dotty-905c541ba39f667f8b08fae85cb875470e283492.zip |
Merge pull request #541 from dotty-staging/fix/#537-extractors
Drop the requirement that extractors with `get` must implement Product
Diffstat (limited to 'src/dotty')
-rw-r--r-- | src/dotty/tools/dotc/typer/Applications.scala | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/dotty/tools/dotc/typer/Applications.scala b/src/dotty/tools/dotc/typer/Applications.scala index 7a826fee8..fec6482b8 100644 --- a/src/dotty/tools/dotc/typer/Applications.scala +++ b/src/dotty/tools/dotc/typer/Applications.scala @@ -51,9 +51,12 @@ object Applications { sels.takeWhile(_.exists).toList } - def getUnapplySelectors(tp: Type, args:List[untpd.Tree], pos: Position = NoPosition)(implicit ctx: Context): List[Type] = - if (defn.isProductSubType(tp) && args.length > 1) productSelectorTypes(tp, pos) - else tp :: Nil + def getUnapplySelectors(tp: Type, args: List[untpd.Tree], pos: Position = NoPosition)(implicit ctx: Context): List[Type] = + if (args.length > 1 && !(tp.derivesFrom(defn.SeqClass))) { + val sels = productSelectorTypes(tp, pos) + if (sels.length == args.length) sels + else tp :: Nil + } else tp :: Nil def unapplyArgs(unapplyResult: Type, unapplyFn:Tree, args:List[untpd.Tree], pos: Position = NoPosition)(implicit ctx: Context): List[Type] = { |