Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
硅谷海盗
kotlin
提交
0e606a32
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,发现更多精彩内容 >>
提交
0e606a32
编写于
10月 07, 2015
作者:
A
Alexey Tsvetkov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Prohibit named parameters in function types in supertype position
上级
90849a67
变更
9
隐藏空白更改
内联
并排
Showing
9 changed file
with
57 addition
and
8 deletion
+57
-8
compiler/frontend/src/org/jetbrains/kotlin/resolve/BodyResolver.java
...ontend/src/org/jetbrains/kotlin/resolve/BodyResolver.java
+11
-0
compiler/testData/diagnostics/tests/DefaultValueForParameterInFunctionType.kt
...agnostics/tests/DefaultValueForParameterInFunctionType.kt
+1
-1
compiler/testData/diagnostics/tests/NamedFunctionTypeParameterInSupertype.kt
...iagnostics/tests/NamedFunctionTypeParameterInSupertype.kt
+9
-0
compiler/testData/diagnostics/tests/NamedFunctionTypeParameterInSupertype.txt
...agnostics/tests/NamedFunctionTypeParameterInSupertype.txt
+25
-0
compiler/testData/diagnostics/tests/incompleteCode/diagnosticWithSyntaxError/funcitonTypes.kt
...incompleteCode/diagnosticWithSyntaxError/funcitonTypes.kt
+1
-1
compiler/testData/diagnostics/tests/incompleteCode/diagnosticWithSyntaxError/typeReferenceError.kt
...pleteCode/diagnosticWithSyntaxError/typeReferenceError.kt
+1
-1
compiler/testData/diagnostics/tests/modifiers/modifierOnParameterInFunctionType.kt
...tics/tests/modifiers/modifierOnParameterInFunctionType.kt
+1
-1
compiler/tests/org/jetbrains/kotlin/checkers/JetDiagnosticsTestGenerated.java
...etbrains/kotlin/checkers/JetDiagnosticsTestGenerated.java
+6
-0
idea/src/org/jetbrains/kotlin/idea/refactoring/move/moveTopLevelDeclarations/MoveKotlinTopLevelDeclarationsProcessor.kt
...elDeclarations/MoveKotlinTopLevelDeclarationsProcessor.kt
+2
-4
未找到文件。
compiler/frontend/src/org/jetbrains/kotlin/resolve/BodyResolver.java
浏览文件 @
0e606a32
...
...
@@ -427,6 +427,17 @@ public class BodyResolver {
JetTypeReference
typeReference
=
entry
.
getKey
();
JetType
supertype
=
entry
.
getValue
();
JetTypeElement
typeElement
=
typeReference
.
getTypeElement
();
if
(
typeElement
instanceof
JetFunctionType
)
{
for
(
JetParameter
parameter
:
((
JetFunctionType
)
typeElement
).
getParameters
())
{
PsiElement
nameIdentifier
=
parameter
.
getNameIdentifier
();
if
(
nameIdentifier
!=
null
)
{
trace
.
report
(
Errors
.
UNSUPPORTED
.
on
(
nameIdentifier
,
"named parameter in function type in supertype position"
));
}
}
}
boolean
addSupertype
=
true
;
ClassDescriptor
classDescriptor
=
TypeUtils
.
getClassDescriptor
(
supertype
);
...
...
compiler/testData/diagnostics/tests/DefaultValueForParameterInFunctionType.kt
浏览文件 @
0e606a32
...
...
@@ -10,7 +10,7 @@ fun inParamNested(fn1: (fn2: (n: Int = <!UNSUPPORTED!>0<!>)->Unit)->Unit) {}
fun
inReturn
():
(
x
:
Int
=
<!
UNSUPPORTED
!>
0
<!>)->
Unit
=
{}
class
A
:
(
x
:
Int
=
<!
UNSUPPORTED
!>
0
<!>
)->
Unit
{
class
A
:
(
Int
)->
Unit
{
override
fun
invoke
(
p1
:
Int
)
{
var
lambda
:
(
x
:
Int
=
<!
UNSUPPORTED
!>
0
<!>)->
Unit
=
{}
}
...
...
compiler/testData/diagnostics/tests/NamedFunctionTypeParameterInSupertype.kt
0 → 100644
浏览文件 @
0e606a32
abstract
class
A
:
Function1
<
Any
,
Unit
>
abstract
class
B
:
(
Int
)->
Unit
// Named parameter is prohibited because of possible inconsistency between
// type declaration and actual override
class
C
:
(<!
UNSUPPORTED
!>
x
<!>:
Int
)->
Unit
{
override
fun
invoke
(
p1
:
Int
):
Unit
{}
}
\ No newline at end of file
compiler/testData/diagnostics/tests/NamedFunctionTypeParameterInSupertype.txt
0 → 100644
浏览文件 @
0e606a32
package
public abstract class A : (kotlin.Any) -> kotlin.Unit {
public constructor A()
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 abstract override /*1*/ /*fake_override*/ fun invoke(/*0*/ p1: kotlin.Any): kotlin.Unit
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
public abstract class B : (kotlin.Int) -> kotlin.Unit {
public constructor B()
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 abstract override /*1*/ /*fake_override*/ fun invoke(/*0*/ p1: kotlin.Int): kotlin.Unit
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
public final class C : (kotlin.Int) -> kotlin.Unit {
public constructor C()
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*/ fun invoke(/*0*/ p1: kotlin.Int): kotlin.Unit
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
compiler/testData/diagnostics/tests/incompleteCode/diagnosticWithSyntaxError/funcitonTypes.kt
浏览文件 @
0e606a32
class
A
:
(
categoryName
:
<!
SYNTAX
!><!>)<!
SYNTAX
!><!>
<!
SYNTAX
!><!>{<!
SYNTAX
!><!>
\ No newline at end of file
class
A
:
(<!
UNSUPPORTED
!>
categoryName
<!>:
<!
SYNTAX
!><!>)<!
SYNTAX
!><!>
<!
SYNTAX
!><!>{<!
SYNTAX
!><!>
\ No newline at end of file
compiler/testData/diagnostics/tests/incompleteCode/diagnosticWithSyntaxError/typeReferenceError.kt
浏览文件 @
0e606a32
package
typeReferenceError
<!
ABSTRACT_MEMBER_NOT_IMPLEMENTED
!>
class
Pair
<!><<!
SYNTAX
!><!>:(<!
UNSUPPORTED
!>
val
<!>
c
:
<!
SYNTAX
!><!
SYNTAX
!><!>
fun
<!><!
SYNTAX
!><!>
<!
UNRESOLVED_REFERENCE
!>
main
<!>()
\ No newline at end of file
<!
ABSTRACT_MEMBER_NOT_IMPLEMENTED
!>
class
Pair
<!><<!
SYNTAX
!><!>:(<!
UNSUPPORTED
!>
val
<!>
<!
UNSUPPORTED
!>
c
<!>:
<!
SYNTAX
!><!
SYNTAX
!><!>
fun
<!><!
SYNTAX
!><!>
<!
UNRESOLVED_REFERENCE
!>
main
<!>()
\ No newline at end of file
compiler/testData/diagnostics/tests/modifiers/modifierOnParameterInFunctionType.kt
浏览文件 @
0e606a32
...
...
@@ -10,7 +10,7 @@ fun inParamNested(fn1: (fn2: (<!UNSUPPORTED!>vararg<!> n: Int)->Unit)->Unit) {}
fun
inReturn
():
(<!
UNSUPPORTED
!>
vararg
<!>
x
:
Int
)->
Unit
=
{}
class
A
:
(<!
UNSUPPORTED
!>
vararg
<!>
x
:
Int
)->
Unit
{
class
A
:
(<!
UNSUPPORTED
!>
vararg
<!>
Int
)->
Unit
{
override
fun
invoke
(
p1
:
Int
)
{
var
lambda
:
(<!
UNSUPPORTED
!>
vararg
<!>
x
:
Int
)->
Unit
=
{}
}
...
...
compiler/tests/org/jetbrains/kotlin/checkers/JetDiagnosticsTestGenerated.java
浏览文件 @
0e606a32
...
...
@@ -379,6 +379,12 @@ public class JetDiagnosticsTestGenerated extends AbstractJetDiagnosticsTest {
doTest(fileName);
}
@TestMetadata("NamedFunctionTypeParameterInSupertype.kt")
public void testNamedFunctionTypeParameterInSupertype() throws Exception {
String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/NamedFunctionTypeParameterInSupertype.kt");
doTest(fileName);
}
@TestMetadata("Nullability.kt")
public void testNullability() throws Exception {
String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/Nullability.kt");
...
...
idea/src/org/jetbrains/kotlin/idea/refactoring/move/moveTopLevelDeclarations/MoveKotlinTopLevelDeclarationsProcessor.kt
浏览文件 @
0e606a32
...
...
@@ -61,11 +61,9 @@ import org.jetbrains.kotlin.psi.psiUtil.isInsideOf
import
org.jetbrains.kotlin.psi.psiUtil.isPrivate
import
org.jetbrains.kotlin.resolve.BindingContext
import
org.jetbrains.kotlin.utils.keysToMap
import
java.util.ArrayList
import
java.util.HashMap
import
java.util.HashSet
import
java.util.*
interface
Mover
:
(
originalElement
:
JetNamedDeclaration
,
targetFile
:
JetFile
)
->
JetNamedDeclaration
{
interface
Mover
:
(
JetNamedDeclaration
,
JetFile
)
->
JetNamedDeclaration
{
object
Default
:
Mover
{
override
fun
invoke
(
originalElement
:
JetNamedDeclaration
,
targetFile
:
JetFile
):
JetNamedDeclaration
{
val
newElement
=
targetFile
.
add
(
originalElement
)
as
JetNamedDeclaration
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录