[Analysis API] KtPsiTypeProvider: disable for non-jvm platforms

Otherwise, it will throw exception like:
```
IllegalStateException: No 'FirJvmTypeMapper'
```

Anyway, PsiType is JVM conception, so it is not supposed to be used
outside the JVM platform

^KT-60318
This commit is contained in:
Dmitrii Gridin
2023-08-25 16:20:54 +02:00
committed by Space Team
parent 7fa7d8ea8d
commit 7a24d0ee82
3 changed files with 18 additions and 5 deletions
@@ -1,5 +1,5 @@
/*
* Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Copyright 2010-2023 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
@@ -39,7 +39,9 @@ public interface KtPsiTypeProviderMixIn : KtAnalysisSessionMixIn {
* A client can handle such case in its own way. For instance,
* * UAST will return `UastErrorType` as a default error type.
*
* If [allowErrorTypes] set to true then erroneous types will be replaced with `error.NonExistentClass` type
* If [allowErrorTypes] set to true then erroneous types will be replaced with `error.NonExistentClass` type.
*
* Note: [PsiTypeElement] is JVM conception, so this method will return `null` for non-JVM platforms.
*/
public fun KtType.asPsiTypeElement(
useSitePosition: PsiElement,
@@ -55,7 +57,9 @@ public interface KtPsiTypeProviderMixIn : KtAnalysisSessionMixIn {
*
* This simply unwraps [PsiTypeElement] returned from [asPsiTypeElement].
* Use this version if type annotation is not required. Otherwise, use [asPsiTypeElement] to get [PsiTypeElement] as an owner of
* annotations on [PsiType] and annotate the resulting [PsiType] with proper [PsiAnnotation].
* annotations on [PsiType] and annotate the resulting [PsiType] with proper [PsiAnnotation][com.intellij.psi.PsiAnnotation].
*
* Note: [PsiType] is JVM conception, so this method will return `null` for non-JVM platforms.
*/
public fun KtType.asPsiType(
useSitePosition: PsiElement,