Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
硅谷海盗
kotlin
提交
58a5f4f9
K
kotlin
项目概览
硅谷海盗
/
kotlin
与 Fork 源项目一致
从无法访问的项目Fork
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
K
kotlin
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
58a5f4f9
编写于
3月 22, 2021
作者:
I
Ilya Kirillov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
FIR IDE: do not fail on building anonymous function symbol
上级
b838ba8c
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
19 addition
and
8 deletion
+19
-8
idea/idea-fir/src/org/jetbrains/kotlin/idea/fir/inspections/declarations/HLRedundantUnitReturnTypeInspection.kt
...tions/declarations/HLRedundantUnitReturnTypeInspection.kt
+1
-1
idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/symbols/KtSymbolProvider.kt
...ains/kotlin/idea/frontend/api/symbols/KtSymbolProvider.kt
+10
-4
idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/symbols/KtFirSymbolProvider.kt
...tlin/idea/frontend/api/fir/symbols/KtFirSymbolProvider.kt
+8
-3
未找到文件。
idea/idea-fir/src/org/jetbrains/kotlin/idea/fir/inspections/declarations/HLRedundantUnitReturnTypeInspection.kt
浏览文件 @
58a5f4f9
...
...
@@ -35,7 +35,7 @@ internal class HLRedundantUnitReturnTypeInspection :
override
val
inputProvider
=
inputProvider
<
KtNamedFunction
,
CallableReturnTypeUpdaterApplicator
.
Type
>
{
function
->
when
{
function
.
getFunctionSymbol
().
annotatedType
.
type
.
isUnit
->
CallableReturnTypeUpdaterApplicator
.
Type
.
UNIT
function
.
getFunction
Like
Symbol
().
annotatedType
.
type
.
isUnit
->
CallableReturnTypeUpdaterApplicator
.
Type
.
UNIT
else
->
null
}
}
...
...
idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/symbols/KtSymbolProvider.kt
浏览文件 @
58a5f4f9
...
...
@@ -15,7 +15,7 @@ import org.jetbrains.kotlin.psi.*
abstract
class
KtSymbolProvider
:
KtAnalysisSessionComponent
()
{
open
fun
getSymbol
(
psi
:
KtDeclaration
):
KtSymbol
=
when
(
psi
)
{
is
KtParameter
->
getParameterSymbol
(
psi
)
is
KtNamedFunction
->
getFunctionSymbol
(
psi
)
is
KtNamedFunction
->
getFunction
Like
Symbol
(
psi
)
is
KtConstructor
<
*
>
->
getConstructorSymbol
(
psi
)
is
KtTypeParameter
->
getTypeParameterSymbol
(
psi
)
is
KtTypeAlias
->
getTypeAliasSymbol
(
psi
)
...
...
@@ -32,7 +32,7 @@ abstract class KtSymbolProvider : KtAnalysisSessionComponent() {
abstract
fun
getParameterSymbol
(
psi
:
KtParameter
):
KtValueParameterSymbol
abstract
fun
getFileSymbol
(
psi
:
KtFile
):
KtFileSymbol
abstract
fun
getFunction
Symbol
(
psi
:
KtNamedFunction
):
KtFunction
Symbol
abstract
fun
getFunction
LikeSymbol
(
psi
:
KtNamedFunction
):
KtFunctionLike
Symbol
abstract
fun
getConstructorSymbol
(
psi
:
KtConstructor
<
*
>):
KtConstructorSymbol
abstract
fun
getTypeParameterSymbol
(
psi
:
KtTypeParameter
):
KtTypeParameterSymbol
abstract
fun
getTypeAliasSymbol
(
psi
:
KtTypeAlias
):
KtTypeAliasSymbol
...
...
@@ -57,8 +57,14 @@ interface KtSymbolProviderMixIn : KtAnalysisSessionMixIn {
fun
KtParameter
.
getParameterSymbol
():
KtValueParameterSymbol
=
analysisSession
.
symbolProvider
.
getParameterSymbol
(
this
)
fun
KtNamedFunction
.
getFunctionSymbol
():
KtFunctionSymbol
=
analysisSession
.
symbolProvider
.
getFunctionSymbol
(
this
)
/**
* Creates [KtFunctionLikeSymbol] by [KtNamedFunction]
*
* If [KtNamedFunction.getName] is `null` then returns [KtAnonymousFunctionSymbol]
* Otherwise, returns [KtFunctionSymbol]
*/
fun
KtNamedFunction
.
getFunctionLikeSymbol
():
KtFunctionLikeSymbol
=
analysisSession
.
symbolProvider
.
getFunctionLikeSymbol
(
this
)
fun
KtConstructor
<*>.
getConstructorSymbol
():
KtConstructorSymbol
=
analysisSession
.
symbolProvider
.
getConstructorSymbol
(
this
)
...
...
idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/symbols/KtFirSymbolProvider.kt
浏览文件 @
58a5f4f9
...
...
@@ -6,6 +6,7 @@
package
org.jetbrains.kotlin.idea.frontend.api.fir.symbols
import
org.jetbrains.kotlin.fir.declarations.*
import
org.jetbrains.kotlin.fir.renderWithType
import
org.jetbrains.kotlin.fir.resolve.providers.FirSymbolProvider
import
org.jetbrains.kotlin.fir.symbols.impl.FirRegularClassSymbol
import
org.jetbrains.kotlin.idea.fir.low.level.api.api.FirModuleResolveState
...
...
@@ -43,9 +44,13 @@ internal class KtFirSymbolProvider(
firSymbolBuilder
.
buildFileSymbol
(
psi
.
getFirFile
(
resolveState
))
}
override
fun
getFunctionSymbol
(
psi
:
KtNamedFunction
):
KtFunctionSymbol
=
withValidityAssertion
{
psi
.
withFirDeclarationOfType
<
FirSimpleFunction
,
KtFunctionSymbol
>(
resolveState
)
{
firSymbolBuilder
.
functionLikeBuilder
.
buildFunctionSymbol
(
it
)
override
fun
getFunctionLikeSymbol
(
psi
:
KtNamedFunction
):
KtFunctionLikeSymbol
=
withValidityAssertion
{
psi
.
withFirDeclarationOfType
<
FirFunction
<
*
>,
KtFunctionLikeSymbol
>(
resolveState
)
{
fir
->
when
(
fir
)
{
is
FirSimpleFunction
->
firSymbolBuilder
.
functionLikeBuilder
.
buildFunctionSymbol
(
fir
)
is
FirAnonymousFunction
->
firSymbolBuilder
.
functionLikeBuilder
.
buildAnonymousFunctionSymbol
(
fir
)
else
->
error
(
"Unexpected ${fir.renderWithType()}"
)
}
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录