From 31c563355515b9d3983edb20064960786ed502a7 Mon Sep 17 00:00:00 2001 From: Simon Ogorodnik Date: Thu, 24 Nov 2016 14:34:11 +0300 Subject: Updated kotlin-compiler to 1.1-M03 and fixed configuration --- core/src/main/kotlin/Analysis/AnalysisEnvironment.kt | 18 +++++++++++++----- .../format/multipleTypeParameterConstraints.md | 2 +- 2 files changed, 14 insertions(+), 6 deletions(-) (limited to 'core') 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("") override fun dependencies(): List = 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, 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 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 f(): Unit` \ No newline at end of file -- cgit