Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
硅谷海盗
kotlin
提交
999d1f98
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,体验更适合开发者的 AI 搜索 >>
提交
999d1f98
编写于
3月 19, 2021
作者:
V
Victor Petukhov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Introduce hierarchy of inference sessions
上级
80ac6286
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
28 addition
and
10 deletion
+28
-10
compiler/frontend/src/org/jetbrains/kotlin/resolve/DelegatedPropertyInferenceSession.kt
...rains/kotlin/resolve/DelegatedPropertyInferenceSession.kt
+6
-2
compiler/frontend/src/org/jetbrains/kotlin/resolve/DelegatedPropertyResolver.kt
...org/jetbrains/kotlin/resolve/DelegatedPropertyResolver.kt
+2
-2
compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/inference/BuilderInferenceSession.kt
...kotlin/resolve/calls/inference/BuilderInferenceSession.kt
+16
-6
compiler/resolution/src/org/jetbrains/kotlin/resolve/calls/components/InferenceSession.kt
...rains/kotlin/resolve/calls/components/InferenceSession.kt
+4
-0
未找到文件。
compiler/frontend/src/org/jetbrains/kotlin/resolve/DelegatedPropertyInferenceSession.kt
浏览文件 @
999d1f98
...
...
@@ -32,7 +32,8 @@ class DelegatedPropertyInferenceSession(
postponedArgumentsAnalyzer
:
PostponedArgumentsAnalyzer
,
kotlinConstraintSystemCompleter
:
KotlinConstraintSystemCompleter
,
callComponents
:
KotlinCallComponents
,
builtIns
:
KotlinBuiltIns
builtIns
:
KotlinBuiltIns
,
override
val
parentSession
:
InferenceSession
?
)
:
ManyCandidatesResolver
<
FunctionDescriptor
>(
psiCallResolver
,
postponedArgumentsAnalyzer
,
kotlinConstraintSystemCompleter
,
callComponents
,
builtIns
)
{
...
...
@@ -92,7 +93,10 @@ class DelegatedPropertyInferenceSession(
override
fun
shouldCompleteResolvedSubAtomsOf
(
resolvedCallAtom
:
ResolvedCallAtom
)
=
true
}
class
InferenceSessionForExistingCandidates
(
private
val
resolveReceiverIndependently
:
Boolean
)
:
InferenceSession
{
class
InferenceSessionForExistingCandidates
(
private
val
resolveReceiverIndependently
:
Boolean
,
override
val
parentSession
:
InferenceSession
?
)
:
InferenceSession
{
override
fun
shouldRunCompletion
(
candidate
:
KotlinResolutionCandidate
):
Boolean
{
return
!
ErrorUtils
.
isError
(
candidate
.
resolvedCall
.
candidateDescriptor
)
}
...
...
compiler/frontend/src/org/jetbrains/kotlin/resolve/DelegatedPropertyResolver.kt
浏览文件 @
999d1f98
...
...
@@ -580,7 +580,7 @@ class DelegatedPropertyResolver(
val
contextForProvideDelegate
=
createContextForProvideDelegateMethod
(
scopeForDelegate
,
delegateDataFlow
,
traceForProvideDelegate
,
InferenceSessionForExistingCandidates
(
substitutionMap
!=
null
)
InferenceSessionForExistingCandidates
(
substitutionMap
!=
null
,
inferenceSession
)
)
val
provideDelegateResults
=
getProvideDelegateMethod
(
...
...
@@ -652,7 +652,7 @@ class DelegatedPropertyResolver(
val
newInferenceSession
=
DelegatedPropertyInferenceSession
(
variableDescriptor
,
expectedType
,
psiCallResolver
,
postponedArgumentsAnalyzer
,
kotlinConstraintSystemCompleter
,
callComponents
,
builtIns
callComponents
,
builtIns
,
inferenceSession
)
val
receiver
=
createReceiverForGetSetValueMethods
(
delegateExpression
,
delegateType
,
trace
)
...
...
compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/inference/BuilderInferenceSession.kt
浏览文件 @
999d1f98
...
...
@@ -15,10 +15,7 @@ import org.jetbrains.kotlin.psi.psiUtil.getParentOfType
import
org.jetbrains.kotlin.psi.psiUtil.isAncestor
import
org.jetbrains.kotlin.resolve.*
import
org.jetbrains.kotlin.resolve.calls.ArgumentTypeResolver
import
org.jetbrains.kotlin.resolve.calls.components.CompletedCallInfo
import
org.jetbrains.kotlin.resolve.calls.components.NewConstraintSystemImpl
import
org.jetbrains.kotlin.resolve.calls.components.PostponedArgumentsAnalyzer
import
org.jetbrains.kotlin.resolve.calls.components.stableType
import
org.jetbrains.kotlin.resolve.calls.components.*
import
org.jetbrains.kotlin.resolve.calls.context.BasicCallResolutionContext
import
org.jetbrains.kotlin.resolve.calls.inference.components.ConstraintSystemCompletionMode
import
org.jetbrains.kotlin.resolve.calls.inference.components.KotlinConstraintSystemCompleter
...
...
@@ -71,6 +68,8 @@ class BuilderInferenceSession(
private
var
hasInapplicableCall
=
false
override
val
parentSession
=
topLevelCallContext
.
inferenceSession
override
fun
shouldRunCompletion
(
candidate
:
KotlinResolutionCandidate
):
Boolean
{
val
system
=
candidate
.
getSystem
()
as
NewConstraintSystemImpl
...
...
@@ -147,7 +146,18 @@ class BuilderInferenceSession(
descriptor
.
extensionReceiverParameter
?.
type
?.
contains
{
it
is
StubType
}
==
true
}
private
fun
isTopLevelBuilderInferenceCall
()
=
topLevelCallContext
.
inferenceSession
!
is
BuilderInferenceSession
private
fun
isTopLevelBuilderInferenceCall
()
=
findParentBuildInferenceSession
()
==
null
private
fun
findParentBuildInferenceSession
():
BuilderInferenceSession
?
{
var
currentSession
:
InferenceSession
?
=
parentSession
while
(
currentSession
!=
null
)
{
if
(
currentSession
is
BuilderInferenceSession
)
return
currentSession
currentSession
=
currentSession
.
parentSession
}
return
null
}
fun
hasInapplicableCall
():
Boolean
=
hasInapplicableCall
...
...
@@ -234,7 +244,7 @@ class BuilderInferenceSession(
bindings
[
nonFixedType
.
constructor
]
=
variable
.
defaultType
}
val
parentBuilderInferenceCallSession
=
topLevelCallContext
.
inferenceSession
as
?
BuilderInferenceSession
val
parentBuilderInferenceCallSession
=
findParentBuildInferenceSession
()
if
(
parentBuilderInferenceCallSession
!=
null
)
{
bindings
.
putAll
(
parentBuilderInferenceCallSession
.
createNonFixedTypeToVariableMap
())
...
...
compiler/resolution/src/org/jetbrains/kotlin/resolve/calls/components/InferenceSession.kt
浏览文件 @
999d1f98
...
...
@@ -12,8 +12,12 @@ import org.jetbrains.kotlin.types.TypeConstructor
import
org.jetbrains.kotlin.types.UnwrappedType
interface
InferenceSession
{
val
parentSession
:
InferenceSession
?
companion
object
{
val
default
=
object
:
InferenceSession
{
override
val
parentSession
:
InferenceSession
?
=
null
override
fun
shouldRunCompletion
(
candidate
:
KotlinResolutionCandidate
):
Boolean
=
true
override
fun
addPartialCallInfo
(
callInfo
:
PartialCallInfo
)
{}
override
fun
addErrorCallInfo
(
callInfo
:
ErrorCallInfo
)
{}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录