Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
硅谷海盗
kotlin
提交
d728417f
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,发现更多精彩内容 >>
提交
d728417f
编写于
10月 12, 2015
作者:
V
Valentin Kipyatkov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fixed KT-9496 FQ-class name inserted in type argument on copy/paste
#KT-9496 Fixed
上级
f4e1f535
变更
11
隐藏空白更改
内联
并排
Showing
11 changed file
with
60 addition
and
11 deletion
+60
-11
compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/CallResolver.java
.../src/org/jetbrains/kotlin/resolve/calls/CallResolver.java
+16
-0
compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/CandidateResolver.kt
...c/org/jetbrains/kotlin/resolve/calls/CandidateResolver.kt
+3
-10
compiler/testData/diagnostics/tests/StarsInFunctionCalls.kt
compiler/testData/diagnostics/tests/StarsInFunctionCalls.kt
+1
-1
compiler/testData/diagnostics/tests/resolve/resolveTypeArgsForUnresolvedCall.kt
...nostics/tests/resolve/resolveTypeArgsForUnresolvedCall.kt
+4
-0
compiler/testData/diagnostics/tests/resolve/resolveTypeArgsForUnresolvedCall.txt
...ostics/tests/resolve/resolveTypeArgsForUnresolvedCall.txt
+3
-0
compiler/tests/org/jetbrains/kotlin/checkers/JetDiagnosticsTestGenerated.java
...etbrains/kotlin/checkers/JetDiagnosticsTestGenerated.java
+6
-0
idea/testData/copyPaste/imports/TypeArgForUnresolvedCall.expected.kt
...ta/copyPaste/imports/TypeArgForUnresolvedCall.expected.kt
+6
-0
idea/testData/copyPaste/imports/TypeArgForUnresolvedCall.expected.names
...copyPaste/imports/TypeArgForUnresolvedCall.expected.names
+1
-0
idea/testData/copyPaste/imports/TypeArgForUnresolvedCall.kt
idea/testData/copyPaste/imports/TypeArgForUnresolvedCall.kt
+5
-0
idea/testData/copyPaste/imports/TypeArgForUnresolvedCall.to.kt
...testData/copyPaste/imports/TypeArgForUnresolvedCall.to.kt
+3
-0
idea/tests/org/jetbrains/kotlin/idea/codeInsight/InsertImportOnPasteTestGenerated.java
...in/idea/codeInsight/InsertImportOnPasteTestGenerated.java
+12
-0
未找到文件。
compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/CallResolver.java
浏览文件 @
d728417f
...
@@ -46,6 +46,7 @@ import org.jetbrains.kotlin.resolve.calls.tasks.*;
...
@@ -46,6 +46,7 @@ import org.jetbrains.kotlin.resolve.calls.tasks.*;
import
org.jetbrains.kotlin.resolve.calls.tasks.collectors.CallableDescriptorCollectors
;
import
org.jetbrains.kotlin.resolve.calls.tasks.collectors.CallableDescriptorCollectors
;
import
org.jetbrains.kotlin.resolve.calls.util.CallMaker
;
import
org.jetbrains.kotlin.resolve.calls.util.CallMaker
;
import
org.jetbrains.kotlin.resolve.descriptorUtil.DescriptorUtilPackage
;
import
org.jetbrains.kotlin.resolve.descriptorUtil.DescriptorUtilPackage
;
import
org.jetbrains.kotlin.resolve.lazy.ForceResolveUtil
;
import
org.jetbrains.kotlin.resolve.scopes.LexicalScope
;
import
org.jetbrains.kotlin.resolve.scopes.LexicalScope
;
import
org.jetbrains.kotlin.resolve.scopes.receivers.ExpressionReceiver
;
import
org.jetbrains.kotlin.resolve.scopes.receivers.ExpressionReceiver
;
import
org.jetbrains.kotlin.resolve.scopes.receivers.ReceiverValue
;
import
org.jetbrains.kotlin.resolve.scopes.receivers.ReceiverValue
;
...
@@ -558,6 +559,21 @@ public class CallResolver {
...
@@ -558,6 +559,21 @@ public class CallResolver {
if
(
context
.
checkArguments
==
CheckArgumentTypesMode
.
CHECK_VALUE_ARGUMENTS
)
{
if
(
context
.
checkArguments
==
CheckArgumentTypesMode
.
CHECK_VALUE_ARGUMENTS
)
{
argumentTypeResolver
.
analyzeArgumentsAndRecordTypes
(
context
);
argumentTypeResolver
.
analyzeArgumentsAndRecordTypes
(
context
);
}
}
List
<
JetTypeProjection
>
typeArguments
=
context
.
call
.
getTypeArguments
();
for
(
JetTypeProjection
projection
:
typeArguments
)
{
if
(
projection
.
getProjectionKind
()
!=
JetProjectionKind
.
NONE
)
{
context
.
trace
.
report
(
PROJECTION_ON_NON_CLASS_TYPE_ARGUMENT
.
on
(
projection
));
ModifierCheckerCore
.
INSTANCE
.
check
(
projection
,
context
.
trace
,
null
);
}
JetType
type
=
argumentTypeResolver
.
resolveTypeRefWithDefault
(
projection
.
getTypeReference
(),
context
.
scope
,
context
.
trace
,
null
);
if
(
type
!=
null
)
{
ForceResolveUtil
.
forceResolveAllContents
(
type
);
}
}
Collection
<
ResolvedCall
<
F
>>
allCandidates
=
Lists
.
newArrayList
();
Collection
<
ResolvedCall
<
F
>>
allCandidates
=
Lists
.
newArrayList
();
OverloadResolutionResultsImpl
<
F
>
successfulResults
=
null
;
OverloadResolutionResultsImpl
<
F
>
successfulResults
=
null
;
TemporaryBindingTrace
traceForFirstNonemptyCandidateSet
=
null
;
TemporaryBindingTrace
traceForFirstNonemptyCandidateSet
=
null
;
...
...
compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/CandidateResolver.kt
浏览文件 @
d728417f
...
@@ -21,7 +21,6 @@ import com.google.common.collect.Sets
...
@@ -21,7 +21,6 @@ import com.google.common.collect.Sets
import
org.jetbrains.kotlin.builtins.KotlinBuiltIns
import
org.jetbrains.kotlin.builtins.KotlinBuiltIns
import
org.jetbrains.kotlin.builtins.ReflectionTypes
import
org.jetbrains.kotlin.builtins.ReflectionTypes
import
org.jetbrains.kotlin.descriptors.*
import
org.jetbrains.kotlin.descriptors.*
import
org.jetbrains.kotlin.diagnostics.Errors.PROJECTION_ON_NON_CLASS_TYPE_ARGUMENT
import
org.jetbrains.kotlin.diagnostics.Errors.SUPER_CANT_BE_EXTENSION_RECEIVER
import
org.jetbrains.kotlin.diagnostics.Errors.SUPER_CANT_BE_EXTENSION_RECEIVER
import
org.jetbrains.kotlin.progress.ProgressIndicatorAndCompilationCanceledStatus
import
org.jetbrains.kotlin.progress.ProgressIndicatorAndCompilationCanceledStatus
import
org.jetbrains.kotlin.psi.*
import
org.jetbrains.kotlin.psi.*
...
@@ -46,7 +45,6 @@ import org.jetbrains.kotlin.resolve.calls.smartcasts.SmartCastManager
...
@@ -46,7 +45,6 @@ import org.jetbrains.kotlin.resolve.calls.smartcasts.SmartCastManager
import
org.jetbrains.kotlin.resolve.calls.tasks.ResolutionTask
import
org.jetbrains.kotlin.resolve.calls.tasks.ResolutionTask
import
org.jetbrains.kotlin.resolve.calls.tasks.isSynthesizedInvoke
import
org.jetbrains.kotlin.resolve.calls.tasks.isSynthesizedInvoke
import
org.jetbrains.kotlin.resolve.calls.util.FakeCallableDescriptorForObject
import
org.jetbrains.kotlin.resolve.calls.util.FakeCallableDescriptorForObject
import
org.jetbrains.kotlin.resolve.lazy.ForceResolveUtil
import
org.jetbrains.kotlin.resolve.scopes.receivers.ExpressionReceiver
import
org.jetbrains.kotlin.resolve.scopes.receivers.ExpressionReceiver
import
org.jetbrains.kotlin.resolve.scopes.receivers.ReceiverValue
import
org.jetbrains.kotlin.resolve.scopes.receivers.ReceiverValue
import
org.jetbrains.kotlin.types.*
import
org.jetbrains.kotlin.types.*
...
@@ -118,16 +116,11 @@ public class CandidateResolver(
...
@@ -118,16 +116,11 @@ public class CandidateResolver(
val
typeArguments
=
ArrayList
<
JetType
>()
val
typeArguments
=
ArrayList
<
JetType
>()
for
(
projection
in
jetTypeArguments
)
{
for
(
projection
in
jetTypeArguments
)
{
if
(
projection
.
getProjectionKind
()
!=
JetProjectionKind
.
NONE
)
{
val
type
=
projection
.
typeReference
?.
let
{
trace
.
bindingContext
.
get
(
BindingContext
.
TYPE
,
it
)
}
trace
.
report
(
PROJECTION_ON_NON_CLASS_TYPE_ARGUMENT
.
on
(
projection
))
?:
ErrorUtils
.
createErrorType
(
"Star projection in a call"
)
ModifierCheckerCore
.
check
(
projection
,
trace
,
null
)
}
val
type
=
argumentTypeResolver
.
resolveTypeRefWithDefault
(
projection
.
getTypeReference
(),
scope
,
trace
,
ErrorUtils
.
createErrorType
(
"Star projection in a call"
))
!!
ForceResolveUtil
.
forceResolveAllContents
(
type
)
typeArguments
.
add
(
type
)
typeArguments
.
add
(
type
)
}
}
val
expectedTypeArgumentCount
=
candidateDescriptor
.
getTypeParameters
().
size
()
val
expectedTypeArgumentCount
=
candidateDescriptor
.
getTypeParameters
().
size
()
for
(
index
in
jetTypeArguments
.
size
()
..
expectedTypeArgumentCount
-
1
)
{
for
(
index
in
jetTypeArguments
.
size
()
..
expectedTypeArgumentCount
-
1
)
{
typeArguments
.
add
(
ErrorUtils
.
createErrorType
(
typeArguments
.
add
(
ErrorUtils
.
createErrorType
(
...
...
compiler/testData/diagnostics/tests/StarsInFunctionCalls.kt
浏览文件 @
d728417f
...
@@ -5,7 +5,7 @@ fun foo(<!UNUSED_PARAMETER!>a<!> : Any?) {}
...
@@ -5,7 +5,7 @@ fun foo(<!UNUSED_PARAMETER!>a<!> : Any?) {}
public
fun
main
()
{
public
fun
main
()
{
getT
<<!
PROJECTION_ON_NON_CLASS_TYPE_ARGUMENT
!>*<!>>()
getT
<<!
PROJECTION_ON_NON_CLASS_TYPE_ARGUMENT
!>*<!>>()
<!
UNRESOLVED_REFERENCE
!>
ggetT
<!><<!
PROJECTION_ON_NON_CLASS_TYPE_ARGUMENT
!>*<!>>()
<!
UNRESOLVED_REFERENCE
!>
ggetT
<!><<!
PROJECTION_ON_NON_CLASS_TYPE_ARGUMENT
,
PROJECTION_ON_NON_CLASS_TYPE_ARGUMENT
!>*<!>>()
getTT
<<!
PROJECTION_ON_NON_CLASS_TYPE_ARGUMENT
!>*<!>,
<!
PROJECTION_ON_NON_CLASS_TYPE_ARGUMENT
!>*<!>>()
getTT
<<!
PROJECTION_ON_NON_CLASS_TYPE_ARGUMENT
!>*<!>,
<!
PROJECTION_ON_NON_CLASS_TYPE_ARGUMENT
!>*<!>>()
getTT
<<!
PROJECTION_ON_NON_CLASS_TYPE_ARGUMENT
!>*<!>,
Int
>()
getTT
<<!
PROJECTION_ON_NON_CLASS_TYPE_ARGUMENT
!>*<!>,
Int
>()
getTT
<
Int
,
<!
PROJECTION_ON_NON_CLASS_TYPE_ARGUMENT
!>*<!>>()
getTT
<
Int
,
<!
PROJECTION_ON_NON_CLASS_TYPE_ARGUMENT
!>*<!>>()
...
...
compiler/testData/diagnostics/tests/resolve/resolveTypeArgsForUnresolvedCall.kt
0 → 100644
浏览文件 @
d728417f
fun
foo
()
{
<!
UNRESOLVED_REFERENCE
!>
x
<!>.<!
DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE
!>
yyy
<!><<!
UNRESOLVED_REFERENCE
!>
XXX
<
!
>>()
<!
UNRESOLVED_REFERENCE
!>
x
<!>.<!
DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE
!>
yyy
<!><
Int
>()
}
\ No newline at end of file
compiler/testData/diagnostics/tests/resolve/resolveTypeArgsForUnresolvedCall.txt
0 → 100644
浏览文件 @
d728417f
package
public fun foo(): kotlin.Unit
compiler/tests/org/jetbrains/kotlin/checkers/JetDiagnosticsTestGenerated.java
浏览文件 @
d728417f
...
@@ -12603,6 +12603,12 @@ public class JetDiagnosticsTestGenerated extends AbstractJetDiagnosticsTest {
...
@@ -12603,6 +12603,12 @@ public class JetDiagnosticsTestGenerated extends AbstractJetDiagnosticsTest {
doTest(fileName);
doTest(fileName);
}
}
@TestMetadata("resolveTypeArgsForUnresolvedCall.kt")
public void testResolveTypeArgsForUnresolvedCall() throws Exception {
String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/resolve/resolveTypeArgsForUnresolvedCall.kt");
doTest(fileName);
}
@TestMetadata("resolveWithFunctionLiteralWithId.kt")
@TestMetadata("resolveWithFunctionLiteralWithId.kt")
public void testResolveWithFunctionLiteralWithId() throws Exception {
public void testResolveWithFunctionLiteralWithId() throws Exception {
String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/resolve/resolveWithFunctionLiteralWithId.kt");
String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/resolve/resolveWithFunctionLiteralWithId.kt");
...
...
idea/testData/copyPaste/imports/TypeArgForUnresolvedCall.expected.kt
0 → 100644
浏览文件 @
d728417f
// ERROR: Unresolved reference: list
import
java.io.File
fun
file
()
{
list
.
filterIsInstance
<
File
>()
}
\ No newline at end of file
idea/testData/copyPaste/imports/TypeArgForUnresolvedCall.expected.names
0 → 100644
浏览文件 @
d728417f
java.io.File
idea/testData/copyPaste/imports/TypeArgForUnresolvedCall.kt
0 → 100644
浏览文件 @
d728417f
import
java.io.File
fun
file
(
list
:
List
<
Any
>)
{
<
selection
>
list
.
filterIsInstance
<
File
>()</
selection
>
}
\ No newline at end of file
idea/testData/copyPaste/imports/TypeArgForUnresolvedCall.to.kt
0 → 100644
浏览文件 @
d728417f
fun
file
()
{
<
caret
>
}
\ No newline at end of file
idea/tests/org/jetbrains/kotlin/idea/codeInsight/InsertImportOnPasteTestGenerated.java
浏览文件 @
d728417f
...
@@ -361,6 +361,12 @@ public class InsertImportOnPasteTestGenerated extends AbstractInsertImportOnPast
...
@@ -361,6 +361,12 @@ public class InsertImportOnPasteTestGenerated extends AbstractInsertImportOnPast
doTestCopy
(
fileName
);
doTestCopy
(
fileName
);
}
}
@TestMetadata
(
"TypeArgForUnresolvedCall.kt"
)
public
void
testTypeArgForUnresolvedCall
()
throws
Exception
{
String
fileName
=
JetTestUtils
.
navigationMetadata
(
"idea/testData/copyPaste/imports/TypeArgForUnresolvedCall.kt"
);
doTestCopy
(
fileName
);
}
@TestMetadata
(
"TypeParameter.kt"
)
@TestMetadata
(
"TypeParameter.kt"
)
public
void
testTypeParameter
()
throws
Exception
{
public
void
testTypeParameter
()
throws
Exception
{
String
fileName
=
JetTestUtils
.
navigationMetadata
(
"idea/testData/copyPaste/imports/TypeParameter.kt"
);
String
fileName
=
JetTestUtils
.
navigationMetadata
(
"idea/testData/copyPaste/imports/TypeParameter.kt"
);
...
@@ -700,6 +706,12 @@ public class InsertImportOnPasteTestGenerated extends AbstractInsertImportOnPast
...
@@ -700,6 +706,12 @@ public class InsertImportOnPasteTestGenerated extends AbstractInsertImportOnPast
doTestCut
(
fileName
);
doTestCut
(
fileName
);
}
}
@TestMetadata
(
"TypeArgForUnresolvedCall.kt"
)
public
void
testTypeArgForUnresolvedCall
()
throws
Exception
{
String
fileName
=
JetTestUtils
.
navigationMetadata
(
"idea/testData/copyPaste/imports/TypeArgForUnresolvedCall.kt"
);
doTestCut
(
fileName
);
}
@TestMetadata
(
"TypeParameter.kt"
)
@TestMetadata
(
"TypeParameter.kt"
)
public
void
testTypeParameter
()
throws
Exception
{
public
void
testTypeParameter
()
throws
Exception
{
String
fileName
=
JetTestUtils
.
navigationMetadata
(
"idea/testData/copyPaste/imports/TypeParameter.kt"
);
String
fileName
=
JetTestUtils
.
navigationMetadata
(
"idea/testData/copyPaste/imports/TypeParameter.kt"
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录