diff --git a/amm/compiler/src/main/scala-2/ammonite/compiler/Parsers.scala b/amm/compiler/src/main/scala-2/ammonite/compiler/Parsers.scala index ff8841ed7..53621e7ff 100644 --- a/amm/compiler/src/main/scala-2/ammonite/compiler/Parsers.scala +++ b/amm/compiler/src/main/scala-2/ammonite/compiler/Parsers.scala @@ -39,7 +39,7 @@ object Parsers extends IParser { } def ImportSplitter[_: P]: P[Seq[ammonite.util.ImportTree]] = - P( `import` ~/ ImportExpr.rep(1, sep = ","./) ) + P( WL ~ `import` ~/ ImportExpr.rep(1, sep = ","./) ) def ImportFinder[_: P]: P[String] = P(WL ~ `import` ~/ ImportExpr.! ~ End) diff --git a/amm/repl/src/test/scala/ammonite/session/AdvancedTests.scala b/amm/repl/src/test/scala/ammonite/session/AdvancedTests.scala index dac8897e0..a927094cf 100644 --- a/amm/repl/src/test/scala/ammonite/session/AdvancedTests.scala +++ b/amm/repl/src/test/scala/ammonite/session/AdvancedTests.scala @@ -708,6 +708,19 @@ object AdvancedTests extends TestSuite{ """ ) } + test("hook in block") { + check.session( + """ + @ { + @ import $ivy.`org.typelevel::cats-kernel:2.6.1` + @ } + import $ivy.$ + + @ import cats.kernel._ + import cats.kernel._ + """ + ) + } test("class-path-hook") { val sbv = check.scalaBinaryVersion check.session(