Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
硅谷海盗
kotlin
提交
c1dbe9ee
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,发现更多精彩内容 >>
提交
c1dbe9ee
编写于
9月 06, 2011
作者:
A
Andrey Breslav
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Specificity by receiver fixed. Test updated
上级
c02c5071
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
24 addition
and
6 deletion
+24
-6
idea/src/org/jetbrains/jet/lang/resolve/calls/OverloadingConflictResolver.java
...s/jet/lang/resolve/calls/OverloadingConflictResolver.java
+12
-3
idea/testData/checker/ExtensionFunctions.jet
idea/testData/checker/ExtensionFunctions.jet
+3
-3
idea/testData/checker/regression/SpecififcityByReceiver.jet
idea/testData/checker/regression/SpecififcityByReceiver.jet
+9
-0
未找到文件。
idea/src/org/jetbrains/jet/lang/resolve/calls/OverloadingConflictResolver.java
浏览文件 @
c1dbe9ee
...
...
@@ -59,6 +59,12 @@ import java.util.Set;
if
(
overrides
(
f
,
g
))
return
true
;
if
(
overrides
(
g
,
f
))
return
false
;
JetType
receiverTypeOfF
=
f
.
getReceiverType
();
JetType
receiverTypeOfG
=
g
.
getReceiverType
();
if
(
receiverTypeOfF
!=
null
&&
receiverTypeOfG
!=
null
)
{
if
(!
typeMoreSpecific
(
receiverTypeOfF
,
receiverTypeOfG
))
return
false
;
}
List
<
ValueParameterDescriptor
>
fParams
=
f
.
getValueParameters
();
List
<
ValueParameterDescriptor
>
gParams
=
g
.
getValueParameters
();
...
...
@@ -68,9 +74,7 @@ import java.util.Set;
JetType
fParamType
=
fParams
.
get
(
i
).
getOutType
();
JetType
gParamType
=
gParams
.
get
(
i
).
getOutType
();
if
(!
semanticServices
.
getTypeChecker
().
isSubtypeOf
(
fParamType
,
gParamType
)
&&
!
numericTypeMoreSpecific
(
fParamType
,
gParamType
)
)
{
if
(!
typeMoreSpecific
(
fParamType
,
gParamType
))
{
return
false
;
}
}
...
...
@@ -92,6 +96,11 @@ import java.util.Set;
return
!
f
.
getOriginal
().
getTypeParameters
().
isEmpty
();
}
private
boolean
typeMoreSpecific
(
@NotNull
JetType
specific
,
@NotNull
JetType
general
)
{
return
semanticServices
.
getTypeChecker
().
isSubtypeOf
(
specific
,
general
)
||
numericTypeMoreSpecific
(
specific
,
general
);
}
private
boolean
numericTypeMoreSpecific
(
@NotNull
JetType
specific
,
@NotNull
JetType
general
)
{
JetStandardLibrary
standardLibrary
=
semanticServices
.
getStandardLibrary
();
JetType
_double
=
standardLibrary
.
getDoubleType
();
...
...
idea/testData/checker/ExtensionFunctions.jet
浏览文件 @
c1dbe9ee
...
...
@@ -16,7 +16,7 @@ class A
fun A.plus(a : Any) {
1.foo()
true.
foo<error>
()</error>
true.
<error>foo
()</error>
1
}
...
...
@@ -57,8 +57,8 @@ namespace null_safety {
command<error>.</error>foo
command
<error>.</error>
equals(null)
command
?.
equals(null)
command
.
equals(null)
command
<warning>?.</warning>
equals(null)
command.equals1(null)
command<warning>?.</warning>equals1(null)
...
...
idea/testData/checker/regression/SpecififcityByReceiver.jet
0 → 100644
浏览文件 @
c1dbe9ee
fun Any.equals(other : Any?) : Boolean
fun main(args: Array<String>) {
val command : Any = 1
command<warning>?.<?warning>equals(null)
command.equals(null)
}
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录