Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
硅谷海盗
kotlin
提交
74118930
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,发现更多精彩内容 >>
提交
74118930
编写于
3月 10, 2021
作者:
D
Dmitriy Novozhilov
提交者:
TeamCityServer
3月 11, 2021
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[FE] Don't fail with exception if ESVisitor tries to visit ESLambda
#KT-45243 Fixed
上级
f3135bab
变更
10
显示空白变更内容
内联
并排
Showing
10 changed file
with
78 addition
and
15 deletion
+78
-15
compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirOldFrontendDiagnosticsTestGenerated.java
.../test/runners/FirOldFrontendDiagnosticsTestGenerated.java
+6
-0
compiler/frontend/src/org/jetbrains/kotlin/contracts/ESDataFlowValue.kt
...end/src/org/jetbrains/kotlin/contracts/ESDataFlowValue.kt
+2
-2
compiler/resolution/src/org/jetbrains/kotlin/contracts/model/ESExpressionVisitor.kt
...g/jetbrains/kotlin/contracts/model/ESExpressionVisitor.kt
+4
-1
compiler/resolution/src/org/jetbrains/kotlin/contracts/model/visitors/InfoCollector.kt
...etbrains/kotlin/contracts/model/visitors/InfoCollector.kt
+3
-4
compiler/resolution/src/org/jetbrains/kotlin/contracts/model/visitors/Reducer.kt
.../org/jetbrains/kotlin/contracts/model/visitors/Reducer.kt
+6
-2
compiler/resolution/src/org/jetbrains/kotlin/contracts/model/visitors/Substitutor.kt
.../jetbrains/kotlin/contracts/model/visitors/Substitutor.kt
+5
-6
compiler/testData/diagnostics/testsWithStdLib/contracts/fromStdlib/kt45243.fir.kt
...stics/testsWithStdLib/contracts/fromStdlib/kt45243.fir.kt
+19
-0
compiler/testData/diagnostics/testsWithStdLib/contracts/fromStdlib/kt45243.kt
...agnostics/testsWithStdLib/contracts/fromStdlib/kt45243.kt
+19
-0
compiler/testData/diagnostics/testsWithStdLib/contracts/fromStdlib/kt45243.txt
...gnostics/testsWithStdLib/contracts/fromStdlib/kt45243.txt
+8
-0
compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/DiagnosticTestGenerated.java
...etbrains/kotlin/test/runners/DiagnosticTestGenerated.java
+6
-0
未找到文件。
compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirOldFrontendDiagnosticsTestGenerated.java
浏览文件 @
74118930
...
...
@@ -32152,6 +32152,12 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirDiagnosti
runTest("compiler/testData/diagnostics/testsWithStdLib/contracts/fromStdlib/isNullOrEmpty.kt");
}
@Test
@TestMetadata("kt45243.kt")
public void testKt45243() throws Exception {
runTest("compiler/testData/diagnostics/testsWithStdLib/contracts/fromStdlib/kt45243.kt");
}
@Test
@TestMetadata("require.kt")
public void testRequire() throws Exception {
compiler/frontend/src/org/jetbrains/kotlin/contracts/ESDataFlowValue.kt
浏览文件 @
74118930
...
...
@@ -78,6 +78,6 @@ class ESReceiverWithDataFlowValue(
*/
class
ESLambda
(
val
lambda
:
KtLambdaExpression
)
:
AbstractESValue
(
null
)
{
override
fun
<
T
>
accept
(
visitor
:
ESExpressionVisitor
<
T
>):
T
{
throw
IllegalStateException
(
"Lambdas shouldn't be visited by ESExpressionVisitor"
)
return
visitor
.
visitLambda
(
this
)
}
}
compiler/resolution/src/org/jetbrains/kotlin/contracts/model/ESExpressionVisitor.kt
浏览文件 @
74118930
...
...
@@ -30,4 +30,7 @@ interface ESExpressionVisitor<out T> {
fun
visitConstant
(
esConstant
:
ESConstant
):
T
fun
visitReceiver
(
esReceiver
:
ESReceiver
):
T
// ESLambda is invisible in this module
fun
visitLambda
(
lambda
:
ESValue
):
T
}
compiler/resolution/src/org/jetbrains/kotlin/contracts/model/visitors/InfoCollector.kt
浏览文件 @
74118930
...
...
@@ -17,10 +17,7 @@
package
org.jetbrains.kotlin.contracts.model.visitors
import
org.jetbrains.kotlin.builtins.KotlinBuiltIns
import
org.jetbrains.kotlin.contracts.model.ConditionalEffect
import
org.jetbrains.kotlin.contracts.model.ESEffect
import
org.jetbrains.kotlin.contracts.model.ESExpressionVisitor
import
org.jetbrains.kotlin.contracts.model.MutableContextInfo
import
org.jetbrains.kotlin.contracts.model.*
import
org.jetbrains.kotlin.contracts.model.structure.*
class
InfoCollector
(
private
val
observedEffect
:
ESEffect
,
private
val
builtIns
:
KotlinBuiltIns
)
:
ESExpressionVisitor
<
MutableContextInfo
>
{
...
...
@@ -83,6 +80,8 @@ class InfoCollector(private val observedEffect: ESEffect, private val builtIns:
override
fun
visitReceiver
(
esReceiver
:
ESReceiver
):
MutableContextInfo
=
MutableContextInfo
.
EMPTY
override
fun
visitLambda
(
lambda
:
ESValue
):
MutableContextInfo
=
MutableContextInfo
.
EMPTY
private
fun
<
R
>
inverted
(
block
:
()
->
R
):
R
{
isInverted
=
isInverted
.
not
()
val
result
=
block
()
...
...
compiler/resolution/src/org/jetbrains/kotlin/contracts/model/visitors/Reducer.kt
浏览文件 @
74118930
...
...
@@ -66,8 +66,8 @@ class Reducer(private val builtIns: KotlinBuiltIns) : ESExpressionVisitor<ESExpr
return
ESConstants
.
booleanValue
(
result
.
xor
(
isOperator
.
functor
.
isNegated
))
}
override
fun
visitEqual
(
equal
:
ESEqual
):
ESExpression
{
val
reducedLeft
=
equal
.
left
.
accept
(
this
)
as
ESValue
override
fun
visitEqual
(
equal
:
ESEqual
):
ESExpression
?
{
val
reducedLeft
=
equal
.
left
.
accept
(
this
)
as
ESValue
?
?:
return
null
val
reducedRight
=
equal
.
right
if
(
reducedLeft
is
ESConstant
)
return
ESConstants
.
booleanValue
((
reducedLeft
==
reducedRight
).
xor
(
equal
.
functor
.
isNegated
))
...
...
@@ -114,4 +114,8 @@ class Reducer(private val builtIns: KotlinBuiltIns) : ESExpressionVisitor<ESExpr
override
fun
visitConstant
(
esConstant
:
ESConstant
):
ESConstant
=
esConstant
override
fun
visitReceiver
(
esReceiver
:
ESReceiver
):
ESReceiver
=
esReceiver
override
fun
visitLambda
(
lambda
:
ESValue
):
ESExpression
?
{
return
null
}
}
compiler/resolution/src/org/jetbrains/kotlin/contracts/model/visitors/Substitutor.kt
浏览文件 @
74118930
...
...
@@ -16,10 +16,7 @@
package
org.jetbrains.kotlin.contracts.model.visitors
import
org.jetbrains.kotlin.contracts.model.Computation
import
org.jetbrains.kotlin.contracts.model.ESExpression
import
org.jetbrains.kotlin.contracts.model.ESExpressionVisitor
import
org.jetbrains.kotlin.contracts.model.ESTypeSubstitution
import
org.jetbrains.kotlin.contracts.model.*
import
org.jetbrains.kotlin.contracts.model.structure.*
/**
...
...
@@ -60,9 +57,11 @@ class Substitutor(
return
CallComputation
(
ESBooleanType
,
or
.
functor
.
invokeWithArguments
(
left
,
right
))
}
override
fun
visitVariable
(
esVariable
:
ESVariable
):
Computation
?
=
substitutions
[
esVariable
]
?:
esVariable
override
fun
visitVariable
(
esVariable
:
ESVariable
):
Computation
=
substitutions
[
esVariable
]
?:
esVariable
override
fun
visitConstant
(
esConstant
:
ESConstant
):
Computation
?
=
esConstant
override
fun
visitConstant
(
esConstant
:
ESConstant
):
Computation
=
esConstant
override
fun
visitReceiver
(
esReceiver
:
ESReceiver
):
ESReceiver
=
esReceiver
override
fun
visitLambda
(
lambda
:
ESValue
):
Computation
=
lambda
}
compiler/testData/diagnostics/testsWithStdLib/contracts/fromStdlib/kt45243.fir.kt
0 → 100644
浏览文件 @
74118930
// ISSUE: KT-45243
import
kotlin.contracts.ExperimentalContracts
import
kotlin.contracts.contract
@ExperimentalContracts
fun
<
T
>
assertNotNull
(
actual
:
T
)
{
<!
WRONG_IMPLIES_CONDITION
!>
contract
{
returns
()
implies
(
actual
!=
null
)
}<!>
}
@ExperimentalContracts
fun
test_1
()
{
assertNotNull
{
}
}
@ExperimentalContracts
fun
test_2
()
{
assertNotNull
({
})
}
compiler/testData/diagnostics/testsWithStdLib/contracts/fromStdlib/kt45243.kt
0 → 100644
浏览文件 @
74118930
// ISSUE: KT-45243
import
kotlin.contracts.ExperimentalContracts
import
kotlin.contracts.contract
@ExperimentalContracts
fun
<
T
>
assertNotNull
(
actual
:
T
)
{
contract
{
returns
()
implies
(
actual
!=
null
)
}
}
@ExperimentalContracts
fun
test_1
()
{
assertNotNull
{
}
}
@ExperimentalContracts
fun
test_2
()
{
assertNotNull
({
})
}
compiler/testData/diagnostics/testsWithStdLib/contracts/fromStdlib/kt45243.txt
0 → 100644
浏览文件 @
74118930
package
@kotlin.contracts.ExperimentalContracts public fun </*0*/ T> assertNotNull(/*0*/ actual: T): kotlin.Unit
Returns(WILDCARD) -> actual != null
@kotlin.contracts.ExperimentalContracts public fun test_1(): kotlin.Unit
@kotlin.contracts.ExperimentalContracts public fun test_2(): kotlin.Unit
compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/DiagnosticTestGenerated.java
浏览文件 @
74118930
...
...
@@ -32248,6 +32248,12 @@ public class DiagnosticTestGenerated extends AbstractDiagnosticTest {
runTest("compiler/testData/diagnostics/testsWithStdLib/contracts/fromStdlib/isNullOrEmpty.kt");
}
@Test
@TestMetadata("kt45243.kt")
public void testKt45243() throws Exception {
runTest("compiler/testData/diagnostics/testsWithStdLib/contracts/fromStdlib/kt45243.kt");
}
@Test
@TestMetadata("require.kt")
public void testRequire() throws Exception {
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录