diff options
author | Martin Odersky <odersky@gmail.com> | 2016-04-27 18:04:28 +0200 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2016-04-27 18:04:28 +0200 |
commit | 3129c1c136d5fa8b1549ec940ea1856c135bfe85 (patch) | |
tree | ff748f136164a88287fcc672b699bed82c66631e /src/dotty/tools/dotc/typer/Applications.scala | |
parent | ed8e2ba6623e755662ef503c0dbda72b40c9e27f (diff) | |
download | dotty-3129c1c136d5fa8b1549ec940ea1856c135bfe85.tar.gz dotty-3129c1c136d5fa8b1549ec940ea1856c135bfe85.tar.bz2 dotty-3129c1c136d5fa8b1549ec940ea1856c135bfe85.zip |
Revert: Better error diagnostics for "not an extractor" errors.
No longer needed because we are going to allow dependent method types
in extractors, and the unary requirement is kind of obvious.
Diffstat (limited to 'src/dotty/tools/dotc/typer/Applications.scala')
-rw-r--r-- | src/dotty/tools/dotc/typer/Applications.scala | 19 |
1 files changed, 2 insertions, 17 deletions
diff --git a/src/dotty/tools/dotc/typer/Applications.scala b/src/dotty/tools/dotc/typer/Applications.scala index 13616ea6c..37a9f0ba0 100644 --- a/src/dotty/tools/dotc/typer/Applications.scala +++ b/src/dotty/tools/dotc/typer/Applications.scala @@ -659,23 +659,8 @@ trait Applications extends Compatibility { self: Typer => def typedUnApply(tree: untpd.Apply, selType: Type)(implicit ctx: Context): Tree = track("typedUnApply") { val Apply(qual, args) = tree - def notAnExtractor(unapplyFn: Tree) = { - val methodStr = unapplyFn.symbol.name match { - case nme.unapply => "unapply" - case nme.unapplySeq => "unapplySeq" - case _ => "unapply or unapplySeq" - } - val because = unapplyFn.tpe.widen match { - case mt: MethodType => - i"its $methodStr method of type $mt" + ( - if (mt.isDependent) i" has a dependent type" - else if (mt.paramTypes.length != 1) i" does not take a single parameter" - else " is not eligible (this could be an internal compiler error)") - case _ => - "it lacks a unapply or unapplySeq method" - } - errorTree(unapplyFn, s"${qual.show} cannot be used as an extractor in a pattern $because") - } + def notAnExtractor(tree: Tree) = + errorTree(tree, s"${qual.show} cannot be used as an extractor in a pattern because it lacks an unapply or unapplySeq method") /** If this is a term ref tree, try to typecheck with its type name. * If this refers to a type alias, follow the alias, and if |