Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
硅谷海盗
kotlin
提交
b417786f
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,发现更多精彩内容 >>
提交
b417786f
编写于
2月 24, 2021
作者:
A
Alexander Udalov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
JVM IR: do not hide constructor with inline class in anonymous object
#KT-45131 Fixed
上级
b026de76
变更
13
隐藏空白更改
内联
并排
Showing
13 changed file
with
80 addition
and
3 deletion
+80
-3
compiler/backend/src/org/jetbrains/kotlin/codegen/inline/AnonymousObjectTransformer.kt
...rains/kotlin/codegen/inline/AnonymousObjectTransformer.kt
+4
-1
compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirBlackBoxInlineCodegenTestGenerated.java
...unners/codegen/FirBlackBoxInlineCodegenTestGenerated.java
+6
-0
compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/SyntheticAccessorLowering.kt
...ins/kotlin/backend/jvm/lower/SyntheticAccessorLowering.kt
+3
-2
compiler/testData/codegen/boxInline/inlineClasses/anonymousObject.kt
...stData/codegen/boxInline/inlineClasses/anonymousObject.kt
+16
-0
compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/BlackBoxInlineCodegenTestGenerated.java
...t/runners/codegen/BlackBoxInlineCodegenTestGenerated.java
+6
-0
compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/CompileKotlinAgainstInlineKotlinTestGenerated.java
...odegen/CompileKotlinAgainstInlineKotlinTestGenerated.java
+6
-0
compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxInlineCodegenTestGenerated.java
...runners/codegen/IrBlackBoxInlineCodegenTestGenerated.java
+6
-0
compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrCompileKotlinAgainstInlineKotlinTestGenerated.java
...egen/IrCompileKotlinAgainstInlineKotlinTestGenerated.java
+6
-0
compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/JvmIrAgainstOldBoxInlineTestGenerated.java
...unners/codegen/JvmIrAgainstOldBoxInlineTestGenerated.java
+6
-0
compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/JvmOldAgainstIrBoxInlineTestGenerated.java
...unners/codegen/JvmOldAgainstIrBoxInlineTestGenerated.java
+6
-0
js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenInlineES6TestGenerated.java
...test/es6/semantics/IrJsCodegenInlineES6TestGenerated.java
+5
-0
js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenInlineTestGenerated.java
.../js/test/ir/semantics/IrJsCodegenInlineTestGenerated.java
+5
-0
js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/semantics/JsCodegenInlineTestGenerated.java
...otlin/js/test/semantics/JsCodegenInlineTestGenerated.java
+5
-0
未找到文件。
compiler/backend/src/org/jetbrains/kotlin/codegen/inline/AnonymousObjectTransformer.kt
浏览文件 @
b417786f
...
...
@@ -90,7 +90,10 @@ class AnonymousObjectTransformer(
val
node
=
MethodNode
(
access
,
name
,
desc
,
signature
,
exceptions
)
if
(
name
==
"<init>"
)
{
if
(
constructor
!=
null
)
{
throw
RuntimeException
(
"Lambda, SAM or anonymous object should have only one constructor"
)
throw
RuntimeException
(
"Lambda, SAM or anonymous object should have only one constructor.\n"
+
"First:\n${constructor.nodeText}\n\nSecond:\n${node.nodeText}\n"
)
}
constructor
=
node
}
else
{
...
...
compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirBlackBoxInlineCodegenTestGenerated.java
浏览文件 @
b417786f
...
...
@@ -2244,6 +2244,12 @@ public class FirBlackBoxInlineCodegenTestGenerated extends AbstractFirBlackBoxIn
KtTestUtil
.
assertAllTestsPresentByMetadataWithExcluded
(
this
.
getClass
(),
new
File
(
"compiler/testData/codegen/boxInline/inlineClasses"
),
Pattern
.
compile
(
"^(.+)\\.kt$"
),
null
,
TargetBackend
.
JVM_IR
,
true
);
}
@Test
@TestMetadata
(
"anonymousObject.kt"
)
public
void
testAnonymousObject
()
throws
Exception
{
runTest
(
"compiler/testData/codegen/boxInline/inlineClasses/anonymousObject.kt"
);
}
@Test
@TestMetadata
(
"inlineClassWithInlineValReturningInlineClass.kt"
)
public
void
testInlineClassWithInlineValReturningInlineClass
()
throws
Exception
{
...
...
compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/SyntheticAccessorLowering.kt
浏览文件 @
b417786f
...
...
@@ -229,8 +229,9 @@ internal class SyntheticAccessorLowering(val context: JvmBackendContext) : IrEle
val
constructedClass
=
constructedClass
if
(!
DescriptorVisibilities
.
isPrivate
(
visibility
)
&&
!
constructedClass
.
isInline
&&
hasMangledParameters
)
return
true
if
(!
DescriptorVisibilities
.
isPrivate
(
visibility
)
&&
!
constructedClass
.
isInline
&&
hasMangledParameters
&&
!
constructedClass
.
isAnonymousObject
)
return
true
if
(
visibility
!=
DescriptorVisibilities
.
PUBLIC
&&
constructedClass
.
modality
==
Modality
.
SEALED
)
return
true
...
...
compiler/testData/codegen/boxInline/inlineClasses/anonymousObject.kt
0 → 100644
浏览文件 @
b417786f
// NO_CHECK_LAMBDA_INLINING
// FILE: 1.kt
package
test
inline
class
IC
(
val
value
:
Any
)
inline
fun
<
reified
T
>
f
(
a
:
IC
):
()
->
T
=
{
a
.
value
as
T
}
// FILE: 2.kt
import
test.*
fun
box
():
String
=
f
<
String
>(
IC
(
"OK"
))()
compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/BlackBoxInlineCodegenTestGenerated.java
浏览文件 @
b417786f
...
...
@@ -2244,6 +2244,12 @@ public class BlackBoxInlineCodegenTestGenerated extends AbstractBlackBoxInlineCo
KtTestUtil
.
assertAllTestsPresentByMetadataWithExcluded
(
this
.
getClass
(),
new
File
(
"compiler/testData/codegen/boxInline/inlineClasses"
),
Pattern
.
compile
(
"^(.+)\\.kt$"
),
null
,
TargetBackend
.
JVM
,
true
);
}
@Test
@TestMetadata
(
"anonymousObject.kt"
)
public
void
testAnonymousObject
()
throws
Exception
{
runTest
(
"compiler/testData/codegen/boxInline/inlineClasses/anonymousObject.kt"
);
}
@Test
@TestMetadata
(
"inlineClassWithInlineValReturningInlineClass.kt"
)
public
void
testInlineClassWithInlineValReturningInlineClass
()
throws
Exception
{
...
...
compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/CompileKotlinAgainstInlineKotlinTestGenerated.java
浏览文件 @
b417786f
...
...
@@ -2244,6 +2244,12 @@ public class CompileKotlinAgainstInlineKotlinTestGenerated extends AbstractCompi
KtTestUtil
.
assertAllTestsPresentByMetadataWithExcluded
(
this
.
getClass
(),
new
File
(
"compiler/testData/codegen/boxInline/inlineClasses"
),
Pattern
.
compile
(
"^(.+)\\.kt$"
),
null
,
TargetBackend
.
JVM
,
true
);
}
@Test
@TestMetadata
(
"anonymousObject.kt"
)
public
void
testAnonymousObject
()
throws
Exception
{
runTest
(
"compiler/testData/codegen/boxInline/inlineClasses/anonymousObject.kt"
);
}
@Test
@TestMetadata
(
"inlineClassWithInlineValReturningInlineClass.kt"
)
public
void
testInlineClassWithInlineValReturningInlineClass
()
throws
Exception
{
...
...
compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxInlineCodegenTestGenerated.java
浏览文件 @
b417786f
...
...
@@ -2244,6 +2244,12 @@ public class IrBlackBoxInlineCodegenTestGenerated extends AbstractIrBlackBoxInli
KtTestUtil
.
assertAllTestsPresentByMetadataWithExcluded
(
this
.
getClass
(),
new
File
(
"compiler/testData/codegen/boxInline/inlineClasses"
),
Pattern
.
compile
(
"^(.+)\\.kt$"
),
null
,
TargetBackend
.
JVM_IR
,
true
);
}
@Test
@TestMetadata
(
"anonymousObject.kt"
)
public
void
testAnonymousObject
()
throws
Exception
{
runTest
(
"compiler/testData/codegen/boxInline/inlineClasses/anonymousObject.kt"
);
}
@Test
@TestMetadata
(
"inlineClassWithInlineValReturningInlineClass.kt"
)
public
void
testInlineClassWithInlineValReturningInlineClass
()
throws
Exception
{
...
...
compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrCompileKotlinAgainstInlineKotlinTestGenerated.java
浏览文件 @
b417786f
...
...
@@ -2244,6 +2244,12 @@ public class IrCompileKotlinAgainstInlineKotlinTestGenerated extends AbstractIrC
KtTestUtil
.
assertAllTestsPresentByMetadataWithExcluded
(
this
.
getClass
(),
new
File
(
"compiler/testData/codegen/boxInline/inlineClasses"
),
Pattern
.
compile
(
"^(.+)\\.kt$"
),
null
,
TargetBackend
.
JVM_IR
,
true
);
}
@Test
@TestMetadata
(
"anonymousObject.kt"
)
public
void
testAnonymousObject
()
throws
Exception
{
runTest
(
"compiler/testData/codegen/boxInline/inlineClasses/anonymousObject.kt"
);
}
@Test
@TestMetadata
(
"inlineClassWithInlineValReturningInlineClass.kt"
)
public
void
testInlineClassWithInlineValReturningInlineClass
()
throws
Exception
{
...
...
compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/JvmIrAgainstOldBoxInlineTestGenerated.java
浏览文件 @
b417786f
...
...
@@ -2244,6 +2244,12 @@ public class JvmIrAgainstOldBoxInlineTestGenerated extends AbstractJvmIrAgainstO
KtTestUtil
.
assertAllTestsPresentByMetadataWithExcluded
(
this
.
getClass
(),
new
File
(
"compiler/testData/codegen/boxInline/inlineClasses"
),
Pattern
.
compile
(
"^(.+)\\.kt$"
),
null
,
TargetBackend
.
JVM_MULTI_MODULE_IR_AGAINST_OLD
,
true
);
}
@Test
@TestMetadata
(
"anonymousObject.kt"
)
public
void
testAnonymousObject
()
throws
Exception
{
runTest
(
"compiler/testData/codegen/boxInline/inlineClasses/anonymousObject.kt"
);
}
@Test
@TestMetadata
(
"inlineClassWithInlineValReturningInlineClass.kt"
)
public
void
testInlineClassWithInlineValReturningInlineClass
()
throws
Exception
{
...
...
compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/JvmOldAgainstIrBoxInlineTestGenerated.java
浏览文件 @
b417786f
...
...
@@ -2244,6 +2244,12 @@ public class JvmOldAgainstIrBoxInlineTestGenerated extends AbstractJvmOldAgainst
KtTestUtil
.
assertAllTestsPresentByMetadataWithExcluded
(
this
.
getClass
(),
new
File
(
"compiler/testData/codegen/boxInline/inlineClasses"
),
Pattern
.
compile
(
"^(.+)\\.kt$"
),
null
,
TargetBackend
.
JVM_MULTI_MODULE_OLD_AGAINST_IR
,
true
);
}
@Test
@TestMetadata
(
"anonymousObject.kt"
)
public
void
testAnonymousObject
()
throws
Exception
{
runTest
(
"compiler/testData/codegen/boxInline/inlineClasses/anonymousObject.kt"
);
}
@Test
@TestMetadata
(
"inlineClassWithInlineValReturningInlineClass.kt"
)
public
void
testInlineClassWithInlineValReturningInlineClass
()
throws
Exception
{
...
...
js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenInlineES6TestGenerated.java
浏览文件 @
b417786f
...
...
@@ -1795,6 +1795,11 @@ public class IrJsCodegenInlineES6TestGenerated extends AbstractIrJsCodegenInline
KtTestUtil
.
assertAllTestsPresentByMetadataWithExcluded
(
this
.
getClass
(),
new
File
(
"compiler/testData/codegen/boxInline/inlineClasses"
),
Pattern
.
compile
(
"^(.+)\\.kt$"
),
null
,
TargetBackend
.
JS_IR_ES6
,
true
);
}
@TestMetadata
(
"anonymousObject.kt"
)
public
void
testAnonymousObject
()
throws
Exception
{
runTest
(
"compiler/testData/codegen/boxInline/inlineClasses/anonymousObject.kt"
);
}
@TestMetadata
(
"inlineClassWithInlineValReturningInlineClass.kt"
)
public
void
testInlineClassWithInlineValReturningInlineClass
()
throws
Exception
{
runTest
(
"compiler/testData/codegen/boxInline/inlineClasses/inlineClassWithInlineValReturningInlineClass.kt"
);
...
...
js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenInlineTestGenerated.java
浏览文件 @
b417786f
...
...
@@ -1795,6 +1795,11 @@ public class IrJsCodegenInlineTestGenerated extends AbstractIrJsCodegenInlineTes
KtTestUtil
.
assertAllTestsPresentByMetadataWithExcluded
(
this
.
getClass
(),
new
File
(
"compiler/testData/codegen/boxInline/inlineClasses"
),
Pattern
.
compile
(
"^(.+)\\.kt$"
),
null
,
TargetBackend
.
JS_IR
,
true
);
}
@TestMetadata
(
"anonymousObject.kt"
)
public
void
testAnonymousObject
()
throws
Exception
{
runTest
(
"compiler/testData/codegen/boxInline/inlineClasses/anonymousObject.kt"
);
}
@TestMetadata
(
"inlineClassWithInlineValReturningInlineClass.kt"
)
public
void
testInlineClassWithInlineValReturningInlineClass
()
throws
Exception
{
runTest
(
"compiler/testData/codegen/boxInline/inlineClasses/inlineClassWithInlineValReturningInlineClass.kt"
);
...
...
js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/semantics/JsCodegenInlineTestGenerated.java
浏览文件 @
b417786f
...
...
@@ -1795,6 +1795,11 @@ public class JsCodegenInlineTestGenerated extends AbstractJsCodegenInlineTest {
KtTestUtil
.
assertAllTestsPresentByMetadataWithExcluded
(
this
.
getClass
(),
new
File
(
"compiler/testData/codegen/boxInline/inlineClasses"
),
Pattern
.
compile
(
"^(.+)\\.kt$"
),
null
,
TargetBackend
.
JS
,
true
);
}
@TestMetadata
(
"anonymousObject.kt"
)
public
void
testAnonymousObject
()
throws
Exception
{
runTest
(
"compiler/testData/codegen/boxInline/inlineClasses/anonymousObject.kt"
);
}
@TestMetadata
(
"inlineClassWithInlineValReturningInlineClass.kt"
)
public
void
testInlineClassWithInlineValReturningInlineClass
()
throws
Exception
{
runTest
(
"compiler/testData/codegen/boxInline/inlineClasses/inlineClassWithInlineValReturningInlineClass.kt"
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录