We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents a6ba025 + 73aa6dd commit 9ef0341Copy full SHA for 9ef0341
src/dotty/tools/dotc/Run.scala
@@ -29,10 +29,14 @@ class Run(comp: Compiler)(implicit ctx: Context) {
29
var units: List[CompilationUnit] = _
30
31
def getSource(fileName: String): SourceFile = {
32
- val encoding = ctx.settings.encoding.value
33
val f = new PlainFile(fileName)
34
- if (f.exists) new SourceFile(f, Codec(encoding))
35
- else {
+ if (f.isDirectory) {
+ ctx.error(s"expected file, received directory '$fileName'")
+ NoSource
36
+ } else if (f.exists) {
37
+ val encoding = ctx.settings.encoding.value
38
+ new SourceFile(f, Codec(encoding))
39
+ } else {
40
ctx.error(s"not found: $fileName")
41
NoSource
42
}
0 commit comments