@@ -8,7 +8,7 @@ import java.nio.file.Path
8
8
import java .util .{Arrays , EnumSet }
9
9
10
10
import dotty .tools .dotc .ast .tpd
11
- import dotty .tools .dotc .classpath .FileUtils .{isTasty , isClass }
11
+ import dotty .tools .dotc .classpath .FileUtils .{isTasty , isClassExtension , isTastyExtension }
12
12
import dotty .tools .dotc .core .Contexts ._
13
13
import dotty .tools .dotc .core .Decorators ._
14
14
import dotty .tools .dotc .core .Flags ._
@@ -458,21 +458,23 @@ class DependencyRecorder {
458
458
}
459
459
460
460
val depFile = dep.toClass.associatedFile
461
- if ( depFile != null ) {
461
+ if depFile != null then {
462
462
// Cannot ignore inheritance relationship coming from the same source (see sbt/zinc#417)
463
463
def allowLocal = dep.context == DependencyByInheritance || dep.context == LocalDependencyByInheritance
464
- val depClassFile =
465
- if depFile.isClass then depFile
466
- else depFile.resolveSibling(dep.toClass.binaryClassName + " .class" )
467
- if (depClassFile != null ) {
468
- // Dependency is external -- source is undefined
469
- processExternalDependency(depClassFile, dep.toClass.binaryClassName)
470
- } else if (allowLocal || depFile != sourceFile.file) {
464
+ if depFile.isTastyExtension then
465
+ val depClassFile = depFile.resolveSibling(depFile.name.stripSuffix(" .tasty" ) + " .class" )
466
+ if depClassFile != null then
467
+ // did not find associated class file, e.g. for a TASTy-only classpath.
468
+ // The file that Zinc recieves with binaryDependency is used to lookup any either any
469
+ // generated non-local classes or produced xsbti.API associated with the file.
470
+ processExternalDependency(depClassFile, dep.toClass.binaryClassName)
471
+ else if depFile.isClassExtension then
472
+ processExternalDependency(depFile, dep.toClass.binaryClassName)
473
+ else if allowLocal || depFile != sourceFile.file then
471
474
// We cannot ignore dependencies coming from the same source file because
472
475
// the dependency info needs to propagate. See source-dependencies/trait-trait-211.
473
476
val toClassName = classNameAsString(dep.toClass)
474
477
cb.classDependency(toClassName, fromClassName, dep.context)
475
- }
476
478
}
477
479
}
478
480
0 commit comments