Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
硅谷海盗
kotlin
提交
44948aa9
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,发现更多精彩内容 >>
提交
44948aa9
编写于
12月 16, 2020
作者:
D
Dmitriy Novozhilov
提交者:
TeamCityServer
12月 16, 2020
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[FE] Properly report diagnostics about type arguments of implicit invoke
#KT-40396 Fixed
上级
329066a4
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
64 addition
and
10 deletion
+64
-10
compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/fir/FirOldFrontendDiagnosticsTestGenerated.java
...ns/kotlin/fir/FirOldFrontendDiagnosticsTestGenerated.java
+5
-0
compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/DiagnosticReporterByTrackingStrategy.kt
...lin/resolve/calls/DiagnosticReporterByTrackingStrategy.kt
+1
-1
compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/checkers/OperatorCallChecker.kt
...ains/kotlin/resolve/calls/checkers/OperatorCallChecker.kt
+2
-9
compiler/testData/diagnostics/tests/inference/kt40396.fir.kt
compiler/testData/diagnostics/tests/inference/kt40396.fir.kt
+13
-0
compiler/testData/diagnostics/tests/inference/kt40396.kt
compiler/testData/diagnostics/tests/inference/kt40396.kt
+13
-0
compiler/testData/diagnostics/tests/inference/kt40396.txt
compiler/testData/diagnostics/tests/inference/kt40396.txt
+20
-0
compiler/tests-gen/org/jetbrains/kotlin/checkers/DiagnosticsTestGenerated.java
...g/jetbrains/kotlin/checkers/DiagnosticsTestGenerated.java
+5
-0
compiler/tests-gen/org/jetbrains/kotlin/checkers/javac/DiagnosticsUsingJavacTestGenerated.java
...in/checkers/javac/DiagnosticsUsingJavacTestGenerated.java
+5
-0
未找到文件。
compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/fir/FirOldFrontendDiagnosticsTestGenerated.java
浏览文件 @
44948aa9
...
...
@@ -10447,6 +10447,11 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirOldFronte
runTest("compiler/testData/diagnostics/tests/inference/kt39220.kt");
}
@TestMetadata("kt40396.kt")
public void testKt40396() throws Exception {
runTest("compiler/testData/diagnostics/tests/inference/kt40396.kt");
}
@TestMetadata("kt6175.kt")
public void testKt6175() throws Exception {
runTest("compiler/testData/diagnostics/tests/inference/kt6175.kt");
compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/DiagnosticReporterByTrackingStrategy.kt
浏览文件 @
44948aa9
...
...
@@ -436,8 +436,8 @@ class DiagnosticReporterByTrackingStrategy(
if
(
isSpecialFunction
(
error
.
resolvedAtom
))
return
val
expression
=
when
(
val
atom
=
error
.
resolvedAtom
.
atom
)
{
is
PSIKotlinCallForInvoke
->
(
atom
.
psiCall
as
?
CallTransformer
.
CallForImplicitInvoke
)
?.
outerCall
?.
calleeExpression
is
PSIKotlinCall
->
atom
.
psiCall
.
calleeExpression
is
PSIKotlinCallArgument
->
atom
.
valueArgument
.
getArgumentExpression
()
else
->
call
.
calleeExpression
...
...
compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/checkers/OperatorCallChecker.kt
浏览文件 @
44948aa9
...
...
@@ -24,10 +24,7 @@ import org.jetbrains.kotlin.config.LanguageVersionSettings
import
org.jetbrains.kotlin.descriptors.FunctionDescriptor
import
org.jetbrains.kotlin.diagnostics.DiagnosticSink
import
org.jetbrains.kotlin.diagnostics.Errors
import
org.jetbrains.kotlin.psi.Call
import
org.jetbrains.kotlin.psi.KtArrayAccessExpression
import
org.jetbrains.kotlin.psi.KtDestructuringDeclarationEntry
import
org.jetbrains.kotlin.psi.KtOperationReferenceExpression
import
org.jetbrains.kotlin.psi.*
import
org.jetbrains.kotlin.resolve.calls.CallTransformer
import
org.jetbrains.kotlin.resolve.calls.callResolverUtil.isConventionCall
import
org.jetbrains.kotlin.resolve.calls.model.ResolvedCall
...
...
@@ -52,11 +49,7 @@ class OperatorCallChecker : CallChecker {
val
containingDeclarationName
=
functionDescriptor
.
containingDeclaration
.
fqNameUnsafe
.
asString
()
context
.
trace
.
report
(
Errors
.
PROPERTY_AS_OPERATOR
.
on
(
reportOn
,
functionDescriptor
,
containingDeclarationName
))
}
else
if
(
isWrongCallWithExplicitTypeArguments
(
resolvedCall
,
outerCall
))
{
throw
AssertionError
(
"Illegal resolved call to variable with invoke for $outerCall. "
+
"Variable: ${resolvedCall.variableCall.resultingDescriptor}"
+
"Invoke: ${resolvedCall.functionCall.resultingDescriptor}"
)
context
.
trace
.
report
(
Errors
.
TYPE_ARGUMENTS_NOT_ALLOWED
.
on
(
reportOn
as
KtElement
,
"on implicit invoke call"
))
}
}
...
...
compiler/testData/diagnostics/tests/inference/kt40396.fir.kt
0 → 100644
浏览文件 @
44948aa9
// !DIAGNOSTICS: -UNUSED_PARAMETER
// ISSUE: KT-40396
val
<
C
>
C
.
foo
get
()
=
Foo
<
C
>()
class
Foo
<
K
>
{
operator
fun
<
T
>
invoke
(
body
:
()
->
Unit
)
{}
}
class
Bar
{
val
bar
=
foo
{}
val
baz
=
foo
<
Int
>
{}
}
\ No newline at end of file
compiler/testData/diagnostics/tests/inference/kt40396.kt
0 → 100644
浏览文件 @
44948aa9
// !DIAGNOSTICS: -UNUSED_PARAMETER
// ISSUE: KT-40396
val
<
C
>
C
.
foo
get
()
=
Foo
<
C
>()
class
Foo
<
K
>
{
operator
fun
<
T
>
invoke
(
body
:
()
->
Unit
)
{}
}
class
Bar
{
val
bar
=
<!
NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER
!>
foo
<!>
{}
val
baz
=
<!
TYPE_ARGUMENTS_NOT_ALLOWED
!>
foo
<!><
Int
>
{}
}
\ No newline at end of file
compiler/testData/diagnostics/tests/inference/kt40396.txt
0 → 100644
浏览文件 @
44948aa9
package
public val </*0*/ C> C.foo: Foo<C>
public final class Bar {
public constructor Bar()
public final val bar: kotlin.Unit
public final val baz: kotlin.Unit
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
public final class Foo</*0*/ K> {
public constructor Foo</*0*/ K>()
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public final operator fun </*0*/ T> invoke(/*0*/ body: () -> kotlin.Unit): kotlin.Unit
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
compiler/tests-gen/org/jetbrains/kotlin/checkers/DiagnosticsTestGenerated.java
浏览文件 @
44948aa9
...
...
@@ -10454,6 +10454,11 @@ public class DiagnosticsTestGenerated extends AbstractDiagnosticsTestWithFirVali
runTest("compiler/testData/diagnostics/tests/inference/kt39220.kt");
}
@TestMetadata("kt40396.kt")
public void testKt40396() throws Exception {
runTest("compiler/testData/diagnostics/tests/inference/kt40396.kt");
}
@TestMetadata("kt6175.kt")
public void testKt6175() throws Exception {
runTest("compiler/testData/diagnostics/tests/inference/kt6175.kt");
compiler/tests-gen/org/jetbrains/kotlin/checkers/javac/DiagnosticsUsingJavacTestGenerated.java
浏览文件 @
44948aa9
...
...
@@ -10449,6 +10449,11 @@ public class DiagnosticsUsingJavacTestGenerated extends AbstractDiagnosticsUsing
runTest("compiler/testData/diagnostics/tests/inference/kt39220.kt");
}
@TestMetadata("kt40396.kt")
public void testKt40396() throws Exception {
runTest("compiler/testData/diagnostics/tests/inference/kt40396.kt");
}
@TestMetadata("kt6175.kt")
public void testKt6175() throws Exception {
runTest("compiler/testData/diagnostics/tests/inference/kt6175.kt");
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录