Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
硅谷海盗
kotlin
提交
83e32016
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,发现更多精彩内容 >>
提交
83e32016
编写于
2月 04, 2021
作者:
J
Jinseong Jeon
提交者:
Dmitriy Novozhilov
2月 08, 2021
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
FIR DFA: correct exit node retrieval when a safe call is the last expression
^KT-44699 Fixed
上级
266432a4
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
14 addition
and
29 deletion
+14
-29
compiler/fir/analysis-tests/testData/resolve/callResolution/safeCallOnTypeAlias.fir.txt
...stData/resolve/callResolution/safeCallOnTypeAlias.fir.txt
+1
-1
compiler/fir/analysis-tests/testData/resolve/inference/coercionToUnitWithEarlyReturn.fir.txt
...a/resolve/inference/coercionToUnitWithEarlyReturn.fir.txt
+2
-2
compiler/fir/analysis-tests/testData/resolve/inference/coercionToUnitWithEarlyReturn.kt
...stData/resolve/inference/coercionToUnitWithEarlyReturn.kt
+1
-1
compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/dfa/cfg/ControlFlowGraphBuilder.kt
...ins/kotlin/fir/resolve/dfa/cfg/ControlFlowGraphBuilder.kt
+8
-2
compiler/testData/diagnostics/testsWithStdLib/buildLazyValueForMap.fir.kt
...a/diagnostics/testsWithStdLib/buildLazyValueForMap.fir.kt
+0
-23
compiler/testData/diagnostics/testsWithStdLib/buildLazyValueForMap.kt
...tData/diagnostics/testsWithStdLib/buildLazyValueForMap.kt
+2
-0
未找到文件。
compiler/fir/analysis-tests/testData/resolve/callResolution/safeCallOnTypeAlias.fir.txt
浏览文件 @
83e32016
FILE: safeCallOnTypeAlias.kt
FILE: safeCallOnTypeAlias.kt
public final typealias MyTypeAlias = R|() -> kotlin/String?|
public final typealias MyTypeAlias = R|() -> kotlin/String?|
public final fun foo(x: R|MyTypeAlias|): R|kotlin/Unit| {
public final fun foo(x: R|MyTypeAlias|): R|kotlin/Unit| {
R|<local>/x|?.{ $subj$.R|kotlin/let|<R|() -> kotlin/String?|, R|kotlin/String
|>(<L> = let@fun <anonymous>(y: R|() -> kotlin/String?|): R|kotlin/String
| <kind=EXACTLY_ONCE> {
R|<local>/x|?.{ $subj$.R|kotlin/let|<R|() -> kotlin/String?|, R|kotlin/String
?|>(<L> = let@fun <anonymous>(y: R|() -> kotlin/String?|): R|kotlin/String?
| <kind=EXACTLY_ONCE> {
^ R|<local>/y|.R|SubstitutionOverride<kotlin/Function0.invoke: R|kotlin/String?|>|()?.{ $subj$.R|kotlin/let|<R|kotlin/String|, R|kotlin/String|>(<L> = let@fun <anonymous>(result: R|kotlin/String|): R|kotlin/String| <kind=EXACTLY_ONCE> {
^ R|<local>/y|.R|SubstitutionOverride<kotlin/Function0.invoke: R|kotlin/String?|>|()?.{ $subj$.R|kotlin/let|<R|kotlin/String|, R|kotlin/String|>(<L> = let@fun <anonymous>(result: R|kotlin/String|): R|kotlin/String| <kind=EXACTLY_ONCE> {
^ R|/bar|(R|<local>/result|)
^ R|/bar|(R|<local>/result|)
}
}
...
...
compiler/fir/analysis-tests/testData/resolve/inference/coercionToUnitWithEarlyReturn.fir.txt
浏览文件 @
83e32016
...
@@ -11,7 +11,7 @@ FILE: coercionToUnitWithEarlyReturn.kt
...
@@ -11,7 +11,7 @@ FILE: coercionToUnitWithEarlyReturn.kt
public final fun foo(x: R|() -> kotlin/Unit|): R|kotlin/Unit| {
public final fun foo(x: R|() -> kotlin/Unit|): R|kotlin/Unit| {
}
}
public final fun main(x: R|A?|): R|kotlin/Unit| {
public final fun main(x: R|A?|): R|kotlin/Unit| {
lval lambda: R|() -> kotlin/Unit
| = l@fun <anonymous>(): R|kotlin/Unit
| {
lval lambda: R|() -> kotlin/Unit
?| = l@fun <anonymous>(): R|kotlin/Unit?
| {
when () {
when () {
==(R|<local>/x|?.{ $subj$.R|kotlin/Any.hashCode|() }, Int(0)) -> {
==(R|<local>/x|?.{ $subj$.R|kotlin/Any.hashCode|() }, Int(0)) -> {
^@l Unit
^@l Unit
...
@@ -21,5 +21,5 @@ FILE: coercionToUnitWithEarlyReturn.kt
...
@@ -21,5 +21,5 @@ FILE: coercionToUnitWithEarlyReturn.kt
^ R|<local>/x|?.{ $subj$.R|/A.unit|() }
^ R|<local>/x|?.{ $subj$.R|/A.unit|() }
}
}
R|/foo|
(R|<local>/lambda|)
<Inapplicable(INAPPLICABLE): /foo>#
(R|<local>/lambda|)
}
}
compiler/fir/analysis-tests/testData/resolve/inference/coercionToUnitWithEarlyReturn.kt
浏览文件 @
83e32016
...
@@ -15,5 +15,5 @@ fun main(x: A?) {
...
@@ -15,5 +15,5 @@ fun main(x: A?) {
}
}
// lambda has a type (() -> Unit?)
// lambda has a type (() -> Unit?)
foo
(
lambda
)
<!
INAPPLICABLE_CANDIDATE
{
LT
}!><!
INAPPLICABLE_CANDIDATE
{
PSI
}!>
foo
<!>(
lambda
)<!>
}
}
compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/dfa/cfg/ControlFlowGraphBuilder.kt
浏览文件 @
83e32016
...
@@ -133,7 +133,6 @@ class ControlFlowGraphBuilder {
...
@@ -133,7 +133,6 @@ class ControlFlowGraphBuilder {
fun
CFGNode
<*>.
extractArgument
():
FirElement
?
=
when
(
this
)
{
fun
CFGNode
<*>.
extractArgument
():
FirElement
?
=
when
(
this
)
{
is
FunctionEnterNode
,
is
TryMainBlockEnterNode
,
is
CatchClauseEnterNode
->
null
is
FunctionEnterNode
,
is
TryMainBlockEnterNode
,
is
CatchClauseEnterNode
->
null
is
ExitSafeCallNode
->
lastPreviousNode
.
extractArgument
()
is
StubNode
,
is
BlockExitNode
->
firstPreviousNode
.
extractArgument
()
is
StubNode
,
is
BlockExitNode
->
firstPreviousNode
.
extractArgument
()
else
->
fir
.
extractArgument
()
else
->
fir
.
extractArgument
()
}
}
...
@@ -1090,8 +1089,9 @@ class ControlFlowGraphBuilder {
...
@@ -1090,8 +1089,9 @@ class ControlFlowGraphBuilder {
* lastNode -> exitNode
* lastNode -> exitNode
* instead of
* instead of
* lastNode -> enterNode -> exitNode
* lastNode -> enterNode -> exitNode
* because
of we need to fork flow on
`enterNode`, so `exitNode`
* because
we need to fork flow before
`enterNode`, so `exitNode`
* will have unchanged flow from `lastNode`
* will have unchanged flow from `lastNode`
* which corresponds to a path with nullable receiver.
*/
*/
val
lastNode
=
lastNodes
.
pop
()
val
lastNode
=
lastNodes
.
pop
()
val
enterNode
=
createEnterSafeCallNode
(
safeCall
)
val
enterNode
=
createEnterSafeCallNode
(
safeCall
)
...
@@ -1104,6 +1104,12 @@ class ControlFlowGraphBuilder {
...
@@ -1104,6 +1104,12 @@ class ControlFlowGraphBuilder {
}
}
fun
exitSafeCall
():
ExitSafeCallNode
{
fun
exitSafeCall
():
ExitSafeCallNode
{
// There will be two paths towards this exit safe call node:
// one from the node prior to the enclosing safe call, and
// the other from the selector part in the enclosing safe call.
// Note that *neither* points to the safe call directly.
// So, when it comes to the real exit of the enclosing block/function,
// the safe call bound to this exit safe call node should be retrieved.
return
exitSafeCallNodes
.
pop
().
also
{
return
exitSafeCallNodes
.
pop
().
also
{
addNewSimpleNode
(
it
)
addNewSimpleNode
(
it
)
it
.
updateDeadStatus
()
it
.
updateDeadStatus
()
...
...
compiler/testData/diagnostics/testsWithStdLib/buildLazyValueForMap.fir.kt
已删除
100644 → 0
浏览文件 @
266432a4
// !WITH_NEW_INFERENCE
interface
ClassId
interface
JavaAnnotation
{
val
classId
:
ClassId
?
}
interface
JavaAnnotationOwner
{
val
annotations
:
Collection
<
JavaAnnotation
>
}
interface
MapBasedJavaAnnotationOwner
:
JavaAnnotationOwner
{
val
annotationsByFqNameHash
:
Map
<
Int
?
,
JavaAnnotation
>
}
fun
JavaAnnotationOwner
.
buildLazyValueForMap
()
=
lazy
{
annotations
.
associateBy
{
it
.
classId
?.
hashCode
()
}
}
abstract
class
BinaryJavaMethodBase
():
MapBasedJavaAnnotationOwner
{
override
val
<!
PROPERTY_TYPE_MISMATCH_ON_OVERRIDE
!>
annotationsByFqNameHash
<!>
by
buildLazyValueForMap
()
}
compiler/testData/diagnostics/testsWithStdLib/buildLazyValueForMap.kt
浏览文件 @
83e32016
// FIR_IDENTICAL
interface
ClassId
interface
ClassId
interface
JavaAnnotation
{
interface
JavaAnnotation
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录