Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
硅谷海盗
kotlin
提交
9450e1bd
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,发现更多精彩内容 >>
提交
9450e1bd
编写于
6月 05, 2011
作者:
A
Andrey Breslav
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
JET-84 Support generic parameter constraints for class objects
Test for classes + small fixes
上级
4204db9c
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
69 addition
and
6 deletion
+69
-6
idea/src/org/jetbrains/jet/lang/resolve/ClassDescriptorResolver.java
...g/jetbrains/jet/lang/resolve/ClassDescriptorResolver.java
+2
-1
idea/src/org/jetbrains/jet/lang/resolve/TopDownAnalyzer.java
idea/src/org/jetbrains/jet/lang/resolve/TopDownAnalyzer.java
+18
-3
idea/src/org/jetbrains/jet/lang/types/ErrorUtils.java
idea/src/org/jetbrains/jet/lang/types/ErrorUtils.java
+1
-1
idea/src/org/jetbrains/jet/lang/types/TypeUtils.java
idea/src/org/jetbrains/jet/lang/types/TypeUtils.java
+1
-1
idea/testData/checker/MultipleBounds.jet
idea/testData/checker/MultipleBounds.jet
+47
-0
未找到文件。
idea/src/org/jetbrains/jet/lang/resolve/ClassDescriptorResolver.java
浏览文件 @
9450e1bd
...
...
@@ -183,6 +183,7 @@ public class ClassDescriptorResolver {
}
}
}
for
(
TypeParameterDescriptor
parameter
:
parameters
)
{
if
(
JetStandardClasses
.
isNothing
(
parameter
.
getBoundsAsType
()))
{
PsiElement
nameIdentifier
=
typeParameters
.
get
(
parameter
.
getIndex
()).
getNameIdentifier
();
...
...
@@ -652,7 +653,7 @@ public class ClassDescriptorResolver {
return
propertyDescriptor
;
}
public
void
checkBounds
(
JetTypeReference
typeReference
,
JetType
type
)
{
public
void
checkBounds
(
@NotNull
JetTypeReference
typeReference
,
@NotNull
JetType
type
)
{
if
(
ErrorUtils
.
isErrorType
(
type
))
return
;
JetTypeElement
typeElement
=
typeReference
.
getTypeElement
();
...
...
idea/src/org/jetbrains/jet/lang/resolve/TopDownAnalyzer.java
浏览文件 @
9450e1bd
...
...
@@ -325,15 +325,30 @@ public class TopDownAnalyzer {
JetClass
jetClass
=
entry
.
getKey
();
for
(
JetDelegationSpecifier
delegationSpecifier
:
jetClass
.
getDelegationSpecifiers
())
{
JetType
type
=
trace
.
getBindingContext
().
resolveTypeReference
(
delegationSpecifier
.
getTypeReference
());
classDescriptorResolver
.
checkBounds
(
delegationSpecifier
.
getTypeReference
(),
type
);
JetTypeReference
typeReference
=
delegationSpecifier
.
getTypeReference
();
if
(
typeReference
!=
null
)
{
JetType
type
=
trace
.
getBindingContext
().
resolveTypeReference
(
typeReference
);
classDescriptorResolver
.
checkBounds
(
typeReference
,
type
);
}
}
for
(
JetTypeParameter
jetTypeParameter
:
jetClass
.
getTypeParameters
())
{
JetTypeReference
extendsBound
=
jetTypeParameter
.
getExtendsBound
();
if
(
extendsBound
!=
null
)
{
JetType
type
=
trace
.
getBindingContext
().
resolveTypeReference
(
extendsBound
);
classDescriptorResolver
.
checkBounds
(
extendsBound
,
type
);
if
(
type
!=
null
)
{
classDescriptorResolver
.
checkBounds
(
extendsBound
,
type
);
}
}
}
for
(
JetTypeConstraint
constraint
:
jetClass
.
getTypeConstaints
())
{
JetTypeReference
extendsBound
=
constraint
.
getBoundTypeReference
();
if
(
extendsBound
!=
null
)
{
JetType
type
=
trace
.
getBindingContext
().
resolveTypeReference
(
extendsBound
);
if
(
type
!=
null
)
{
classDescriptorResolver
.
checkBounds
(
extendsBound
,
type
);
}
}
}
...
...
idea/src/org/jetbrains/jet/lang/types/ErrorUtils.java
浏览文件 @
9450e1bd
...
...
@@ -169,7 +169,7 @@ public class ErrorUtils {
return
typeConstructor
==
ERROR_CLASS
.
getTypeConstructor
();
}
public
static
boolean
isErrorType
(
JetType
type
)
{
public
static
boolean
isErrorType
(
@NotNull
JetType
type
)
{
return
(
type
instanceof
DeferredType
&&
((
DeferredType
)
type
).
getActualType
()
==
null
)
||
type
instanceof
ErrorTypeImpl
||
isError
(
type
.
getConstructor
());
...
...
idea/src/org/jetbrains/jet/lang/types/TypeUtils.java
浏览文件 @
9450e1bd
...
...
@@ -94,7 +94,7 @@ public class TypeUtils {
new
ChainedScope
(
null
,
scopes
));
// TODO : check intersectibility, don't use a chanied scope
}
p
rivate
static
boolean
canHaveSubtypes
(
JetTypeChecker
typeChecker
,
JetType
type
)
{
p
ublic
static
boolean
canHaveSubtypes
(
JetTypeChecker
typeChecker
,
JetType
type
)
{
if
(
type
.
isNullable
())
{
return
true
;
}
...
...
idea/testData/checker/MultipleBounds.jet
0 → 100644
浏览文件 @
9450e1bd
namespace Jet87
open class A() {
fun foo() : Int
}
open class B() {
fun bar() : Double;
}
class C() : A(), B()
class D() {
class object : A(), B () {}
}
class Test1<T : A>
where
T : B,
<error>B</error> : T, // error
class object T : A,
class object T : B,
class object <error>B</error> : T
() {
fun test(t : T) {
T.foo()
T.bar()
t.foo()
t.bar()
}
}
fun test() {
new Test1<<error>B</error>>()
new Test1<<error>A</error>>()
new Test1<C>()
}
class Foo() {}
class Bar<T : Foo>
class Buzz<T> where T : Bar<<error>Int</error>>, T : <error>nioho</error>
class X<T : Foo>
class Y<<error>T</error> : Foo> where T : Bar<Foo>
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录