Add debug strings to frontend scopes-related structures

Such as:
- PackageFragmentProviders, and, in particular,
CompositePackageFragmentProviders
- JavaPackageFragments
- Scopes produced by those providers

The rationale is that a lot of frontend-facing bugs (like red code) are
easily recognizeable in resolution. But at that point you just see a
bunch of scopes, without meaningful toStrings, you don't know who has
produced them, and what's exactly wrong.

With this commit it should make debugging slightly easier: now at least
you'll be able to see that "this scope is a scope of package fragment
for foo.bar of module baz" and decide whether the declaration should or
should not have been resolved from such scope.
This commit is contained in:
Dmitry Savvinov
2021-05-21 11:35:26 +03:00
committed by teamcityserver
parent a51c65ed60
commit 708fead1cc
32 changed files with 137 additions and 48 deletions
@@ -104,8 +104,9 @@ class IncrementalPackageFragmentProvider(
JvmPackagePartSource(
partName, facadeName, packageProto, nameResolver, knownJvmBinaryClass = jvmBinaryClass
),
deserializationComponents, classNames = { emptyList() }
)
deserializationComponents,
"scope for IncrementalMultifileClassPackageFragment for facadeName=$facadeName, packageFqName=$packageFqName, part $partName",
) { emptyList() }
}
}
)
@@ -133,6 +133,9 @@ class JvmResolverForModuleFactory(
)
}
return ResolverForModule(CompositePackageFragmentProvider(providersForModule), container)
return ResolverForModule(
CompositePackageFragmentProvider(providersForModule, "CompositeProvider@JvmResolver for $moduleDescriptor"),
container
)
}
}