Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
硅谷海盗
kotlin
提交
0d6e3093
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,发现更多精彩内容 >>
提交
0d6e3093
编写于
6月 03, 2020
作者:
J
Jinseong Jeon
提交者:
Mikhail Glukhikh
6月 04, 2020
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
FIR: construct type with actual type arguments during GetClassCall transformation
上级
4f8ad6bd
变更
15
隐藏空白更改
内联
并排
Showing
15 changed file
with
23 addition
and
39 deletion
+23
-39
compiler/fir/analysis-tests/testData/resolveWithStdlib/reflectionClass.txt
...ysis-tests/testData/resolveWithStdlib/reflectionClass.txt
+1
-1
compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/ResolveUtils.kt
...olve/src/org/jetbrains/kotlin/fir/resolve/ResolveUtils.kt
+2
-13
compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/body/resolve/FirExpressionsResolveTransformer.kt
...sformers/body/resolve/FirExpressionsResolveTransformer.kt
+2
-7
compiler/fir/resolve/src/org/jetbrains/kotlin/fir/types/TypeUtils.kt
...r/resolve/src/org/jetbrains/kotlin/fir/types/TypeUtils.kt
+10
-0
compiler/testData/codegen/box/jvmOverloads/varargs.kt
compiler/testData/codegen/box/jvmOverloads/varargs.kt
+0
-1
compiler/testData/codegen/box/package/mainInFiles.kt
compiler/testData/codegen/box/package/mainInFiles.kt
+0
-1
compiler/testData/codegen/box/reflection/annotations/localClassLiteral.kt
...a/codegen/box/reflection/annotations/localClassLiteral.kt
+0
-1
compiler/testData/codegen/box/reflection/classes/jvmNameOfStandardClasses.kt
...odegen/box/reflection/classes/jvmNameOfStandardClasses.kt
+0
-1
compiler/testData/codegen/box/reflection/mapping/types/annotationConstructorParameters.kt
...flection/mapping/types/annotationConstructorParameters.kt
+0
-1
compiler/testData/codegen/box/reflection/mapping/types/array.kt
...er/testData/codegen/box/reflection/mapping/types/array.kt
+0
-1
compiler/testData/codegen/box/reflection/supertypes/isSubclassOfIsSuperclassOf.kt
...n/box/reflection/supertypes/isSubclassOfIsSuperclassOf.kt
+0
-1
compiler/testData/codegen/box/reflection/types/classifierIsClass.kt
...estData/codegen/box/reflection/types/classifierIsClass.kt
+0
-1
compiler/testData/codegen/box/reflection/types/jvmErasureOfClass.kt
...estData/codegen/box/reflection/types/jvmErasureOfClass.kt
+0
-1
compiler/testData/codegen/box/reflection/types/jvmErasureOfTypeParameter.kt
...codegen/box/reflection/types/jvmErasureOfTypeParameter.kt
+0
-1
compiler/testData/diagnostics/testsWithStdLib/when/noTypeArgumentsInConstructor.fir.kt
.../testsWithStdLib/when/noTypeArgumentsInConstructor.fir.kt
+8
-8
未找到文件。
compiler/fir/analysis-tests/testData/resolveWithStdlib/reflectionClass.txt
浏览文件 @
0d6e3093
...
@@ -5,5 +5,5 @@ FILE: reflectionClass.kt
...
@@ -5,5 +5,5 @@ FILE: reflectionClass.kt
public get(): R|kotlin/reflect/KClass<kotlin/String>|
public get(): R|kotlin/reflect/KClass<kotlin/String>|
public final fun foo(): R|kotlin/Unit| {
public final fun foo(): R|kotlin/Unit| {
lval stringClass: R|java/lang/Class<kotlin/String>| = <getClass>(Q|kotlin/String|).R|kotlin/jvm/java|<R|kotlin/String|>
lval stringClass: R|java/lang/Class<kotlin/String>| = <getClass>(Q|kotlin/String|).R|kotlin/jvm/java|<R|kotlin/String|>
lval arrayStringClass: R|java/lang/Class<kotlin/Array<
*>>| = <getClass>(Q|kotlin/Array|).R|kotlin/jvm/java|<R|kotlin/Array<*
>|>
lval arrayStringClass: R|java/lang/Class<kotlin/Array<
kotlin/String>>| = <getClass>(Q|kotlin/Array|).R|kotlin/jvm/java|<R|kotlin/Array<kotlin/String
>|>
}
}
compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/ResolveUtils.kt
浏览文件 @
0d6e3093
...
@@ -188,19 +188,8 @@ fun FirClassifierSymbol<*>.constructType(
...
@@ -188,19 +188,8 @@ fun FirClassifierSymbol<*>.constructType(
}
}
}
}
private
fun
List
<
FirQualifierPart
>.
toTypeProjections
():
Array
<
ConeTypeProjection
>
=
private
fun
List
<
FirQualifierPart
>.
toTypeProjections
():
Array
<
ConeTypeProjection
>
=
asReversed
().
flatMap
{
asReversed
().
flatMap
{
it
.
typeArguments
.
map
{
typeArgument
->
typeArgument
.
toConeTypeProjection
()
}
}.
toTypedArray
()
it
.
typeArguments
.
map
{
typeArgument
->
when
(
typeArgument
)
{
is
FirStarProjection
->
ConeStarProjection
is
FirTypeProjectionWithVariance
->
{
val
type
=
(
typeArgument
.
typeRef
as
FirResolvedTypeRef
).
type
type
.
toTypeProjection
(
typeArgument
.
variance
)
}
else
->
error
(
"!"
)
}
}
}.
toTypedArray
()
fun
FirFunction
<*>.
constructFunctionalTypeRef
(
session
:
FirSession
,
isSuspend
:
Boolean
=
false
):
FirResolvedTypeRef
{
fun
FirFunction
<*>.
constructFunctionalTypeRef
(
session
:
FirSession
,
isSuspend
:
Boolean
=
false
):
FirResolvedTypeRef
{
val
receiverTypeRef
=
when
(
this
)
{
val
receiverTypeRef
=
when
(
this
)
{
...
...
compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/body/resolve/FirExpressionsResolveTransformer.kt
浏览文件 @
0d6e3093
...
@@ -34,6 +34,7 @@ import org.jetbrains.kotlin.fir.symbols.impl.FirClassSymbol
...
@@ -34,6 +34,7 @@ import org.jetbrains.kotlin.fir.symbols.impl.FirClassSymbol
import
org.jetbrains.kotlin.fir.symbols.impl.FirVariableSymbol
import
org.jetbrains.kotlin.fir.symbols.impl.FirVariableSymbol
import
org.jetbrains.kotlin.fir.types.*
import
org.jetbrains.kotlin.fir.types.*
import
org.jetbrains.kotlin.fir.types.builder.*
import
org.jetbrains.kotlin.fir.types.builder.*
import
org.jetbrains.kotlin.fir.types.impl.FirQualifierPartImpl
import
org.jetbrains.kotlin.fir.visitors.*
import
org.jetbrains.kotlin.fir.visitors.*
import
org.jetbrains.kotlin.name.ClassId
import
org.jetbrains.kotlin.name.ClassId
import
org.jetbrains.kotlin.name.Name
import
org.jetbrains.kotlin.name.Name
...
@@ -540,13 +541,7 @@ class FirExpressionsResolveTransformer(transformer: FirBodyResolveTransformer) :
...
@@ -540,13 +541,7 @@ class FirExpressionsResolveTransformer(transformer: FirBodyResolveTransformer) :
val
typeOfExpression
=
when
(
val
lhs
=
transformedGetClassCall
.
argument
)
{
val
typeOfExpression
=
when
(
val
lhs
=
transformedGetClassCall
.
argument
)
{
is
FirResolvedQualifier
->
{
is
FirResolvedQualifier
->
{
val
symbol
=
lhs
.
symbol
val
symbol
=
lhs
.
symbol
val
typeRef
=
val
typeRef
=
symbol
?.
constructType
(
lhs
.
typeArguments
.
map
{
it
.
toConeTypeProjection
()
}.
toTypedArray
(),
isNullable
=
false
)
symbol
?.
constructType
(
Array
((
symbol
.
phasedFir
as
?
FirTypeParameterRefsOwner
)
?.
typeParameters
?.
size
?:
0
)
{
ConeStarProjection
},
isNullable
=
false
,
)
if
(
typeRef
!=
null
)
{
if
(
typeRef
!=
null
)
{
lhs
.
replaceTypeRef
(
buildResolvedTypeRef
{
type
=
typeRef
})
lhs
.
replaceTypeRef
(
buildResolvedTypeRef
{
type
=
typeRef
})
typeRef
typeRef
...
...
compiler/fir/resolve/src/org/jetbrains/kotlin/fir/types/TypeUtils.kt
浏览文件 @
0d6e3093
...
@@ -184,6 +184,16 @@ fun ConeKotlinType.toTypeProjection(variance: Variance): ConeTypeProjection =
...
@@ -184,6 +184,16 @@ fun ConeKotlinType.toTypeProjection(variance: Variance): ConeTypeProjection =
Variance
.
OUT_VARIANCE
->
ConeKotlinTypeProjectionOut
(
this
)
Variance
.
OUT_VARIANCE
->
ConeKotlinTypeProjectionOut
(
this
)
}
}
internal
fun
FirTypeProjection
.
toConeTypeProjection
():
ConeTypeProjection
=
when
(
this
)
{
is
FirStarProjection
->
ConeStarProjection
is
FirTypeProjectionWithVariance
->
{
val
type
=
(
this
.
typeRef
as
FirResolvedTypeRef
).
type
type
.
toTypeProjection
(
this
.
variance
)
}
else
->
error
(
"!"
)
}
fun
ConeClassLikeLookupTag
.
constructClassType
(
fun
ConeClassLikeLookupTag
.
constructClassType
(
typeArguments
:
Array
<
out
ConeTypeProjection
>,
typeArguments
:
Array
<
out
ConeTypeProjection
>,
isNullable
:
Boolean
,
isNullable
:
Boolean
,
...
...
compiler/testData/codegen/box/jvmOverloads/varargs.kt
浏览文件 @
0d6e3093
// IGNORE_BACKEND_FIR: JVM_IR
// TARGET_BACKEND: JVM
// TARGET_BACKEND: JVM
// WITH_RUNTIME
// WITH_RUNTIME
...
...
compiler/testData/codegen/box/package/mainInFiles.kt
浏览文件 @
0d6e3093
// IGNORE_BACKEND_FIR: JVM_IR
// TARGET_BACKEND: JVM
// TARGET_BACKEND: JVM
// WITH_RUNTIME
// WITH_RUNTIME
...
...
compiler/testData/codegen/box/reflection/annotations/localClassLiteral.kt
浏览文件 @
0d6e3093
// IGNORE_BACKEND_FIR: JVM_IR
// TARGET_BACKEND: JVM
// TARGET_BACKEND: JVM
// WITH_REFLECT
// WITH_REFLECT
...
...
compiler/testData/codegen/box/reflection/classes/jvmNameOfStandardClasses.kt
浏览文件 @
0d6e3093
// IGNORE_BACKEND_FIR: JVM_IR
// TARGET_BACKEND: JVM
// TARGET_BACKEND: JVM
// WITH_REFLECT
// WITH_REFLECT
...
...
compiler/testData/codegen/box/reflection/mapping/types/annotationConstructorParameters.kt
浏览文件 @
0d6e3093
// IGNORE_BACKEND_FIR: JVM_IR
// TARGET_BACKEND: JVM
// TARGET_BACKEND: JVM
// WITH_REFLECT
// WITH_REFLECT
...
...
compiler/testData/codegen/box/reflection/mapping/types/array.kt
浏览文件 @
0d6e3093
// IGNORE_BACKEND_FIR: JVM_IR
// TARGET_BACKEND: JVM
// TARGET_BACKEND: JVM
// WITH_REFLECT
// WITH_REFLECT
...
...
compiler/testData/codegen/box/reflection/supertypes/isSubclassOfIsSuperclassOf.kt
浏览文件 @
0d6e3093
// IGNORE_BACKEND_FIR: JVM_IR
// IGNORE_BACKEND: JS_IR
// IGNORE_BACKEND: JS_IR
// IGNORE_BACKEND: JS_IR_ES6
// IGNORE_BACKEND: JS_IR_ES6
// TODO: muted automatically, investigate should it be ran for JS or not
// TODO: muted automatically, investigate should it be ran for JS or not
...
...
compiler/testData/codegen/box/reflection/types/classifierIsClass.kt
浏览文件 @
0d6e3093
// IGNORE_BACKEND_FIR: JVM_IR
// IGNORE_BACKEND: JS_IR
// IGNORE_BACKEND: JS_IR
// IGNORE_BACKEND: JS_IR_ES6
// IGNORE_BACKEND: JS_IR_ES6
// TODO: muted automatically, investigate should it be ran for JS or not
// TODO: muted automatically, investigate should it be ran for JS or not
...
...
compiler/testData/codegen/box/reflection/types/jvmErasureOfClass.kt
浏览文件 @
0d6e3093
// IGNORE_BACKEND_FIR: JVM_IR
// TARGET_BACKEND: JVM
// TARGET_BACKEND: JVM
// WITH_REFLECT
// WITH_REFLECT
...
...
compiler/testData/codegen/box/reflection/types/jvmErasureOfTypeParameter.kt
浏览文件 @
0d6e3093
// IGNORE_BACKEND_FIR: JVM_IR
// TARGET_BACKEND: JVM
// TARGET_BACKEND: JVM
// WITH_REFLECT
// WITH_REFLECT
...
...
compiler/testData/diagnostics/testsWithStdLib/when/noTypeArgumentsInConstructor.fir.kt
浏览文件 @
0d6e3093
...
@@ -23,21 +23,21 @@ val test3: MutableList<Int> =
...
@@ -23,21 +23,21 @@ val test3: MutableList<Int> =
}
}
val
test4
:
Collection
<
Int
>
=
val
test4
:
Collection
<
Int
>
=
listOf
(
1
,
2
,
3
).
<!
AMBIGUITY
!>
flatMapTo
<!>
(
LinkedHashSet
())
{
listOf
(
1
,
2
,
3
).
flatMapTo
(
LinkedHashSet
())
{
<!
INAPPLICABLE_CANDIDATE
!>
listOf
<!>(<!
UNRESOLVED_REFERENCE
!>
it
<!>
)
listOf
(
it
)
}
}
val
test5
:
Collection
<
Int
>
=
val
test5
:
Collection
<
Int
>
=
listOf
(
1
,
2
,
3
).
<!
AMBIGUITY
!>
flatMapTo
<!>
(
LinkedHashSet
())
{
// TODO
listOf
(
1
,
2
,
3
).
flatMapTo
(
LinkedHashSet
())
{
// TODO
if
(
true
)
<!
INAPPLICABLE_CANDIDATE
!>
listOf
<!>(<!
UNRESOLVED_REFERENCE
!>
it
<!>)
else
<!
INAPPLICABLE_CANDIDATE
!>
listOf
<!>(<!
UNRESOLVED_REFERENCE
!>
it
<!>
)
if
(
true
)
listOf
(
it
)
else
listOf
(
it
)
}
}
val
test6
:
Collection
<
Int
>
=
val
test6
:
Collection
<
Int
>
=
listOf
(
1
,
2
,
3
).
<!
AMBIGUITY
!>
flatMapTo
<!>
(
LinkedHashSet
<
Int
>())
{
listOf
(
1
,
2
,
3
).
flatMapTo
(
LinkedHashSet
<
Int
>())
{
if
(
true
)
<!
INAPPLICABLE_CANDIDATE
!>
listOf
<!>(<!
UNRESOLVED_REFERENCE
!>
it
<!>)
else
<!
INAPPLICABLE_CANDIDATE
!>
listOf
<!>(<!
UNRESOLVED_REFERENCE
!>
it
<!>
)
if
(
true
)
listOf
(
it
)
else
listOf
(
it
)
}
}
val
test7
:
Collection
<
Int
>
=
val
test7
:
Collection
<
Int
>
=
listOf
(
1
,
2
,
3
).
<!
AMBIGUITY
!>
flatMapTo
<!>
(
LinkedHashSet
())
{
listOf
(
1
,
2
,
3
).
flatMapTo
(
LinkedHashSet
())
{
<!
INAPPLICABLE_CANDIDATE
!>
select
<!>(<!
INAPPLICABLE_CANDIDATE
!>
listOf
<!>(<!
UNRESOLVED_REFERENCE
!>
it
<!>),
<!
INAPPLICABLE_CANDIDATE
!>
listOf
<!>(<!
UNRESOLVED_REFERENCE
!>
it
<!>
))
select
(
listOf
(
it
),
listOf
(
it
))
}
}
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录