Skip to content

Harden IDE some more #2932

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jul 29, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion compiler/src/dotty/tools/dotc/ast/Trees.scala
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ object Trees {
*/
def withType(tpe: Type)(implicit ctx: Context): ThisTree[Type] = {
if (tpe.isInstanceOf[ErrorType])
assert(ctx.reporter.errorsReported)
assert(ctx.mode.is(Mode.Interactive) || ctx.reporter.errorsReported)
else if (Config.checkTreesConsistent)
checkChildrenTyped(productIterator)
withTypeUnchecked(tpe)
Expand Down
11 changes: 10 additions & 1 deletion compiler/src/dotty/tools/dotc/parsing/Parsers.scala
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,16 @@ object Parsers {
}

def acceptStatSepUnlessAtEnd(altEnd: Token = EOF) =
if (!isStatSeqEnd && in.token != altEnd) acceptStatSep()
if (!isStatSeqEnd)
in.token match {
case EOF =>
case `altEnd` =>
case NEWLINE | NEWLINES => in.nextToken()
case SEMI => in.nextToken()
case _ =>
in.nextToken() // needed to ensure progress; otherwise we might cycle forever
accept(SEMI)
}

def errorTermTree = atPos(in.offset) { Literal(Constant(null)) }

Expand Down
3 changes: 2 additions & 1 deletion compiler/src/dotty/tools/dotc/typer/Applications.scala
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,8 @@ trait Applications extends Compatibility { self: Typer with Dynamic =>
case (arg: NamedArg @unchecked) :: _ =>
val nameAssocs = for (arg @ NamedArg(name, _) <- args) yield (name, arg)
handleNamed(pnames, args, nameAssocs.toMap, Set())
case arg :: args1 => arg :: handlePositional(pnames.tail, args1)
case arg :: args1 =>
arg :: handlePositional(if (pnames.isEmpty) Nil else pnames.tail, args1)
case Nil => Nil
}

Expand Down
1 change: 1 addition & 0 deletions compiler/src/dotty/tools/dotc/typer/Namer.scala
Original file line number Diff line number Diff line change
Expand Up @@ -756,6 +756,7 @@ class Namer { typer: Typer =>
else levels(c.outer) + 1
completions.println(s"!!!completing ${denot.symbol.showLocated} in buried typerState, gap = ${levels(ctx)}")
}
assert(ctx.runId == creationContext.runId, "completing $denot in wrong run ${ctx.runId}, was created in ${creationContext.runId}")
completeInCreationContext(denot)
}

Expand Down
4 changes: 2 additions & 2 deletions tests/neg/i1779.scala
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ object Test {
def f = {
val _parent = 3
q"val hello = $_parent"
q"class $_" // error // error
}
q"class $_" // error
} // error
}