diff options
author | buraq <buraq@epfl.ch> | 2003-10-28 13:28:48 +0000 |
---|---|---|
committer | buraq <buraq@epfl.ch> | 2003-10-28 13:28:48 +0000 |
commit | ff2fdd7bf9791db76fc56e85556829d7212c0cdd (patch) | |
tree | 8a70c06207d924ea25d699187be68f01425980cb /sources/scalac | |
parent | 7a740005ace3d8c81825a45bfad18df0f5ce3989 (diff) | |
download | scala-ff2fdd7bf9791db76fc56e85556829d7212c0cdd.tar.gz scala-ff2fdd7bf9791db76fc56e85556829d7212c0cdd.tar.bz2 scala-ff2fdd7bf9791db76fc56e85556829d7212c0cdd.zip |
fixed too restrictive assertion for type-checki...
fixed too restrictive assertion for type-checking patterns
Diffstat (limited to 'sources/scalac')
-rw-r--r-- | sources/scalac/typechecker/Analyzer.java | 29 |
1 files changed, 4 insertions, 25 deletions
diff --git a/sources/scalac/typechecker/Analyzer.java b/sources/scalac/typechecker/Analyzer.java index 9797825f8e..4595a33249 100644 --- a/sources/scalac/typechecker/Analyzer.java +++ b/sources/scalac/typechecker/Analyzer.java @@ -1736,9 +1736,11 @@ public class Analyzer extends Transformer implements Modifiers, Kinds { } // desugarizing ident patterns if (params.length == 1 && (params[0].flags & REPEATED) != 0) { - assert (args.length != 1 || !(args[0] instanceof Tree.Sequence)); - if (( mode & PATTERNmode ) != 0 ) + if (( mode & PATTERNmode ) != 0 ) { desug_allIdentPatterns( args, context.owner ); + } else { + assert (args.length != 1 || !(args[0] instanceof Tree.Sequence)); + } } return argtypes; @@ -2604,28 +2606,5 @@ public class Analyzer extends Transformer implements Modifiers, Kinds { } } - - // get first elementary type in a sequence - // precondition: tree is successor of a sequence node - - Type revealSeqOrElemType( Tree tree, Type proto, Type seqType, Type elemType ) { - switch( tree ) { - //case Subsequence(_): NEW - //return proto; NEW - case Sequence(_): - return elemType; - case Alternative( Tree[] choices ): - // after normalization, choices.length >= 2 - // and if there is one subsequence branch, all - // branches are subsequence nodes - return revealSeqOrElemType( choices[ 0 ], proto, seqType, elemType ); - case Bind( _, Tree body ): - // here, we forget the (concrete) prototype (if we have one) - return revealSeqOrElemType( body, seqType, seqType, elemType ); - default: - return elemType; - } - } - } |