Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
硅谷海盗
kotlin
提交
6446e83b
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,发现更多精彩内容 >>
提交
6446e83b
编写于
12月 30, 2011
作者:
S
Stepan Koltsov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
remove VariableDescriptor.inType
(approved by Andrey Breslav)
上级
4b9e4b65
变更
18
隐藏空白更改
内联
并排
Showing
18 changed file
with
46 addition
and
105 deletion
+46
-105
compiler/backend/src/org/jetbrains/jet/codegen/CodegenContext.java
...backend/src/org/jetbrains/jet/codegen/CodegenContext.java
+1
-1
compiler/backend/src/org/jetbrains/jet/codegen/JetTypeMapper.java
.../backend/src/org/jetbrains/jet/codegen/JetTypeMapper.java
+5
-3
compiler/frontend.java/src/org/jetbrains/jet/lang/resolve/java/JavaDescriptorResolver.java
...tbrains/jet/lang/resolve/java/JavaDescriptorResolver.java
+1
-2
compiler/frontend/src/org/jetbrains/jet/lang/descriptors/FunctionDescriptorUtil.java
...etbrains/jet/lang/descriptors/FunctionDescriptorUtil.java
+1
-1
compiler/frontend/src/org/jetbrains/jet/lang/descriptors/LocalVariableDescriptor.java
...tbrains/jet/lang/descriptors/LocalVariableDescriptor.java
+1
-1
compiler/frontend/src/org/jetbrains/jet/lang/descriptors/PropertyDescriptor.java
...rg/jetbrains/jet/lang/descriptors/PropertyDescriptor.java
+7
-23
compiler/frontend/src/org/jetbrains/jet/lang/descriptors/PropertySetterDescriptor.java
...brains/jet/lang/descriptors/PropertySetterDescriptor.java
+1
-1
compiler/frontend/src/org/jetbrains/jet/lang/descriptors/ValueParameterDescriptorImpl.java
...ns/jet/lang/descriptors/ValueParameterDescriptorImpl.java
+7
-12
compiler/frontend/src/org/jetbrains/jet/lang/descriptors/VariableDescriptor.java
...rg/jetbrains/jet/lang/descriptors/VariableDescriptor.java
+1
-10
compiler/frontend/src/org/jetbrains/jet/lang/descriptors/VariableDescriptorBoundToReceiver.java
...t/lang/descriptors/VariableDescriptorBoundToReceiver.java
+0
-5
compiler/frontend/src/org/jetbrains/jet/lang/descriptors/VariableDescriptorImpl.java
...etbrains/jet/lang/descriptors/VariableDescriptorImpl.java
+2
-14
compiler/frontend/src/org/jetbrains/jet/lang/resolve/DescriptorResolver.java
...rc/org/jetbrains/jet/lang/resolve/DescriptorResolver.java
+6
-8
compiler/frontend/src/org/jetbrains/jet/lang/types/ErrorUtils.java
...frontend/src/org/jetbrains/jet/lang/types/ErrorUtils.java
+2
-2
compiler/frontend/src/org/jetbrains/jet/lang/types/JetStandardClasses.java
.../src/org/jetbrains/jet/lang/types/JetStandardClasses.java
+1
-1
compiler/frontend/src/org/jetbrains/jet/lang/types/expressions/ClosureExpressionsTypingVisitor.java
...ng/types/expressions/ClosureExpressionsTypingVisitor.java
+1
-1
compiler/frontend/src/org/jetbrains/jet/resolve/DescriptorRenderer.java
...end/src/org/jetbrains/jet/resolve/DescriptorRenderer.java
+5
-16
compiler/testData/diagnostics/tests/Properties.jet
compiler/testData/diagnostics/tests/Properties.jet
+2
-2
idea/testData/checker/Properties.jet
idea/testData/checker/Properties.jet
+2
-2
未找到文件。
compiler/backend/src/org/jetbrains/jet/codegen/CodegenContext.java
浏览文件 @
6446e83b
...
...
@@ -229,7 +229,7 @@ public abstract class CodegenContext {
pd
.
getName
()
+
"$bridge$"
+
accessors
.
size
()
);
JetType
receiverType
=
pd
.
getReceiverParameter
().
exists
()
?
pd
.
getReceiverParameter
().
getType
()
:
null
;
myAccessor
.
setType
(
pd
.
get
InType
(),
pd
.
get
OutType
(),
Collections
.<
TypeParameterDescriptor
>
emptyList
(),
pd
.
getExpectedThisObject
(),
receiverType
);
myAccessor
.
setType
(
pd
.
getOutType
(),
Collections
.<
TypeParameterDescriptor
>
emptyList
(),
pd
.
getExpectedThisObject
(),
receiverType
);
PropertyGetterDescriptor
pgd
=
new
PropertyGetterDescriptor
(
myAccessor
,
Collections
.<
AnnotationDescriptor
>
emptyList
(),
myAccessor
.
getModality
(),
...
...
compiler/backend/src/org/jetbrains/jet/codegen/JetTypeMapper.java
浏览文件 @
6446e83b
...
...
@@ -672,9 +672,11 @@ public class JetTypeMapper {
@Nullable
public
JvmMethodSignature
mapSetterSignature
(
PropertyDescriptor
descriptor
,
OwnerKind
kind
)
{
JetType
inType
=
descriptor
.
getInType
();
if
(
inType
==
null
)
if
(!
descriptor
.
isVar
())
{
return
null
;
}
JetType
outType
=
descriptor
.
getOutType
();
String
name
=
PropertyCodegen
.
setterName
(
descriptor
.
getName
());
ArrayList
<
Type
>
params
=
new
ArrayList
<
Type
>();
...
...
@@ -694,7 +696,7 @@ public class JetTypeMapper {
}
}
params
.
add
(
mapType
(
in
Type
));
params
.
add
(
mapType
(
out
Type
));
// TODO: proper generic signature
return
new
JvmMethodSignature
(
new
Method
(
name
,
Type
.
VOID_TYPE
,
params
.
toArray
(
new
Type
[
params
.
size
()])),
null
,
null
,
null
,
null
);
...
...
compiler/frontend.java/src/org/jetbrains/jet/lang/resolve/java/JavaDescriptorResolver.java
浏览文件 @
6446e83b
...
...
@@ -743,7 +743,7 @@ public class JavaDescriptorResolver {
i
,
Collections
.<
AnnotationDescriptor
>
emptyList
(),
// TODO
name
,
null
,
// TODO : review
false
,
changeNullable
?
TypeUtils
.
makeNullableAsSpecified
(
outType
,
nullable
)
:
outType
,
hasDefaultValue
,
varargElementType
...
...
@@ -767,7 +767,6 @@ public class JavaDescriptorResolver {
null
,
DescriptorUtils
.
getExpectedThisObjectIfNeeded
(
containingDeclaration
),
field
.
getName
(),
isFinal
?
null
:
type
,
type
);
semanticServices
.
getTrace
().
record
(
BindingContext
.
VARIABLE
,
field
,
propertyDescriptor
);
fieldDescriptorCache
.
put
(
field
,
propertyDescriptor
);
...
...
compiler/frontend/src/org/jetbrains/jet/lang/descriptors/FunctionDescriptorUtil.java
浏览文件 @
6446e83b
...
...
@@ -60,7 +60,7 @@ public class FunctionDescriptorUtil {
substitutedDescriptor
,
unsubstitutedValueParameter
,
unsubstitutedValueParameter
.
getAnnotations
(),
unsubstitutedValueParameter
.
getInType
()
==
null
?
null
:
substitutedType
,
unsubstitutedValueParameter
.
isVar
()
,
substitutedType
,
substituteVarargElementType
));
...
...
compiler/frontend/src/org/jetbrains/jet/lang/descriptors/LocalVariableDescriptor.java
浏览文件 @
6446e83b
...
...
@@ -19,7 +19,7 @@ public class LocalVariableDescriptor extends VariableDescriptorImpl {
@NotNull
String
name
,
@Nullable
JetType
type
,
boolean
mutable
)
{
super
(
containingDeclaration
,
annotations
,
name
,
mutable
?
type
:
null
,
type
);
super
(
containingDeclaration
,
annotations
,
name
,
type
);
isVar
=
mutable
;
}
...
...
compiler/frontend/src/org/jetbrains/jet/lang/descriptors/PropertyDescriptor.java
浏览文件 @
6446e83b
...
...
@@ -71,23 +71,20 @@ public class PropertyDescriptor extends VariableDescriptorImpl implements Callab
@Nullable
JetType
receiverType
,
@NotNull
ReceiverDescriptor
expectedThisObject
,
@NotNull
String
name
,
@Nullable
JetType
inType
,
@NotNull
JetType
outType
)
{
this
(
containingDeclaration
,
annotations
,
modality
,
visibility
,
isVar
,
name
);
setType
(
inType
,
outType
,
Collections
.<
TypeParameterDescriptor
>
emptyList
(),
expectedThisObject
,
receiverType
);
setType
(
outType
,
Collections
.<
TypeParameterDescriptor
>
emptyList
(),
expectedThisObject
,
receiverType
);
}
public
void
setType
(
@N
ullable
JetType
inType
,
@N
otNull
JetType
outType
,
@NotNull
List
<
TypeParameterDescriptor
>
typeParameters
,
@NotNull
ReceiverDescriptor
expectedThisObject
,
@Nullable
JetType
receiverType
)
{
public
void
setType
(
@NotNull
JetType
outType
,
@NotNull
List
<
TypeParameterDescriptor
>
typeParameters
,
@NotNull
ReceiverDescriptor
expectedThisObject
,
@Nullable
JetType
receiverType
)
{
ReceiverDescriptor
receiver
=
receiverType
==
null
?
NO_RECEIVER
:
new
ExtensionReceiver
(
this
,
receiverType
);
setType
(
inType
,
outType
,
typeParameters
,
expectedThisObject
,
receiver
);
setType
(
outType
,
typeParameters
,
expectedThisObject
,
receiver
);
}
public
void
setType
(
@Nullable
JetType
inType
,
@NotNull
JetType
outType
,
@NotNull
List
<
TypeParameterDescriptor
>
typeParameters
,
@NotNull
ReceiverDescriptor
expectedThisObject
,
@NotNull
ReceiverDescriptor
receiver
)
{
assert
!
isVar
||
inType
!=
null
;
setInType
(
inType
);
public
void
setType
(
@NotNull
JetType
outType
,
@NotNull
List
<
TypeParameterDescriptor
>
typeParameters
,
@NotNull
ReceiverDescriptor
expectedThisObject
,
@NotNull
ReceiverDescriptor
receiver
)
{
setOutType
(
outType
);
this
.
typeParemeters
=
typeParameters
;
...
...
@@ -123,17 +120,6 @@ public class PropertyDescriptor extends VariableDescriptorImpl implements Callab
return
getOutType
();
}
@Override
public
JetType
getInType
()
{
return
super
.
getInType
();
}
@Override
@NotNull
public
JetType
getOutType
()
{
return
super
.
getOutType
();
}
public
boolean
isVar
()
{
return
isVar
;
}
...
...
@@ -170,11 +156,9 @@ public class PropertyDescriptor extends VariableDescriptorImpl implements Callab
List
<
TypeParameterDescriptor
>
substitutedTypeParameters
=
Lists
.
newArrayList
();
TypeSubstitutor
substitutor
=
DescriptorSubstitutor
.
substituteTypeParameters
(
getTypeParameters
(),
originalSubstitutor
,
substitutedDescriptor
,
substitutedTypeParameters
);
JetType
originalInType
=
getInType
();
JetType
inType
=
originalInType
==
null
?
null
:
substitutor
.
substitute
(
originalInType
,
Variance
.
IN_VARIANCE
);
JetType
originalOutType
=
getOutType
();
JetType
outType
=
substitutor
.
substitute
(
originalOutType
,
Variance
.
OUT_VARIANCE
);
if
(
inType
==
null
&&
outType
==
null
)
{
if
(
outType
==
null
)
{
return
null
;
// TODO : tell the user that the property was projected out
}
...
...
@@ -196,7 +180,7 @@ public class PropertyDescriptor extends VariableDescriptorImpl implements Callab
substitutedReceiverType
=
null
;
}
substitutedDescriptor
.
setType
(
inType
,
outType
,
substitutedTypeParameters
,
substitutedExpectedThisObject
,
substitutedReceiverType
);
substitutedDescriptor
.
setType
(
outType
,
substitutedTypeParameters
,
substitutedExpectedThisObject
,
substitutedReceiverType
);
return
substitutedDescriptor
;
}
...
...
@@ -231,7 +215,7 @@ public class PropertyDescriptor extends VariableDescriptorImpl implements Callab
DescriptorUtils
.
convertModality
(
modality
,
makeNonAbstract
),
visibility
,
isVar
,
getName
());
propertyDescriptor
.
setType
(
get
InType
(),
get
OutType
(),
DescriptorUtils
.
copyTypeParameters
(
propertyDescriptor
,
getTypeParameters
()),
expectedThisObject
,
receiver
.
exists
()
?
receiver
.
getType
()
:
null
);
propertyDescriptor
.
setType
(
getOutType
(),
DescriptorUtils
.
copyTypeParameters
(
propertyDescriptor
,
getTypeParameters
()),
expectedThisObject
,
receiver
.
exists
()
?
receiver
.
getType
()
:
null
);
PropertyGetterDescriptor
newGetter
=
getter
==
null
?
null
:
new
PropertyGetterDescriptor
(
propertyDescriptor
,
Lists
.
newArrayList
(
getter
.
getAnnotations
()),
...
...
compiler/frontend/src/org/jetbrains/jet/lang/descriptors/PropertySetterDescriptor.java
浏览文件 @
6446e83b
...
...
@@ -35,7 +35,7 @@ public class PropertySetterDescriptor extends PropertyAccessorDescriptor {
public
void
initializeDefault
()
{
assert
parameter
==
null
;
parameter
=
new
ValueParameterDescriptorImpl
(
this
,
0
,
Collections
.<
AnnotationDescriptor
>
emptyList
(),
"<>"
,
null
,
getCorrespondingProperty
().
getReturnType
(),
false
,
null
);
parameter
=
new
ValueParameterDescriptorImpl
(
this
,
0
,
Collections
.<
AnnotationDescriptor
>
emptyList
(),
"<>"
,
false
,
getCorrespondingProperty
().
getReturnType
(),
false
,
null
);
}
@NotNull
...
...
compiler/frontend/src/org/jetbrains/jet/lang/descriptors/ValueParameterDescriptorImpl.java
浏览文件 @
6446e83b
...
...
@@ -24,42 +24,37 @@ public class ValueParameterDescriptorImpl extends VariableDescriptorImpl impleme
int
index
,
@NotNull
List
<
AnnotationDescriptor
>
annotations
,
@NotNull
String
name
,
@Nullable
JetType
inType
,
boolean
isVar
,
@NotNull
JetType
outType
,
boolean
hasDefaultValue
,
@Nullable
JetType
varargElementType
)
{
super
(
containingDeclaration
,
annotations
,
name
,
inType
,
outType
);
super
(
containingDeclaration
,
annotations
,
name
,
outType
);
this
.
original
=
this
;
this
.
index
=
index
;
this
.
hasDefaultValue
=
hasDefaultValue
;
this
.
varargElementType
=
varargElementType
;
this
.
isVar
=
i
nType
!=
null
;
this
.
isVar
=
i
sVar
;
}
public
ValueParameterDescriptorImpl
(
@NotNull
DeclarationDescriptor
containingDeclaration
,
@NotNull
ValueParameterDescriptor
original
,
@NotNull
List
<
AnnotationDescriptor
>
annotations
,
@Nullable
JetType
inType
,
boolean
isVar
,
@NotNull
JetType
outType
,
@Nullable
JetType
varargElementType
)
{
super
(
containingDeclaration
,
annotations
,
original
.
getName
(),
inType
,
outType
);
super
(
containingDeclaration
,
annotations
,
original
.
getName
(),
outType
);
this
.
original
=
original
;
this
.
index
=
original
.
getIndex
();
this
.
hasDefaultValue
=
original
.
hasDefaultValue
();
this
.
varargElementType
=
varargElementType
;
this
.
isVar
=
i
nType
!=
null
;
this
.
isVar
=
i
sVar
;
}
@Override
public
void
setType
(
@NotNull
JetType
type
)
{
assert
getOutType
()
==
null
;
setOutType
(
type
);
if
(
isVar
)
{
assert
getInType
()
==
null
;
setInType
(
type
);
}
}
@Override
...
...
@@ -107,6 +102,6 @@ public class ValueParameterDescriptorImpl extends VariableDescriptorImpl impleme
@NotNull
@Override
public
ValueParameterDescriptor
copy
(
@NotNull
DeclarationDescriptor
newOwner
)
{
return
new
ValueParameterDescriptorImpl
(
newOwner
,
index
,
Lists
.
newArrayList
(
getAnnotations
()),
getName
(),
getInType
()
,
getOutType
(),
hasDefaultValue
,
varargElementType
);
return
new
ValueParameterDescriptorImpl
(
newOwner
,
index
,
Lists
.
newArrayList
(
getAnnotations
()),
getName
(),
isVar
,
getOutType
(),
hasDefaultValue
,
varargElementType
);
}
}
compiler/frontend/src/org/jetbrains/jet/lang/descriptors/VariableDescriptor.java
浏览文件 @
6446e83b
...
...
@@ -9,18 +9,9 @@ import org.jetbrains.jet.lang.types.TypeSubstitutor;
* @author abreslav
*/
public
interface
VariableDescriptor
extends
CallableDescriptor
{
/**
* @return <code>null</code> for write-only variables (i.e. properties), variable value type otherwise
*/
@Nullable
@NotNull
JetType
getOutType
();
/**
* @return <code>null</code> for read-only variables (i.e. val's etc), or the type expected on assignment type otherwise
*/
@Nullable
JetType
getInType
();
@Override
@SuppressWarnings
({
"NullableProblems"
})
@NotNull
...
...
compiler/frontend/src/org/jetbrains/jet/lang/descriptors/VariableDescriptorBoundToReceiver.java
浏览文件 @
6446e83b
...
...
@@ -34,11 +34,6 @@ public class VariableDescriptorBoundToReceiver implements VariableDescriptor {
return
variableDescriptor
.
getOutType
();
}
@Override
public
JetType
getInType
()
{
return
variableDescriptor
.
getInType
();
}
@NotNull
@Override
public
DeclarationDescriptor
getContainingDeclaration
()
{
...
...
compiler/frontend/src/org/jetbrains/jet/lang/descriptors/VariableDescriptorImpl.java
浏览文件 @
6446e83b
...
...
@@ -14,19 +14,15 @@ import java.util.Set;
* @author abreslav
*/
public
abstract
class
VariableDescriptorImpl
extends
DeclarationDescriptorImpl
implements
VariableDescriptor
{
private
JetType
inType
;
private
JetType
outType
;
public
VariableDescriptorImpl
(
@NotNull
DeclarationDescriptor
containingDeclaration
,
@NotNull
List
<
AnnotationDescriptor
>
annotations
,
@NotNull
String
name
,
@Nullable
JetType
inType
,
@Nullable
JetType
outType
)
{
@NotNull
JetType
outType
)
{
super
(
containingDeclaration
,
annotations
,
name
);
assert
(
inType
!=
null
)
||
(
outType
!=
null
);
this
.
inType
=
inType
;
this
.
outType
=
outType
;
}
...
...
@@ -44,16 +40,8 @@ public abstract class VariableDescriptorImpl extends DeclarationDescriptorImpl i
return
outType
;
}
@Override
public
JetType
getInType
()
{
return
inType
;
}
protected
void
setInType
(
JetType
inType
)
{
this
.
inType
=
inType
;
}
protected
void
setOutType
(
JetType
outType
)
{
assert
this
.
outType
==
null
;
this
.
outType
=
outType
;
}
...
...
compiler/frontend/src/org/jetbrains/jet/lang/resolve/DescriptorResolver.java
浏览文件 @
6446e83b
...
...
@@ -264,7 +264,7 @@ public class DescriptorResolver {
index
,
annotationResolver
.
createAnnotationStubs
(
valueParameter
.
getModifierList
()),
JetPsiUtil
.
safeName
(
valueParameter
.
getName
()),
valueParameter
.
isMutable
()
?
variableType
:
null
,
valueParameter
.
isMutable
(),
variableType
,
valueParameter
.
getDefaultValue
()
!=
null
,
varargElementType
...
...
@@ -479,7 +479,7 @@ public class DescriptorResolver {
JetPsiUtil
.
safeName
(
objectDeclaration
.
getName
())
);
propertyDescriptor
.
setType
(
null
,
classDescriptor
.
getDefaultType
(),
Collections
.<
TypeParameterDescriptor
>
emptyList
(),
DescriptorUtils
.
getExpectedThisObjectIfNeeded
(
containingDeclaration
),
ReceiverDescriptor
.
NO_RECEIVER
);
propertyDescriptor
.
setType
(
classDescriptor
.
getDefaultType
(),
Collections
.<
TypeParameterDescriptor
>
emptyList
(),
DescriptorUtils
.
getExpectedThisObjectIfNeeded
(
containingDeclaration
),
ReceiverDescriptor
.
NO_RECEIVER
);
propertyDescriptor
.
initialize
(
null
,
null
);
JetObjectDeclarationName
nameAsDeclaration
=
objectDeclaration
.
getNameAsDeclaration
();
...
...
@@ -553,8 +553,7 @@ public class DescriptorResolver {
JetType
type
=
getVariableType
(
propertyScope
,
property
,
DataFlowInfo
.
EMPTY
,
true
);
JetType
inType
=
isVar
?
type
:
null
;
propertyDescriptor
.
setType
(
inType
,
type
,
typeParameterDescriptors
,
DescriptorUtils
.
getExpectedThisObjectIfNeeded
(
containingDeclaration
),
receiverDescriptor
);
propertyDescriptor
.
setType
(
type
,
typeParameterDescriptors
,
DescriptorUtils
.
getExpectedThisObjectIfNeeded
(
containingDeclaration
),
receiverDescriptor
);
PropertyGetterDescriptor
getter
=
resolvePropertyGetterDescriptor
(
scopeWithTypeParameters
,
property
,
propertyDescriptor
);
PropertySetterDescriptor
setter
=
resolvePropertySetterDescriptor
(
scopeWithTypeParameters
,
property
,
propertyDescriptor
);
...
...
@@ -686,11 +685,11 @@ public class DescriptorResolver {
JetType
type
;
JetTypeReference
typeReference
=
parameter
.
getTypeReference
();
if
(
typeReference
==
null
)
{
type
=
propertyDescriptor
.
get
In
Type
();
// TODO : this maybe unknown at this point
type
=
propertyDescriptor
.
get
Out
Type
();
// TODO : this maybe unknown at this point
}
else
{
type
=
typeResolver
.
resolveType
(
scope
,
typeReference
);
JetType
inType
=
propertyDescriptor
.
get
In
Type
();
JetType
inType
=
propertyDescriptor
.
get
Out
Type
();
if
(
inType
!=
null
)
{
if
(!
TypeUtils
.
equalTypes
(
type
,
inType
))
{
// trace.getErrorHandler().genericError(typeReference.getNode(), "Setter parameter type must be equal to the type of the property, i.e. " + inType);
...
...
@@ -842,8 +841,7 @@ public class DescriptorResolver {
isMutable
,
name
==
null
?
"<no name>"
:
name
);
JetType
inType
=
isMutable
?
type
:
null
;
propertyDescriptor
.
setType
(
inType
,
type
,
Collections
.<
TypeParameterDescriptor
>
emptyList
(),
DescriptorUtils
.
getExpectedThisObjectIfNeeded
(
classDescriptor
),
ReceiverDescriptor
.
NO_RECEIVER
);
propertyDescriptor
.
setType
(
type
,
Collections
.<
TypeParameterDescriptor
>
emptyList
(),
DescriptorUtils
.
getExpectedThisObjectIfNeeded
(
classDescriptor
),
ReceiverDescriptor
.
NO_RECEIVER
);
PropertyGetterDescriptor
getter
=
createDefaultGetter
(
propertyDescriptor
);
PropertySetterDescriptor
setter
=
createDefaultSetter
(
propertyDescriptor
);
...
...
compiler/frontend/src/org/jetbrains/jet/lang/types/ErrorUtils.java
浏览文件 @
6446e83b
...
...
@@ -116,7 +116,7 @@ public class ErrorUtils {
null
,
ReceiverDescriptor
.
NO_RECEIVER
,
"<ERROR PROPERTY>"
,
ERROR_PROPERTY_TYPE
,
ERROR_PROPERTY_TYPE
);
ERROR_PROPERTY_TYPE
);
private
static
final
Set
<
VariableDescriptor
>
ERROR_PROPERTY_GROUP
=
Collections
.
singleton
(
ERROR_PROPERTY
);
private
static
FunctionDescriptor
createErrorFunction
(
List
<
TypeParameterDescriptor
>
typeParameters
,
List
<
JetType
>
positionedValueArgumentTypes
)
{
...
...
@@ -165,7 +165,7 @@ public class ErrorUtils {
i
,
Collections
.<
AnnotationDescriptor
>
emptyList
(),
"<ERROR VALUE_PARAMETER>"
,
ERROR_PARAMETER_TYPE
,
true
,
ERROR_PARAMETER_TYPE
,
false
,
null
));
...
...
compiler/frontend/src/org/jetbrains/jet/lang/types/JetStandardClasses.java
浏览文件 @
6446e83b
...
...
@@ -385,7 +385,7 @@ public class JetStandardClasses {
List
<
ValueParameterDescriptor
>
valueParameters
=
Lists
.
newArrayList
();
for
(
int
i
=
first
;
i
<=
last
;
i
++)
{
JetType
parameterType
=
arguments
.
get
(
i
).
getType
();
ValueParameterDescriptorImpl
valueParameterDescriptor
=
new
ValueParameterDescriptorImpl
(
functionDescriptor
,
i
,
Collections
.<
AnnotationDescriptor
>
emptyList
(),
"p"
+
i
,
null
,
parameterType
,
false
,
null
);
ValueParameterDescriptorImpl
valueParameterDescriptor
=
new
ValueParameterDescriptorImpl
(
functionDescriptor
,
i
,
Collections
.<
AnnotationDescriptor
>
emptyList
(),
"p"
+
i
,
false
,
parameterType
,
false
,
null
);
valueParameters
.
add
(
valueParameterDescriptor
);
}
return
valueParameters
;
...
...
compiler/frontend/src/org/jetbrains/jet/lang/types/expressions/ClosureExpressionsTypingVisitor.java
浏览文件 @
6446e83b
...
...
@@ -145,7 +145,7 @@ public class ClosureExpressionsTypingVisitor extends ExpressionTypingVisitor {
if
(
functionTypeExpected
&&
!
hasDeclaredValueParameters
&&
expectedValueParameters
.
size
()
==
1
)
{
ValueParameterDescriptor
valueParameterDescriptor
=
expectedValueParameters
.
get
(
0
);
ValueParameterDescriptor
it
=
new
ValueParameterDescriptorImpl
(
functionDescriptor
,
0
,
Collections
.<
AnnotationDescriptor
>
emptyList
(),
"it"
,
valueParameterDescriptor
.
getInType
()
,
valueParameterDescriptor
.
getOutType
(),
valueParameterDescriptor
.
hasDefaultValue
(),
valueParameterDescriptor
.
getVarargElementType
()
functionDescriptor
,
0
,
Collections
.<
AnnotationDescriptor
>
emptyList
(),
"it"
,
false
,
valueParameterDescriptor
.
getOutType
(),
valueParameterDescriptor
.
hasDefaultValue
(),
valueParameterDescriptor
.
getVarargElementType
()
);
valueParameterDescriptors
.
add
(
it
);
context
.
trace
.
record
(
AUTO_CREATED_IT
,
it
);
...
...
compiler/frontend/src/org/jetbrains/jet/resolve/DescriptorRenderer.java
浏览文件 @
6446e83b
...
...
@@ -136,7 +136,7 @@ public class DescriptorRenderer implements Renderer {
@Override
public
Void
visitVariableDescriptor
(
VariableDescriptor
descriptor
,
StringBuilder
builder
)
{
String
typeString
=
renderPropertyPrefixAndComputeTypeString
(
builder
,
Collections
.<
TypeParameterDescriptor
>
emptyList
(),
ReceiverDescriptor
.
NO_RECEIVER
,
descriptor
.
getOutType
()
,
descriptor
.
getInType
()
);
String
typeString
=
renderPropertyPrefixAndComputeTypeString
(
builder
,
Collections
.<
TypeParameterDescriptor
>
emptyList
(),
ReceiverDescriptor
.
NO_RECEIVER
,
descriptor
.
getOutType
());
renderName
(
descriptor
,
builder
);
builder
.
append
(
" : "
).
append
(
escape
(
typeString
));
return
super
.
visitVariableDescriptor
(
descriptor
,
builder
);
...
...
@@ -146,26 +146,16 @@ public class DescriptorRenderer implements Renderer {
@NotNull
StringBuilder
builder
,
@NotNull
List
<
TypeParameterDescriptor
>
typeParameters
,
@NotNull
ReceiverDescriptor
receiver
,
@Nullable
JetType
outType
,
@Nullable
JetType
inType
)
{
@Nullable
JetType
outType
)
{
String
typeString
=
lt
()
+
"no type>"
;
if
(
inType
!=
null
&&
outType
!=
null
)
{
if
(
outType
!=
null
)
{
builder
.
append
(
renderKeyword
(
"var"
)).
append
(
" "
);
if
(
inType
.
equals
(
outType
))
{
typeString
=
renderType
(
outType
);
}
else
{
typeString
=
"<"
+
renderKeyword
(
"in"
)
+
": "
+
renderType
(
inType
)
+
" "
+
renderKeyword
(
"out"
)
+
": "
+
renderType
(
outType
)
+
">"
;
}
typeString
=
renderType
(
outType
);
}
else
if
(
outType
!=
null
)
{
builder
.
append
(
renderKeyword
(
"val"
)).
append
(
" "
);
typeString
=
renderType
(
outType
);
}
else
if
(
inType
!=
null
)
{
builder
.
append
(
lt
()).
append
(
"write-only> "
);
typeString
=
renderType
(
inType
);
}
renderTypeParameters
(
typeParameters
,
builder
);
...
...
@@ -182,8 +172,7 @@ public class DescriptorRenderer implements Renderer {
String
typeString
=
renderPropertyPrefixAndComputeTypeString
(
builder
,
descriptor
.
getTypeParameters
(),
descriptor
.
getReceiverParameter
(),
descriptor
.
getOutType
(),
descriptor
.
getInType
());
descriptor
.
getOutType
());
renderName
(
descriptor
,
builder
);
builder
.
append
(
" : "
).
append
(
escape
(
typeString
));
return
null
;
...
...
compiler/testData/diagnostics/tests/Properties.jet
浏览文件 @
6446e83b
...
...
@@ -7,7 +7,7 @@ var x : Int = 1 + x
val xx : Int = <!PROPERTY_INITIALIZER_NO_BACKING_FIELD!>1 + x<!>
get() : Int = 1
<!VAL_WITH_SETTER!>set(value :
Long
) {}<!>
<!VAL_WITH_SETTER!>set(value :
<!WRONG_SETTER_PARAMETER_TYPE!>Long<!>
) {}<!>
val p : Int = <!PROPERTY_INITIALIZER_NO_BACKING_FIELD!>1<!>
get() = 1
...
...
@@ -26,4 +26,4 @@ class Test() {
a = <!NO_BACKING_FIELD_CUSTOM_ACCESSORS!>$b<!>
}
public val <!PUBLIC_MEMBER_SHOULD_SPECIFY_TYPE!>i<!> = 1
}
\ No newline at end of file
}
idea/testData/checker/Properties.jet
浏览文件 @
6446e83b
...
...
@@ -7,7 +7,7 @@
val xx : Int = <error>1 + x</error>
get() : Int = 1
<error>set(value :
Long
) {}</error>
<error>set(value :
<error>Long</error>
) {}</error>
val p : Int = <error>1</error>
get() = 1
...
...
@@ -25,4 +25,4 @@ class Test() {
<error>$b</error> = $a
a = <error>$b</error>
}
}
\ No newline at end of file
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录