diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/dotty/tools/dotc/Run.scala | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/dotty/tools/dotc/Run.scala b/src/dotty/tools/dotc/Run.scala index fa69530b5..f5ba56a7e 100644 --- a/src/dotty/tools/dotc/Run.scala +++ b/src/dotty/tools/dotc/Run.scala @@ -29,10 +29,14 @@ class Run(comp: Compiler)(implicit ctx: Context) { var units: List[CompilationUnit] = _ def getSource(fileName: String): SourceFile = { - val encoding = ctx.settings.encoding.value val f = new PlainFile(fileName) - if (f.exists) new SourceFile(f, Codec(encoding)) - else { + if (f.isDirectory) { + ctx.error(s"expected file, received directory '$fileName'") + NoSource + } else if (f.exists) { + val encoding = ctx.settings.encoding.value + new SourceFile(f, Codec(encoding)) + } else { ctx.error(s"not found: $fileName") NoSource } |