File tree Expand file tree Collapse file tree 1 file changed +16
-10
lines changed
compiler/src/dotty/tools/dotc/core Expand file tree Collapse file tree 1 file changed +16
-10
lines changed Original file line number Diff line number Diff line change @@ -270,15 +270,20 @@ object Contexts {
270
270
271
271
def getSource (fileName : String ): SourceFile = {
272
272
val f = new PlainFile (Path (fileName))
273
- if (f.isDirectory) {
274
- error(s " expected file, received directory ' $fileName' " )
275
- NoSource
276
- }
277
- else if (f.exists)
278
- getSource(f)
279
- else {
280
- error(s " not found: $fileName" )
281
- NoSource
273
+ base.sources.get(f) match {
274
+ case Some (source) =>
275
+ source
276
+ case None =>
277
+ if (f.isDirectory) {
278
+ error(s " expected file, received directory ' $fileName' " )
279
+ NoSource
280
+ }
281
+ else if (f.exists)
282
+ getSource(f)
283
+ else {
284
+ error(s " not found: $fileName" )
285
+ NoSource
286
+ }
282
287
}
283
288
}
284
289
@@ -466,10 +471,11 @@ object Contexts {
466
471
final def withOwner (owner : Symbol ): Context =
467
472
if (owner ne this .owner) fresh.setOwner(owner) else this
468
473
469
- private [ this ] var sourceCtx : SimpleIdentityMap [SourceFile , Context ] = SimpleIdentityMap .Empty
474
+ private var sourceCtx : SimpleIdentityMap [SourceFile , Context ] = SimpleIdentityMap .Empty
470
475
471
476
final def withSource (source : SourceFile ): Context =
472
477
if (source `eq` this .source) this
478
+ else if ((source `eq` outer.source) && (outer.sourceCtx(this .source) `eq` this )) outer
473
479
else {
474
480
val prev = sourceCtx(source)
475
481
if (prev != null ) prev
You can’t perform that action at this time.
0 commit comments