From ff2fdd7bf9791db76fc56e85556829d7212c0cdd Mon Sep 17 00:00:00 2001 From: buraq Date: Tue, 28 Oct 2003 13:28:48 +0000 Subject: fixed too restrictive assertion for type-checki... fixed too restrictive assertion for type-checking patterns --- sources/scalac/typechecker/Analyzer.java | 29 ++++------------------------- 1 file changed, 4 insertions(+), 25 deletions(-) (limited to 'sources') 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; - } - } - } -- cgit v1.2.3