Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
硅谷海盗
kotlin
提交
21000f41
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,发现更多精彩内容 >>
提交
21000f41
编写于
2月 02, 2021
作者:
M
Mikhail Glukhikh
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[FIR] Support TypeVariableMarker.isReified
上级
465261e6
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
91 addition
and
2 deletion
+91
-2
compiler/fir/analysis-tests/testData/resolveWithStdlib/problems/valueOfOrNull.fir.txt
...testData/resolveWithStdlib/problems/valueOfOrNull.fir.txt
+59
-0
compiler/fir/analysis-tests/testData/resolveWithStdlib/problems/valueOfOrNull.kt
...ests/testData/resolveWithStdlib/problems/valueOfOrNull.kt
+19
-0
compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirDiagnosticTestGenerated.java
...rains/kotlin/test/runners/FirDiagnosticTestGenerated.java
+6
-0
compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirDiagnosticsWithLightTreeTestGenerated.java
...est/runners/FirDiagnosticsWithLightTreeTestGenerated.java
+6
-0
compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/inference/ConeConstraintSystemUtilContext.kt
.../fir/resolve/inference/ConeConstraintSystemUtilContext.kt
+1
-2
未找到文件。
compiler/fir/analysis-tests/testData/resolveWithStdlib/problems/valueOfOrNull.fir.txt
0 → 100644
浏览文件 @
21000f41
FILE: valueOfOrNull.kt
public final enum class SomeEnum : R|kotlin/Enum<SomeEnum>| {
private constructor(): R|SomeEnum| {
super<R|kotlin/Enum<SomeEnum>|>()
}
public final static enum entry ENTRY: R|SomeEnum|
public final static fun values(): R|kotlin/Array<SomeEnum>| {
}
public final static fun valueOf(value: R|kotlin/String|): R|SomeEnum| {
}
}
public final fun foo(s: R|kotlin/String?|): R|kotlin/Unit| {
lval result: R|SomeEnum| = R|<local>/s|?.{ $subj$.R|kotlin/let|<R|kotlin/String|, R|SomeEnum?|>(<L> = let@fun <anonymous>(it: R|kotlin/String|): R|SomeEnum?| <kind=EXACTLY_ONCE> {
^ R|/valueOfOrNull|<R|SomeEnum|>(R|<local>/it|)
}
) } ?: Q|SomeEnum|.R|/SomeEnum.ENTRY|
lval result2: R|SomeEnum| = R|<local>/s|?.{ $subj$.R|kotlin/let|<R|kotlin/String|, R|SomeEnum?|>(<L> = let@fun <anonymous>(it: R|kotlin/String|): R|SomeEnum?| <kind=EXACTLY_ONCE> {
^ R|/valueOfOrNull|<R|SomeEnum|>(R|<local>/it|)
}
) } ?: Q|SomeEnum|.R|/SomeEnum.ENTRY|
lval result3: R|SomeEnum?| = when () {
==(R|<local>/s|, Null(null)) -> {
Q|SomeEnum|.R|/SomeEnum.ENTRY|
}
else -> {
R|/valueOfOrNull|<R|SomeEnum|>(R|<local>/s|)
}
}
lval result4: R|SomeEnum?| = when () {
==(R|<local>/s|, Null(null)) -> {
Q|SomeEnum|.R|/SomeEnum.ENTRY|
}
else -> {
R|<local>/s|.R|kotlin/let|<R|kotlin/String|, R|SomeEnum?|>(<L> = let@fun <anonymous>(it: R|kotlin/String|): R|SomeEnum?| <kind=EXACTLY_ONCE> {
^ R|/valueOfOrNull|<R|SomeEnum|>(R|<local>/it|)
}
)
}
}
}
public final inline fun <reified E : R|kotlin/Enum<E>|> valueOfOrNull(value: R|kotlin/String|): R|E?| {
lval <iterator>: R|kotlin/collections/Iterator<E>| = R|kotlin/enumValues|<R|E|>().R|SubstitutionOverride<kotlin/Array.iterator: R|kotlin/collections/Iterator<E>|>|()
while(R|<local>/<iterator>|.R|kotlin/collections/Iterator.hasNext|()) {
lval enumValue: R|E| = R|<local>/<iterator>|.R|SubstitutionOverride<kotlin/collections/Iterator.next: R|E|>|()
when () {
==(R|<local>/enumValue|.R|kotlin/Enum.name|, R|<local>/value|) -> {
^valueOfOrNull R|<local>/enumValue|
}
}
}
^valueOfOrNull Null(null)
}
compiler/fir/analysis-tests/testData/resolveWithStdlib/problems/valueOfOrNull.kt
0 → 100644
浏览文件 @
21000f41
enum
class
SomeEnum
{
ENTRY
;
}
fun
foo
(
s
:
String
?)
{
val
result
=
s
?.
let
{
valueOfOrNull
(
it
)
}
?:
SomeEnum
.
ENTRY
val
result2
=
s
?.
let
{
valueOfOrNull
<
SomeEnum
>(
it
)
}
?:
SomeEnum
.
ENTRY
val
result3
=
if
(
s
==
null
)
SomeEnum
.
ENTRY
else
valueOfOrNull
(
s
)
val
result4
=
if
(
s
==
null
)
SomeEnum
.
ENTRY
else
s
.
let
{
valueOfOrNull
(
it
)
}
}
inline
fun
<
reified
E
:
Enum
<
E
>>
valueOfOrNull
(
value
:
String
):
E
?
{
for
(
enumValue
in
enumValues
<
E
>())
{
if
(
enumValue
.
name
==
value
)
{
return
enumValue
}
}
return
null
}
compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirDiagnosticTestGenerated.java
浏览文件 @
21000f41
...
...
@@ -4947,6 +4947,12 @@ public class FirDiagnosticTestGenerated extends AbstractFirDiagnosticTest {
runTest
(
"compiler/fir/analysis-tests/testData/resolveWithStdlib/problems/TypesEligibleForSimpleVisit.kt"
);
}
@Test
@TestMetadata
(
"valueOfOrNull.kt"
)
public
void
testValueOfOrNull
()
throws
Exception
{
runTest
(
"compiler/fir/analysis-tests/testData/resolveWithStdlib/problems/valueOfOrNull.kt"
);
}
@Test
@TestMetadata
(
"weakHashMap.kt"
)
public
void
testWeakHashMap
()
throws
Exception
{
...
...
compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirDiagnosticsWithLightTreeTestGenerated.java
浏览文件 @
21000f41
...
...
@@ -5015,6 +5015,12 @@ public class FirDiagnosticsWithLightTreeTestGenerated extends AbstractFirDiagnos
runTest
(
"compiler/fir/analysis-tests/testData/resolveWithStdlib/problems/TypesEligibleForSimpleVisit.kt"
);
}
@Test
@TestMetadata
(
"valueOfOrNull.kt"
)
public
void
testValueOfOrNull
()
throws
Exception
{
runTest
(
"compiler/fir/analysis-tests/testData/resolveWithStdlib/problems/valueOfOrNull.kt"
);
}
@Test
@TestMetadata
(
"weakHashMap.kt"
)
public
void
testWeakHashMap
()
throws
Exception
{
...
...
compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/inference/ConeConstraintSystemUtilContext.kt
浏览文件 @
21000f41
...
...
@@ -38,8 +38,7 @@ object ConeConstraintSystemUtilContext : ConstraintSystemUtilContext {
}
override
fun
TypeVariableMarker
.
isReified
():
Boolean
{
// TODO
return
false
return
this
is
TypeParameterBasedTypeVariable
&&
typeParameterSymbol
.
fir
.
isReified
}
override
fun
KotlinTypeMarker
.
refineType
():
KotlinTypeMarker
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录