diff options
author | Jason Zaugg <jzaugg@gmail.com> | 2013-01-13 17:42:48 +0100 |
---|---|---|
committer | Adriaan Moors <adriaan.moors@typesafe.com> | 2013-01-27 22:42:02 -0800 |
commit | a87d40960bfdb4a683c05d3430a8874cb4dcff36 (patch) | |
tree | a65ddd00ebdee081055d982f6408cbfc34e9e62c /src | |
parent | 02963d724c512251ce66502226408091686989ee (diff) | |
download | scala-a87d40960bfdb4a683c05d3430a8874cb4dcff36.tar.gz scala-a87d40960bfdb4a683c05d3430a8874cb4dcff36.tar.bz2 scala-a87d40960bfdb4a683c05d3430a8874cb4dcff36.zip |
SI-6968 Simple Tuple patterns aren't irrefutable
Reverts part of c82ecab. The parser can't assume that
a pattern `(a, b)` will match, as results of
`.isInstanceOf[Tuple2]` can't be statically known until
after the typer.
The reopens SI-1336, SI-5589 and SI-4574, in exchange for fixing
this regression SI-6968. Keeping all of those fixed will require
a better definition of irrefutability, and some acrobatics to
ensure safe passage to the ambiguous trees through typechecking.
Diffstat (limited to 'src')
-rw-r--r-- | src/reflect/scala/reflect/internal/TreeInfo.scala | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/src/reflect/scala/reflect/internal/TreeInfo.scala b/src/reflect/scala/reflect/internal/TreeInfo.scala index e1a18570b2..98c1afb323 100644 --- a/src/reflect/scala/reflect/internal/TreeInfo.scala +++ b/src/reflect/scala/reflect/internal/TreeInfo.scala @@ -261,22 +261,24 @@ abstract class TreeInfo { * in the position `for { <tree> <- expr }` based only * on information at the `parser` phase? To qualify, there * may be no subtree that will be interpreted as a - * Stable Identifier Pattern. + * Stable Identifier Pattern, nor any type tests, even + * on TupleN. See SI-6968. * * For instance: * * {{{ - * foo @ (bar, (baz, quux)) + * (foo @ (bar @ _)) = 0 * }}} * - * is a variable pattern; if the structure matches, - * then the remainder is inevitable. + * is a not a variable pattern; if only binds names. * * The following are not variable patterns. * * {{{ - * foo @ (bar, (`baz`, quux)) // back quoted ident, not at top level - * foo @ (bar, Quux) // UpperCase ident, not at top level + * `bar` + * Bar + * (a, b) + * _: T * }}} * * If the pattern is a simple identifier, it is always @@ -305,10 +307,6 @@ abstract class TreeInfo { tree match { case Bind(name, pat) => isVarPatternDeep0(pat) case Ident(name) => isVarPattern(tree) - case Apply(sel, args) => - ( isReferenceToScalaMember(sel, TupleClass(args.size).name.toTermName) - && (args forall isVarPatternDeep0) - ) case _ => false } } |