From 178e90e441481364f19163a9dad624a4d859fb1b Mon Sep 17 00:00:00 2001 From: Martin Odersky Date: Fri, 27 May 2016 23:25:26 +0200 Subject: Remove special case in parser There was a special case that triggered a parse error in this course def lift[T <: Type](tp: T): (RecType => T) = arg match { case rt0: RecType => tp.subst(rt0, _).asInstanceOf[T] case _ => (x => tp) } The problem was that the rhs of the first case became a Function node, which caused a premature return from the case clause sequence. I could not determine anymore what the purpose of the removed case in the parser was; all tests compile without it. --- src/dotty/tools/dotc/parsing/Parsers.scala | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) (limited to 'src/dotty/tools/dotc/parsing/Parsers.scala') diff --git a/src/dotty/tools/dotc/parsing/Parsers.scala b/src/dotty/tools/dotc/parsing/Parsers.scala index 0cc392bad..51b681c0e 100644 --- a/src/dotty/tools/dotc/parsing/Parsers.scala +++ b/src/dotty/tools/dotc/parsing/Parsers.scala @@ -2138,17 +2138,10 @@ object Parsers { var exitOnError = false while (!isStatSeqEnd && in.token != CASE && !exitOnError) { setLastStatOffset() - if (in.token == IMPORT) { + if (in.token == IMPORT) stats ++= importClause() - } - else if (isExprIntro) { - val t = expr(Location.InBlock) - stats += t - t match { - case _: Function => return stats.toList - case _ => - } - } + else if (isExprIntro) + stats += expr(Location.InBlock) else if (isDefIntro(localModifierTokens)) if (in.token == IMPLICIT) { val start = in.skipToken() -- cgit v1.2.3