Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
硅谷海盗
kotlin
提交
1a0be3ee
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,发现更多精彩内容 >>
提交
1a0be3ee
编写于
2月 17, 2021
作者:
M
Mikhail Glukhikh
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix FirAnnotationArgumentChecker (String + ... case) #KT-44995 Fixed
上级
cd8f597e
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
26 addition
and
2 deletion
+26
-2
compiler/fir/analysis-tests/testData/resolve/diagnostics/nonConstValInAnnotationArgument.fir.txt
...solve/diagnostics/nonConstValInAnnotationArgument.fir.txt
+15
-0
compiler/fir/analysis-tests/testData/resolve/diagnostics/nonConstValInAnnotationArgument.kt
...ta/resolve/diagnostics/nonConstValInAnnotationArgument.kt
+8
-0
compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/declaration/FirAnnotationArgumentChecker.kt
...ysis/checkers/declaration/FirAnnotationArgumentChecker.kt
+2
-1
compiler/fir/cones/src/org/jetbrains/kotlin/fir/symbols/StandardClassIds.kt
.../src/org/jetbrains/kotlin/fir/symbols/StandardClassIds.kt
+1
-0
compiler/testData/codegen/box/collectionLiterals/collectionLiteralsWithConstants.kt
...box/collectionLiterals/collectionLiteralsWithConstants.kt
+0
-1
未找到文件。
compiler/fir/analysis-tests/testData/resolve/diagnostics/nonConstValInAnnotationArgument.fir.txt
浏览文件 @
1a0be3ee
...
@@ -17,3 +17,18 @@ FILE: nonConstValInAnnotationArgument.kt
...
@@ -17,3 +17,18 @@ FILE: nonConstValInAnnotationArgument.kt
public get(): R|kotlin/Int|
public get(): R|kotlin/Int|
@R|Ann|(<implicitArrayOf>(R|/foo|, R|/foo|.R|kotlin/String.plus|(R|/cnst|.R|kotlin/Any.toString|()))) public final fun test(): R|kotlin/Unit| {
@R|Ann|(<implicitArrayOf>(R|/foo|, R|/foo|.R|kotlin/String.plus|(R|/cnst|.R|kotlin/Any.toString|()))) public final fun test(): R|kotlin/Unit| {
}
}
public final const val A: R|kotlin/String| = String(foo)
public get(): R|kotlin/String|
public final const val B: R|kotlin/Int| = Int(100)
public get(): R|kotlin/Int|
public final annotation class S : R|kotlin/Annotation| {
public constructor(s: R|kotlin/String|): R|S| {
super<R|kotlin/Any|>()
}
public final val s: R|kotlin/String| = R|<local>/s|
public get(): R|kotlin/String|
}
@R|S|(R|/A|.R|kotlin/String.plus|(R|/B|)) public final fun foo(): R|kotlin/Unit| {
}
compiler/fir/analysis-tests/testData/resolve/diagnostics/nonConstValInAnnotationArgument.kt
浏览文件 @
1a0be3ee
...
@@ -11,3 +11,11 @@ const val cnst = 2
...
@@ -11,3 +11,11 @@ const val cnst = 2
)<!>
)<!>
)
)
fun
test
()
{}
fun
test
()
{}
const
val
A
=
"foo"
const
val
B
=
100
annotation
class
S
(
val
s
:
String
)
@S
(
A
+
B
)
fun
foo
()
{}
\ No newline at end of file
compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/declaration/FirAnnotationArgumentChecker.kt
浏览文件 @
1a0be3ee
...
@@ -23,6 +23,7 @@ import org.jetbrains.kotlin.fir.references.FirResolvedNamedReference
...
@@ -23,6 +23,7 @@ import org.jetbrains.kotlin.fir.references.FirResolvedNamedReference
import
org.jetbrains.kotlin.fir.resolve.toSymbol
import
org.jetbrains.kotlin.fir.resolve.toSymbol
import
org.jetbrains.kotlin.fir.scopes.impl.FirIntegerOperatorCall
import
org.jetbrains.kotlin.fir.scopes.impl.FirIntegerOperatorCall
import
org.jetbrains.kotlin.fir.symbols.StandardClassIds
import
org.jetbrains.kotlin.fir.symbols.StandardClassIds
import
org.jetbrains.kotlin.fir.symbols.StandardClassIds.primitiveTypesAndString
import
org.jetbrains.kotlin.fir.symbols.impl.FirCallableSymbol
import
org.jetbrains.kotlin.fir.symbols.impl.FirCallableSymbol
import
org.jetbrains.kotlin.fir.types.*
import
org.jetbrains.kotlin.fir.types.*
import
org.jetbrains.kotlin.name.Name
import
org.jetbrains.kotlin.name.Name
...
@@ -168,7 +169,7 @@ object FirAnnotationArgumentChecker : FirBasicDeclarationChecker() {
...
@@ -168,7 +169,7 @@ object FirAnnotationArgumentChecker : FirBasicDeclarationChecker() {
if
(
calleeReference
.
name
==
PLUS
if
(
calleeReference
.
name
==
PLUS
&&
expClassId
!=
receiverClassId
&&
expClassId
!=
receiverClassId
&&
(
expClassId
!
in
StandardClassIds
.
primitiveTypes
||
receiverClassId
!
in
StandardClassIds
.
primitiveTypes
)
&&
(
expClassId
!
in
primitiveTypesAndString
||
receiverClassId
!
in
primitiveTypesAndString
)
)
)
return
FirErrors
.
ANNOTATION_ARGUMENT_MUST_BE_CONST
return
FirErrors
.
ANNOTATION_ARGUMENT_MUST_BE_CONST
...
...
compiler/fir/cones/src/org/jetbrains/kotlin/fir/symbols/StandardClassIds.kt
浏览文件 @
1a0be3ee
...
@@ -71,6 +71,7 @@ object StandardClassIds {
...
@@ -71,6 +71,7 @@ object StandardClassIds {
Byte
,
Short
,
Int
,
Long
,
Byte
,
Short
,
Int
,
Long
,
Float
,
Double
Float
,
Double
)
)
val
primitiveTypesAndString
=
primitiveTypes
+
String
val
primitiveArrayTypeByElementType
=
primitiveTypes
.
associate
{
id
->
id
to
id
.
shortClassName
.
primitiveArrayId
()
}
val
primitiveArrayTypeByElementType
=
primitiveTypes
.
associate
{
id
->
id
to
id
.
shortClassName
.
primitiveArrayId
()
}
val
elementTypeByPrimitiveArrayType
=
primitiveArrayTypeByElementType
.
inverseMap
()
val
elementTypeByPrimitiveArrayType
=
primitiveArrayTypeByElementType
.
inverseMap
()
...
...
compiler/testData/codegen/box/collectionLiterals/collectionLiteralsWithConstants.kt
浏览文件 @
1a0be3ee
// IGNORE_FIR_DIAGNOSTICS
// WITH_REFLECT
// WITH_REFLECT
// TARGET_BACKEND: JVM
// TARGET_BACKEND: JVM
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录