Skip to content
Closed
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: 2 additions & 0 deletions compiler/src/dotty/tools/dotc/config/Feature.scala
Original file line number Diff line number Diff line change
Expand Up @@ -137,12 +137,14 @@ object Feature:
/** Is pureFunctions enabled for this compilation unit? */
def pureFunsEnabled(using Context) =
enabledBySetting(pureFunctions)
|| enabledByImport(pureFunctions)
|| ctx.compilationUnit.knowsPureFuns
|| ccEnabled

/** Is captureChecking enabled for this compilation unit? */
def ccEnabled(using Context) =
enabledBySetting(captureChecking)
|| enabledByImport(captureChecking)
|| ctx.compilationUnit.needsCaptureChecking

/** Is pureFunctions enabled for any of the currently compiled compilation units? */
Expand Down
4 changes: 2 additions & 2 deletions compiler/src/dotty/tools/dotc/parsing/Parsers.scala
Original file line number Diff line number Diff line change
Expand Up @@ -4684,12 +4684,12 @@ object Parsers {
* | Expr1
* |
*/
def blockStatSeq(): List[Tree] = checkNoEscapingPlaceholders {
def blockStatSeq(allowGlobalImport: Boolean = false): List[Tree] = checkNoEscapingPlaceholders {
val stats = new ListBuffer[Tree]
while
var empty = false
if (in.token == IMPORT)
stats ++= importClause()
stats ++= importClause(outermost = allowGlobalImport)
else if (isExprIntro)
stats += expr(Location.InBlock)
else if in.token == IMPLICIT && !in.inModifierPosition() then
Expand Down
2 changes: 1 addition & 1 deletion compiler/src/dotty/tools/repl/ParseResult.scala
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ object ParseResult {

private def parseStats(using Context): List[untpd.Tree] = {
val parser = new Parser(ctx.source)
val stats = parser.blockStatSeq()
val stats = parser.blockStatSeq(allowGlobalImport = true)
parser.accept(Tokens.EOF)
stats
}
Expand Down
Loading