Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
硅谷海盗
kotlin
提交
147d6052
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,发现更多精彩内容 >>
提交
147d6052
编写于
1月 20, 2021
作者:
M
Mikhael Bogdanov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Generate inline function arguments with parameters types
#KT-44429 Fixed
上级
50ab9ed0
变更
13
隐藏空白更改
内联
并排
Showing
13 changed file
with
68 addition
and
5 deletion
+68
-5
compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/codegen/ir/FirBlackBoxInlineCodegenTestGenerated.java
...lin/codegen/ir/FirBlackBoxInlineCodegenTestGenerated.java
+5
-0
compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/codegen/ExpressionCodegen.kt
...jetbrains/kotlin/backend/jvm/codegen/ExpressionCodegen.kt
+3
-3
compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/codegen/IrInlineCodegen.kt
...g/jetbrains/kotlin/backend/jvm/codegen/IrInlineCodegen.kt
+2
-2
compiler/testData/codegen/boxInline/complex/kt44429.kt
compiler/testData/codegen/boxInline/complex/kt44429.kt
+13
-0
compiler/tests-gen/org/jetbrains/kotlin/codegen/BlackBoxInlineCodegenTestGenerated.java
...ns/kotlin/codegen/BlackBoxInlineCodegenTestGenerated.java
+5
-0
compiler/tests-gen/org/jetbrains/kotlin/codegen/CompileKotlinAgainstInlineKotlinTestGenerated.java
...odegen/CompileKotlinAgainstInlineKotlinTestGenerated.java
+5
-0
compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrBlackBoxInlineCodegenTestGenerated.java
...tlin/codegen/ir/IrBlackBoxInlineCodegenTestGenerated.java
+5
-0
compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrCompileKotlinAgainstInlineKotlinTestGenerated.java
...n/ir/IrCompileKotlinAgainstInlineKotlinTestGenerated.java
+5
-0
compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/JvmIrAgainstOldBoxInlineTestGenerated.java
...lin/codegen/ir/JvmIrAgainstOldBoxInlineTestGenerated.java
+5
-0
compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/JvmOldAgainstIrBoxInlineTestGenerated.java
...lin/codegen/ir/JvmOldAgainstIrBoxInlineTestGenerated.java
+5
-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/fir/fir2ir/tests-gen/org/jetbrains/kotlin/codegen/ir/FirBlackBoxInlineCodegenTestGenerated.java
浏览文件 @
147d6052
...
...
@@ -1099,6 +1099,11 @@ public class FirBlackBoxInlineCodegenTestGenerated extends AbstractFirBlackBoxIn
runTest
(
"compiler/testData/codegen/boxInline/complex/forEachLine.kt"
);
}
@TestMetadata
(
"kt44429.kt"
)
public
void
testKt44429
()
throws
Exception
{
runTest
(
"compiler/testData/codegen/boxInline/complex/kt44429.kt"
);
}
@TestMetadata
(
"lambdaInLambda.kt"
)
public
void
testLambdaInLambda
()
throws
Exception
{
runTest
(
"compiler/testData/codegen/boxInline/complex/lambdaInLambda.kt"
);
...
...
compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/codegen/ExpressionCodegen.kt
浏览文件 @
147d6052
...
...
@@ -198,13 +198,13 @@ class ExpressionCodegen(
return
StackValue
.
onStack
(
type
,
irType
.
toIrBasedKotlinType
())
}
internal
fun
genOrGetLocal
(
expression
:
IrExpression
,
data
:
BlockInfo
):
StackValue
{
internal
fun
genOrGetLocal
(
expression
:
IrExpression
,
type
:
Type
,
parameterType
:
IrType
,
data
:
BlockInfo
):
StackValue
{
if
(
irFunction
.
origin
==
IrDeclarationOrigin
.
FUNCTION_FOR_DEFAULT_PARAMETER
)
{
if
(
expression
is
IrTypeOperatorCall
&&
expression
.
operator
==
IrTypeOperator
.
IMPLICIT_CAST
)
{
// inline lambda parameters are passed from `foo$default` to `foo` call with implicit cast,
// we need return pure StackValue.local value to be able proper inline this parameter later
if
(
expression
.
type
.
makeNullable
()
==
expression
.
argument
.
type
)
{
return
genOrGetLocal
(
expression
.
argument
,
data
)
return
genOrGetLocal
(
expression
.
argument
,
type
,
parameterType
,
data
)
}
}
}
...
...
@@ -212,7 +212,7 @@ class ExpressionCodegen(
return
if
(
expression
is
IrGetValue
)
StackValue
.
local
(
findLocalIndex
(
expression
.
symbol
),
frameMap
.
typeOf
(
expression
.
symbol
),
expression
.
type
.
toIrBasedKotlinType
())
else
gen
(
expression
,
type
Mapper
.
mapType
(
expression
.
type
),
expression
.
t
ype
,
data
)
gen
(
expression
,
type
,
parameterT
ype
,
data
)
}
fun
generate
()
{
...
...
compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/codegen/IrInlineCodegen.kt
浏览文件 @
147d6052
...
...
@@ -110,7 +110,7 @@ class IrInlineCodegen(
// Reuse an existing local if possible. NOTE: when stopping at a breakpoint placed
// in an inline function, arguments which reuse an existing local will not be visible
// in the debugger.
->
codegen
.
genOrGetLocal
(
argumentExpression
,
blockInfo
)
->
codegen
.
genOrGetLocal
(
argumentExpression
,
parameterType
,
irValueParameter
.
type
,
blockInfo
)
else
// Do not reuse locals for receivers. While it's actually completely fine, the non-IR
// backend does not do it for internal reasons, and here we replicate the debugging
...
...
@@ -128,7 +128,7 @@ class IrInlineCodegen(
}
private
fun
putCapturedValueOnStack
(
argumentExpression
:
IrExpression
,
valueType
:
Type
,
capturedParamIndex
:
Int
)
{
val
onStack
=
codegen
.
genOrGetLocal
(
argumentExpression
,
BlockInfo
())
val
onStack
=
codegen
.
genOrGetLocal
(
argumentExpression
,
valueType
,
argumentExpression
.
type
,
BlockInfo
())
val
expectedType
=
JvmKotlinType
(
valueType
,
argumentExpression
.
type
.
toIrBasedKotlinType
())
putArgumentOrCapturedToLocalVal
(
expectedType
,
onStack
,
capturedParamIndex
,
capturedParamIndex
,
ValueKind
.
CAPTURED
)
}
...
...
compiler/testData/codegen/boxInline/complex/kt44429.kt
0 → 100644
浏览文件 @
147d6052
// FILE: 1.kt
package
test
inline
fun
<
T
>
takeT
(
t
:
T
)
{}
// FILE: 2.kt
import
test.*
fun
box
():
String
{
val
f
=
{
null
}
as
()
->
Int
takeT
(
f
())
return
"OK"
}
\ No newline at end of file
compiler/tests-gen/org/jetbrains/kotlin/codegen/BlackBoxInlineCodegenTestGenerated.java
浏览文件 @
147d6052
...
...
@@ -1099,6 +1099,11 @@ public class BlackBoxInlineCodegenTestGenerated extends AbstractBlackBoxInlineCo
runTest
(
"compiler/testData/codegen/boxInline/complex/forEachLine.kt"
);
}
@TestMetadata
(
"kt44429.kt"
)
public
void
testKt44429
()
throws
Exception
{
runTest
(
"compiler/testData/codegen/boxInline/complex/kt44429.kt"
);
}
@TestMetadata
(
"lambdaInLambda.kt"
)
public
void
testLambdaInLambda
()
throws
Exception
{
runTest
(
"compiler/testData/codegen/boxInline/complex/lambdaInLambda.kt"
);
...
...
compiler/tests-gen/org/jetbrains/kotlin/codegen/CompileKotlinAgainstInlineKotlinTestGenerated.java
浏览文件 @
147d6052
...
...
@@ -1099,6 +1099,11 @@ public class CompileKotlinAgainstInlineKotlinTestGenerated extends AbstractCompi
runTest
(
"compiler/testData/codegen/boxInline/complex/forEachLine.kt"
);
}
@TestMetadata
(
"kt44429.kt"
)
public
void
testKt44429
()
throws
Exception
{
runTest
(
"compiler/testData/codegen/boxInline/complex/kt44429.kt"
);
}
@TestMetadata
(
"lambdaInLambda.kt"
)
public
void
testLambdaInLambda
()
throws
Exception
{
runTest
(
"compiler/testData/codegen/boxInline/complex/lambdaInLambda.kt"
);
...
...
compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrBlackBoxInlineCodegenTestGenerated.java
浏览文件 @
147d6052
...
...
@@ -1099,6 +1099,11 @@ public class IrBlackBoxInlineCodegenTestGenerated extends AbstractIrBlackBoxInli
runTest
(
"compiler/testData/codegen/boxInline/complex/forEachLine.kt"
);
}
@TestMetadata
(
"kt44429.kt"
)
public
void
testKt44429
()
throws
Exception
{
runTest
(
"compiler/testData/codegen/boxInline/complex/kt44429.kt"
);
}
@TestMetadata
(
"lambdaInLambda.kt"
)
public
void
testLambdaInLambda
()
throws
Exception
{
runTest
(
"compiler/testData/codegen/boxInline/complex/lambdaInLambda.kt"
);
...
...
compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrCompileKotlinAgainstInlineKotlinTestGenerated.java
浏览文件 @
147d6052
...
...
@@ -1099,6 +1099,11 @@ public class IrCompileKotlinAgainstInlineKotlinTestGenerated extends AbstractIrC
runTest
(
"compiler/testData/codegen/boxInline/complex/forEachLine.kt"
);
}
@TestMetadata
(
"kt44429.kt"
)
public
void
testKt44429
()
throws
Exception
{
runTest
(
"compiler/testData/codegen/boxInline/complex/kt44429.kt"
);
}
@TestMetadata
(
"lambdaInLambda.kt"
)
public
void
testLambdaInLambda
()
throws
Exception
{
runTest
(
"compiler/testData/codegen/boxInline/complex/lambdaInLambda.kt"
);
...
...
compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/JvmIrAgainstOldBoxInlineTestGenerated.java
浏览文件 @
147d6052
...
...
@@ -1099,6 +1099,11 @@ public class JvmIrAgainstOldBoxInlineTestGenerated extends AbstractJvmIrAgainstO
runTest
(
"compiler/testData/codegen/boxInline/complex/forEachLine.kt"
);
}
@TestMetadata
(
"kt44429.kt"
)
public
void
testKt44429
()
throws
Exception
{
runTest
(
"compiler/testData/codegen/boxInline/complex/kt44429.kt"
);
}
@TestMetadata
(
"lambdaInLambda.kt"
)
public
void
testLambdaInLambda
()
throws
Exception
{
runTest
(
"compiler/testData/codegen/boxInline/complex/lambdaInLambda.kt"
);
...
...
compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/JvmOldAgainstIrBoxInlineTestGenerated.java
浏览文件 @
147d6052
...
...
@@ -1099,6 +1099,11 @@ public class JvmOldAgainstIrBoxInlineTestGenerated extends AbstractJvmOldAgainst
runTest
(
"compiler/testData/codegen/boxInline/complex/forEachLine.kt"
);
}
@TestMetadata
(
"kt44429.kt"
)
public
void
testKt44429
()
throws
Exception
{
runTest
(
"compiler/testData/codegen/boxInline/complex/kt44429.kt"
);
}
@TestMetadata
(
"lambdaInLambda.kt"
)
public
void
testLambdaInLambda
()
throws
Exception
{
runTest
(
"compiler/testData/codegen/boxInline/complex/lambdaInLambda.kt"
);
...
...
js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenInlineES6TestGenerated.java
浏览文件 @
147d6052
...
...
@@ -949,6 +949,11 @@ public class IrJsCodegenInlineES6TestGenerated extends AbstractIrJsCodegenInline
runTest
(
"compiler/testData/codegen/boxInline/complex/closureChain.kt"
);
}
@TestMetadata
(
"kt44429.kt"
)
public
void
testKt44429
()
throws
Exception
{
runTest
(
"compiler/testData/codegen/boxInline/complex/kt44429.kt"
);
}
@TestMetadata
(
"swapAndWith.kt"
)
public
void
testSwapAndWith
()
throws
Exception
{
runTest
(
"compiler/testData/codegen/boxInline/complex/swapAndWith.kt"
);
...
...
js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenInlineTestGenerated.java
浏览文件 @
147d6052
...
...
@@ -949,6 +949,11 @@ public class IrJsCodegenInlineTestGenerated extends AbstractIrJsCodegenInlineTes
runTest
(
"compiler/testData/codegen/boxInline/complex/closureChain.kt"
);
}
@TestMetadata
(
"kt44429.kt"
)
public
void
testKt44429
()
throws
Exception
{
runTest
(
"compiler/testData/codegen/boxInline/complex/kt44429.kt"
);
}
@TestMetadata
(
"swapAndWith.kt"
)
public
void
testSwapAndWith
()
throws
Exception
{
runTest
(
"compiler/testData/codegen/boxInline/complex/swapAndWith.kt"
);
...
...
js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/semantics/JsCodegenInlineTestGenerated.java
浏览文件 @
147d6052
...
...
@@ -949,6 +949,11 @@ public class JsCodegenInlineTestGenerated extends AbstractJsCodegenInlineTest {
runTest
(
"compiler/testData/codegen/boxInline/complex/closureChain.kt"
);
}
@TestMetadata
(
"kt44429.kt"
)
public
void
testKt44429
()
throws
Exception
{
runTest
(
"compiler/testData/codegen/boxInline/complex/kt44429.kt"
);
}
@TestMetadata
(
"swapAndWith.kt"
)
public
void
testSwapAndWith
()
throws
Exception
{
runTest
(
"compiler/testData/codegen/boxInline/complex/swapAndWith.kt"
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录