diff options
Diffstat (limited to 'core')
-rw-r--r-- | core/src/main/kotlin/Analysis/AnalysisEnvironment.kt | 18 | ||||
-rw-r--r-- | core/testdata/format/multipleTypeParameterConstraints.md | 2 |
2 files changed, 14 insertions, 6 deletions
diff --git a/core/src/main/kotlin/Analysis/AnalysisEnvironment.kt b/core/src/main/kotlin/Analysis/AnalysisEnvironment.kt index 46fcb6c2..e365207c 100644 --- a/core/src/main/kotlin/Analysis/AnalysisEnvironment.kt +++ b/core/src/main/kotlin/Analysis/AnalysisEnvironment.kt @@ -31,6 +31,7 @@ import org.jetbrains.kotlin.descriptors.DeclarationDescriptor import org.jetbrains.kotlin.descriptors.ModuleDescriptor import org.jetbrains.kotlin.idea.resolve.ResolutionFacade import org.jetbrains.kotlin.name.Name +import org.jetbrains.kotlin.platform.JvmBuiltIns import org.jetbrains.kotlin.psi.KtDeclaration import org.jetbrains.kotlin.psi.KtElement import org.jetbrains.kotlin.resolve.BindingContext @@ -89,6 +90,8 @@ class AnalysisEnvironment(val messageCollector: MessageCollector) : Disposable { override val name: Name = Name.special("<module>") override fun dependencies(): List<ModuleInfo> = listOf(this) } + + val builtIns = JvmBuiltIns(projectContext.storageManager) val resolverForProject = JvmAnalyzerFacade.setupResolverForProject( "Dokka", projectContext, @@ -96,11 +99,15 @@ class AnalysisEnvironment(val messageCollector: MessageCollector) : Disposable { { ModuleContent(sourceFiles, GlobalSearchScope.allScope(environment.project)) }, JvmPlatformParameters { module }, CompilerEnvironment, - packagePartProviderFactory = { info, content -> JvmPackagePartProvider(environment, content.moduleContentScope) } + packagePartProviderFactory = { info, content -> JvmPackagePartProvider(environment, content.moduleContentScope) }, + builtIns = builtIns ) + val resolverForModule = resolverForProject.resolverForModule(module) - return DokkaResolutionFacade(environment.project, resolverForProject.descriptorForModule(module), resolverForModule) + val moduleDescriptor = resolverForProject.descriptorForModule(module) + builtIns.initialize(moduleDescriptor, true) + return DokkaResolutionFacade(environment.project, moduleDescriptor, resolverForModule) } /** @@ -168,6 +175,10 @@ fun contentRootFromPath(path: String): ContentRoot { class DokkaResolutionFacade(override val project: Project, override val moduleDescriptor: ModuleDescriptor, val resolverForModule: ResolverForModule) : ResolutionFacade { + override fun resolveToDescriptor(declaration: KtDeclaration, bodyResolveMode: BodyResolveMode): DeclarationDescriptor { + return resolveSession.resolveToDescriptor(declaration) + } + override fun analyze(elements: Collection<KtElement>, bodyResolveMode: BodyResolveMode): BindingContext { throw UnsupportedOperationException() } @@ -198,7 +209,4 @@ class DokkaResolutionFacade(override val project: Project, throw UnsupportedOperationException() } - override fun resolveToDescriptor(declaration: KtDeclaration): DeclarationDescriptor { - return resolveSession.resolveToDescriptor(declaration) - } } diff --git a/core/testdata/format/multipleTypeParameterConstraints.md b/core/testdata/format/multipleTypeParameterConstraints.md index 14f048f4..74532ffe 100644 --- a/core/testdata/format/multipleTypeParameterConstraints.md +++ b/core/testdata/format/multipleTypeParameterConstraints.md @@ -2,4 +2,4 @@ # f -`fun <T> f(): Unit where T : `[`Appendable`](http://docs.oracle.com/javase/6/docs/api/java/lang/Appendable.html)`, T : CharSequence`
\ No newline at end of file +`fun <T : CharSequence> f(): Unit`
\ No newline at end of file |