Skip to content

Commit 6925cb0

Browse files
committed
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.
1 parent 3819693 commit 6925cb0

File tree

1 file changed

+3
-10
lines changed

1 file changed

+3
-10
lines changed

src/dotty/tools/dotc/parsing/Parsers.scala

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2138,17 +2138,10 @@ object Parsers {
21382138
var exitOnError = false
21392139
while (!isStatSeqEnd && in.token != CASE && !exitOnError) {
21402140
setLastStatOffset()
2141-
if (in.token == IMPORT) {
2141+
if (in.token == IMPORT)
21422142
stats ++= importClause()
2143-
}
2144-
else if (isExprIntro) {
2145-
val t = expr(Location.InBlock)
2146-
stats += t
2147-
t match {
2148-
case _: Function => return stats.toList
2149-
case _ =>
2150-
}
2151-
}
2143+
else if (isExprIntro)
2144+
stats += expr(Location.InBlock)
21522145
else if (isDefIntro(localModifierTokens))
21532146
if (in.token == IMPLICIT) {
21542147
val start = in.skipToken()

0 commit comments

Comments
 (0)