Disallow extension properties with backing fields
#KT-1682 Fixed
This commit is contained in:
@@ -1790,6 +1790,7 @@ public class ExpressionCodegen extends JetVisitor<StackValue, StackValue> implem
|
|||||||
boolean isStatic = containingDeclaration instanceof PackageFragmentDescriptor;
|
boolean isStatic = containingDeclaration instanceof PackageFragmentDescriptor;
|
||||||
boolean isSuper = superExpression != null;
|
boolean isSuper = superExpression != null;
|
||||||
boolean isInsideClass = isCallInsideSameClassAsDeclared(propertyDescriptor, context);
|
boolean isInsideClass = isCallInsideSameClassAsDeclared(propertyDescriptor, context);
|
||||||
|
boolean isExtensionProperty = propertyDescriptor.getReceiverParameter() != null;
|
||||||
|
|
||||||
JetType delegateType = getPropertyDelegateType(propertyDescriptor, bindingContext);
|
JetType delegateType = getPropertyDelegateType(propertyDescriptor, bindingContext);
|
||||||
boolean isDelegatedProperty = delegateType != null;
|
boolean isDelegatedProperty = delegateType != null;
|
||||||
@@ -1859,17 +1860,22 @@ public class ExpressionCodegen extends JetVisitor<StackValue, StackValue> implem
|
|||||||
owner = callableMethod.getOwner();
|
owner = callableMethod.getOwner();
|
||||||
}
|
}
|
||||||
|
|
||||||
String name;
|
String fieldName;
|
||||||
if (propertyDescriptor.getContainingDeclaration() == backingFieldContext.getContextDescriptor()) {
|
if (isExtensionProperty && !isDelegatedProperty) {
|
||||||
assert backingFieldContext instanceof FieldOwnerContext : "Actual context is " + backingFieldContext + " but should be instance of FieldOwnerContext" ;
|
fieldName = null;
|
||||||
name = ((FieldOwnerContext) backingFieldContext).getFieldName(propertyDescriptor, isDelegatedProperty);
|
}
|
||||||
} else {
|
else if (propertyDescriptor.getContainingDeclaration() == backingFieldContext.getContextDescriptor()) {
|
||||||
name = JvmAbi.getDefaultPropertyName(propertyDescriptor.getName(), isDelegatedProperty, propertyDescriptor.getReceiverParameter() != null);
|
assert backingFieldContext instanceof FieldOwnerContext
|
||||||
|
: "Actual context is " + backingFieldContext + " but should be instance of FieldOwnerContext";
|
||||||
|
fieldName = ((FieldOwnerContext) backingFieldContext).getFieldName(propertyDescriptor, isDelegatedProperty);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
fieldName = JvmAbi.getDefaultFieldNameForProperty(propertyDescriptor.getName(), isDelegatedProperty);
|
||||||
}
|
}
|
||||||
|
|
||||||
return StackValue.property(propertyDescriptor, owner,
|
return StackValue.property(propertyDescriptor, owner,
|
||||||
typeMapper.mapType(isDelegatedProperty && forceField ? delegateType : propertyDescriptor.getOriginal().getType()),
|
typeMapper.mapType(isDelegatedProperty && forceField ? delegateType : propertyDescriptor.getOriginal().getType()),
|
||||||
isStatic, name, callableGetter, callableSetter, state);
|
isStatic, fieldName, callableGetter, callableSetter, state);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -144,12 +144,12 @@ public abstract class StackValue {
|
|||||||
@NotNull Type methodOwner,
|
@NotNull Type methodOwner,
|
||||||
@NotNull Type type,
|
@NotNull Type type,
|
||||||
boolean isStatic,
|
boolean isStatic,
|
||||||
@NotNull String name,
|
@Nullable String fieldName,
|
||||||
@Nullable CallableMethod getter,
|
@Nullable CallableMethod getter,
|
||||||
@Nullable CallableMethod setter,
|
@Nullable CallableMethod setter,
|
||||||
GenerationState state
|
GenerationState state
|
||||||
) {
|
) {
|
||||||
return new Property(descriptor, methodOwner, getter, setter, isStatic, name, type, state);
|
return new Property(descriptor, methodOwner, getter, setter, isStatic, fieldName, type, state);
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
@@ -817,24 +817,19 @@ public abstract class StackValue {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static class Property extends StackValueWithSimpleReceiver {
|
static class Property extends StackValueWithSimpleReceiver {
|
||||||
@Nullable
|
|
||||||
private final CallableMethod getter;
|
private final CallableMethod getter;
|
||||||
@Nullable
|
|
||||||
private final CallableMethod setter;
|
private final CallableMethod setter;
|
||||||
@NotNull
|
private final Type methodOwner;
|
||||||
public final Type methodOwner;
|
|
||||||
|
|
||||||
@NotNull
|
|
||||||
private final PropertyDescriptor descriptor;
|
private final PropertyDescriptor descriptor;
|
||||||
@NotNull
|
|
||||||
private final GenerationState state;
|
private final GenerationState state;
|
||||||
|
|
||||||
private final String name;
|
private final String fieldName;
|
||||||
|
|
||||||
public Property(
|
public Property(
|
||||||
@NotNull PropertyDescriptor descriptor, @NotNull Type methodOwner,
|
@NotNull PropertyDescriptor descriptor, @NotNull Type methodOwner,
|
||||||
@Nullable CallableMethod getter, @Nullable CallableMethod setter, boolean isStatic,
|
@Nullable CallableMethod getter, @Nullable CallableMethod setter, boolean isStatic,
|
||||||
@NotNull String name, @NotNull Type type, @NotNull GenerationState state
|
@Nullable String fieldName, @NotNull Type type, @NotNull GenerationState state
|
||||||
) {
|
) {
|
||||||
super(type, isStatic);
|
super(type, isStatic);
|
||||||
this.methodOwner = methodOwner;
|
this.methodOwner = methodOwner;
|
||||||
@@ -842,14 +837,14 @@ public abstract class StackValue {
|
|||||||
this.setter = setter;
|
this.setter = setter;
|
||||||
this.descriptor = descriptor;
|
this.descriptor = descriptor;
|
||||||
this.state = state;
|
this.state = state;
|
||||||
this.name = name;
|
this.fieldName = fieldName;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void put(Type type, InstructionAdapter v) {
|
public void put(Type type, InstructionAdapter v) {
|
||||||
if (getter == null) {
|
if (getter == null) {
|
||||||
v.visitFieldInsn(isStatic ? GETSTATIC : GETFIELD, methodOwner.getInternalName(), getPropertyName(),
|
assert fieldName != null : "Property should have either a getter or a field name: " + descriptor;
|
||||||
this.type.getDescriptor());
|
v.visitFieldInsn(isStatic ? GETSTATIC : GETFIELD, methodOwner.getInternalName(), fieldName, this.type.getDescriptor());
|
||||||
genNotNullAssertionForField(v, state, descriptor);
|
genNotNullAssertionForField(v, state, descriptor);
|
||||||
coerceTo(type, v);
|
coerceTo(type, v);
|
||||||
}
|
}
|
||||||
@@ -864,18 +859,15 @@ public abstract class StackValue {
|
|||||||
public void store(Type topOfStackType, InstructionAdapter v) {
|
public void store(Type topOfStackType, InstructionAdapter v) {
|
||||||
coerceFrom(topOfStackType, v);
|
coerceFrom(topOfStackType, v);
|
||||||
if (setter == null) {
|
if (setter == null) {
|
||||||
v.visitFieldInsn(isStatic ? PUTSTATIC : PUTFIELD, methodOwner.getInternalName(), getPropertyName(),
|
assert fieldName != null : "Property should have either a setter or a field name: " + descriptor;
|
||||||
this.type.getDescriptor()); }
|
v.visitFieldInsn(isStatic ? PUTSTATIC : PUTFIELD, methodOwner.getInternalName(), fieldName, this.type.getDescriptor());
|
||||||
|
}
|
||||||
else {
|
else {
|
||||||
Method method = setter.getAsmMethod();
|
Method method = setter.getAsmMethod();
|
||||||
v.visitMethodInsn(setter.getInvokeOpcode(), setter.getOwner().getInternalName(), method.getName(), method.getDescriptor());
|
v.visitMethodInsn(setter.getInvokeOpcode(), setter.getOwner().getInternalName(), method.getName(), method.getDescriptor());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getPropertyName() {
|
|
||||||
return name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isPropertyWithBackingFieldInOuterClass() {
|
public boolean isPropertyWithBackingFieldInOuterClass() {
|
||||||
return descriptor instanceof AccessorForPropertyBackingFieldInOuterClass;
|
return descriptor instanceof AccessorForPropertyBackingFieldInOuterClass;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -44,16 +44,11 @@ public abstract class FieldOwnerContext<T extends DeclarationDescriptor> extends
|
|||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
public String getFieldName(@NotNull PropertyDescriptor descriptor, boolean isDelegated) {
|
public String getFieldName(@NotNull PropertyDescriptor possiblySubstitutedDescriptor, boolean isDelegated) {
|
||||||
|
PropertyDescriptor descriptor = possiblySubstitutedDescriptor.getOriginal();
|
||||||
assert descriptor.getKind().isReal() : "Only declared properties can have backing fields: " + descriptor;
|
assert descriptor.getKind().isReal() : "Only declared properties can have backing fields: " + descriptor;
|
||||||
boolean isExtension = descriptor.getReceiverParameter() != null;
|
|
||||||
|
|
||||||
return getFieldName(descriptor.getOriginal(), isDelegated, isExtension);
|
String defaultPropertyName = JvmAbi.getDefaultFieldNameForProperty(descriptor.getName(), isDelegated);
|
||||||
}
|
|
||||||
|
|
||||||
@NotNull
|
|
||||||
private String getFieldName(@NotNull PropertyDescriptor descriptor, boolean isDelegated, boolean isExtension) {
|
|
||||||
String defaultPropertyName = JvmAbi.getDefaultPropertyName(descriptor.getName(), isDelegated, isExtension);
|
|
||||||
|
|
||||||
Map<PropertyDescriptor, String> descriptor2Name = fieldNames.get(defaultPropertyName);
|
Map<PropertyDescriptor, String> descriptor2Name = fieldNames.get(defaultPropertyName);
|
||||||
if (descriptor2Name == null) {
|
if (descriptor2Name == null) {
|
||||||
|
|||||||
@@ -263,6 +263,7 @@ public interface Errors {
|
|||||||
DiagnosticFactory0<JetProperty> MUST_BE_INITIALIZED = DiagnosticFactory0.create(ERROR, NAMED_ELEMENT);
|
DiagnosticFactory0<JetProperty> MUST_BE_INITIALIZED = DiagnosticFactory0.create(ERROR, NAMED_ELEMENT);
|
||||||
DiagnosticFactory0<JetProperty> MUST_BE_INITIALIZED_OR_BE_ABSTRACT = DiagnosticFactory0.create(ERROR, NAMED_ELEMENT);
|
DiagnosticFactory0<JetProperty> MUST_BE_INITIALIZED_OR_BE_ABSTRACT = DiagnosticFactory0.create(ERROR, NAMED_ELEMENT);
|
||||||
|
|
||||||
|
DiagnosticFactory0<JetExpression> EXTENSION_PROPERTY_WITH_BACKING_FIELD = DiagnosticFactory0.create(ERROR);
|
||||||
DiagnosticFactory0<JetExpression> PROPERTY_INITIALIZER_NO_BACKING_FIELD = DiagnosticFactory0.create(ERROR);
|
DiagnosticFactory0<JetExpression> PROPERTY_INITIALIZER_NO_BACKING_FIELD = DiagnosticFactory0.create(ERROR);
|
||||||
DiagnosticFactory0<JetExpression> PROPERTY_INITIALIZER_IN_TRAIT = DiagnosticFactory0.create(ERROR);
|
DiagnosticFactory0<JetExpression> PROPERTY_INITIALIZER_IN_TRAIT = DiagnosticFactory0.create(ERROR);
|
||||||
DiagnosticFactory0<JetProperty> FINAL_PROPERTY_IN_TRAIT = DiagnosticFactory0.create(ERROR, FINAL_MODIFIER);
|
DiagnosticFactory0<JetProperty> FINAL_PROPERTY_IN_TRAIT = DiagnosticFactory0.create(ERROR, FINAL_MODIFIER);
|
||||||
|
|||||||
+1
@@ -131,6 +131,7 @@ public class DefaultErrorMessages {
|
|||||||
MAP.put(MUST_BE_INITIALIZED_OR_BE_ABSTRACT, "Property must be initialized or be abstract");
|
MAP.put(MUST_BE_INITIALIZED_OR_BE_ABSTRACT, "Property must be initialized or be abstract");
|
||||||
MAP.put(PROPERTY_INITIALIZER_IN_TRAIT, "Property initializers are not allowed in traits");
|
MAP.put(PROPERTY_INITIALIZER_IN_TRAIT, "Property initializers are not allowed in traits");
|
||||||
MAP.put(FINAL_PROPERTY_IN_TRAIT, "Abstract property in trait cannot be final");
|
MAP.put(FINAL_PROPERTY_IN_TRAIT, "Abstract property in trait cannot be final");
|
||||||
|
MAP.put(EXTENSION_PROPERTY_WITH_BACKING_FIELD, "Extension property cannot be initialized because it has no backing field");
|
||||||
MAP.put(PROPERTY_INITIALIZER_NO_BACKING_FIELD, "Initializer is not allowed here because this property has no backing field");
|
MAP.put(PROPERTY_INITIALIZER_NO_BACKING_FIELD, "Initializer is not allowed here because this property has no backing field");
|
||||||
MAP.put(ABSTRACT_PROPERTY_IN_NON_ABSTRACT_CLASS, "Abstract property ''{0}'' in non-abstract class ''{1}''", STRING, NAME);
|
MAP.put(ABSTRACT_PROPERTY_IN_NON_ABSTRACT_CLASS, "Abstract property ''{0}'' in non-abstract class ''{1}''", STRING, NAME);
|
||||||
MAP.put(ABSTRACT_FUNCTION_IN_NON_ABSTRACT_CLASS, "Abstract function ''{0}'' in non-abstract class ''{1}''", STRING, NAME);
|
MAP.put(ABSTRACT_FUNCTION_IN_NON_ABSTRACT_CLASS, "Abstract function ''{0}'' in non-abstract class ''{1}''", STRING, NAME);
|
||||||
|
|||||||
@@ -402,10 +402,7 @@ public class DeclarationsChecker {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void checkPropertyInitializer(
|
private void checkPropertyInitializer(@NotNull JetProperty property, @NotNull PropertyDescriptor propertyDescriptor) {
|
||||||
@NotNull JetProperty property,
|
|
||||||
@NotNull PropertyDescriptor propertyDescriptor
|
|
||||||
) {
|
|
||||||
JetPropertyAccessor getter = property.getGetter();
|
JetPropertyAccessor getter = property.getGetter();
|
||||||
JetPropertyAccessor setter = property.getSetter();
|
JetPropertyAccessor setter = property.getSetter();
|
||||||
boolean hasAccessorImplementation = (getter != null && getter.hasBody()) ||
|
boolean hasAccessorImplementation = (getter != null && getter.hasBody()) ||
|
||||||
@@ -421,14 +418,17 @@ public class DeclarationsChecker {
|
|||||||
boolean inTrait = containingDeclaration instanceof ClassDescriptor && ((ClassDescriptor)containingDeclaration).getKind() == ClassKind.TRAIT;
|
boolean inTrait = containingDeclaration instanceof ClassDescriptor && ((ClassDescriptor)containingDeclaration).getKind() == ClassKind.TRAIT;
|
||||||
JetExpression initializer = property.getInitializer();
|
JetExpression initializer = property.getInitializer();
|
||||||
JetPropertyDelegate delegate = property.getDelegate();
|
JetPropertyDelegate delegate = property.getDelegate();
|
||||||
boolean backingFieldRequired = trace.getBindingContext().get(BindingContext.BACKING_FIELD_REQUIRED, propertyDescriptor);
|
boolean backingFieldRequired =
|
||||||
|
Boolean.TRUE.equals(trace.getBindingContext().get(BindingContext.BACKING_FIELD_REQUIRED, propertyDescriptor));
|
||||||
|
|
||||||
if (inTrait && backingFieldRequired && hasAccessorImplementation) {
|
if (inTrait && backingFieldRequired && hasAccessorImplementation) {
|
||||||
trace.report(BACKING_FIELD_IN_TRAIT.on(property));
|
trace.report(BACKING_FIELD_IN_TRAIT.on(property));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (initializer == null && delegate == null) {
|
if (initializer == null && delegate == null) {
|
||||||
boolean error = false;
|
boolean error = false;
|
||||||
if (backingFieldRequired && !inTrait && !trace.getBindingContext().get(BindingContext.IS_INITIALIZED, propertyDescriptor)) {
|
if (backingFieldRequired && !inTrait &&
|
||||||
|
Boolean.FALSE.equals(trace.getBindingContext().get(BindingContext.IS_INITIALIZED, propertyDescriptor))) {
|
||||||
if (!(containingDeclaration instanceof ClassDescriptor) || hasAccessorImplementation) {
|
if (!(containingDeclaration instanceof ClassDescriptor) || hasAccessorImplementation) {
|
||||||
error = true;
|
error = true;
|
||||||
trace.report(MUST_BE_INITIALIZED.on(property));
|
trace.report(MUST_BE_INITIALIZED.on(property));
|
||||||
@@ -446,6 +446,7 @@ public class DeclarationsChecker {
|
|||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (inTrait) {
|
if (inTrait) {
|
||||||
if (delegate != null) {
|
if (delegate != null) {
|
||||||
trace.report(DELEGATED_PROPERTY_IN_TRAIT.on(delegate));
|
trace.report(DELEGATED_PROPERTY_IN_TRAIT.on(delegate));
|
||||||
@@ -454,8 +455,13 @@ public class DeclarationsChecker {
|
|||||||
trace.report(PROPERTY_INITIALIZER_IN_TRAIT.on(initializer));
|
trace.report(PROPERTY_INITIALIZER_IN_TRAIT.on(initializer));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (!backingFieldRequired && delegate == null) {
|
else if (delegate == null) {
|
||||||
trace.report(PROPERTY_INITIALIZER_NO_BACKING_FIELD.on(initializer));
|
if (!backingFieldRequired) {
|
||||||
|
trace.report(PROPERTY_INITIALIZER_NO_BACKING_FIELD.on(initializer));
|
||||||
|
}
|
||||||
|
else if (property.getReceiverTypeRef() != null) {
|
||||||
|
trace.report(EXTENSION_PROPERTY_WITH_BACKING_FIELD.on(initializer));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,21 @@
|
|||||||
|
class A {
|
||||||
|
var result = "Fail"
|
||||||
|
|
||||||
|
private var Int.foo: String
|
||||||
|
get() = result
|
||||||
|
private set(value) {
|
||||||
|
result = value
|
||||||
|
}
|
||||||
|
|
||||||
|
fun run(): String {
|
||||||
|
class O {
|
||||||
|
fun run() {
|
||||||
|
42.foo = "OK"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
O().run()
|
||||||
|
return (-42).foo
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun box() = A().run()
|
||||||
@@ -1,11 +1,12 @@
|
|||||||
class Test {
|
class Test {
|
||||||
val Int.foo: String = "OK"
|
val Int.foo: String
|
||||||
|
get() = "OK"
|
||||||
|
|
||||||
fun test(): String {
|
fun test(): String {
|
||||||
return 1.foo
|
return 1.foo
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun box(): String {
|
fun box(): String {
|
||||||
return Test().test()
|
return Test().test()
|
||||||
}
|
}
|
||||||
@@ -1,16 +1,28 @@
|
|||||||
class Test {
|
class Test {
|
||||||
var Double.fooDouble: String = "fail"
|
var doubleStorage = "fail"
|
||||||
var Long.fooLong: String = "fail"
|
var longStorage = "fail"
|
||||||
|
|
||||||
fun test(): String {
|
var Double.foo: String
|
||||||
val d = 1.0
|
get() = doubleStorage
|
||||||
d.fooDouble = "O"
|
set(value) {
|
||||||
val l = 1.toLong()
|
doubleStorage = value
|
||||||
l.fooLong = "K"
|
}
|
||||||
return d.fooDouble + l.fooLong
|
|
||||||
}
|
var Long.bar: String
|
||||||
|
get() = longStorage
|
||||||
|
set(value) {
|
||||||
|
longStorage = value
|
||||||
|
}
|
||||||
|
|
||||||
|
fun test(): String {
|
||||||
|
val d = 1.0
|
||||||
|
d.foo = "O"
|
||||||
|
val l = 1L
|
||||||
|
l.bar = "K"
|
||||||
|
return d.foo + l.bar
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun box(): String {
|
fun box(): String {
|
||||||
return Test().test()
|
return Test().test()
|
||||||
}
|
}
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
class Test {
|
|
||||||
var Int.foo: String = "fail"
|
|
||||||
|
|
||||||
fun test(): String {
|
|
||||||
val i = 1
|
|
||||||
i.foo = "OK"
|
|
||||||
return i.foo
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fun box(): String {
|
|
||||||
return Test().test()
|
|
||||||
}
|
|
||||||
@@ -1,15 +1,14 @@
|
|||||||
class Test {
|
class Test {
|
||||||
val Int.foo: String = "OK"
|
val Int.foo: String
|
||||||
get() {
|
get() {
|
||||||
val a = $foo
|
return "OK"
|
||||||
return "OK"
|
}
|
||||||
}
|
|
||||||
|
|
||||||
fun test(): String {
|
fun test(): String {
|
||||||
return 1.foo
|
return 1.foo
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun box(): String {
|
fun box(): String {
|
||||||
return Test().test()
|
return Test().test()
|
||||||
}
|
}
|
||||||
@@ -1,15 +1,14 @@
|
|||||||
class Test {
|
class Test {
|
||||||
private val Int.foo: String = "OK"
|
private val Int.foo: String
|
||||||
get() {
|
get() {
|
||||||
val a = $foo
|
return "OK"
|
||||||
return "OK"
|
}
|
||||||
}
|
|
||||||
|
|
||||||
fun test(): String {
|
fun test(): String {
|
||||||
return 1.foo
|
return 1.foo
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun box(): String {
|
fun box(): String {
|
||||||
return Test().test()
|
return Test().test()
|
||||||
}
|
}
|
||||||
@@ -1,16 +1,19 @@
|
|||||||
class Test {
|
class Test {
|
||||||
var Int.foo: String = "OK"
|
var storage = "Fail"
|
||||||
private set(str: String) {
|
|
||||||
$foo = str
|
|
||||||
}
|
|
||||||
|
|
||||||
fun test(): String {
|
var Int.foo: String
|
||||||
val i = 1
|
get() = storage
|
||||||
i.foo = "OK"
|
private set(str: String) {
|
||||||
return i.foo
|
storage = str
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun test(): String {
|
||||||
|
val i = 1
|
||||||
|
i.foo = "OK"
|
||||||
|
return i.foo
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun box(): String {
|
fun box(): String {
|
||||||
return Test().test()
|
return Test().test()
|
||||||
}
|
}
|
||||||
@@ -1,16 +1,19 @@
|
|||||||
class Test {
|
class Test {
|
||||||
var Int.foo: String = "fail"
|
var storage = "Fail"
|
||||||
set(str: String) {
|
|
||||||
$foo = str
|
|
||||||
}
|
|
||||||
|
|
||||||
fun test(): String {
|
var Int.foo: String
|
||||||
val i = 1
|
get() = storage
|
||||||
i.foo = "OK"
|
set(value) {
|
||||||
return i.foo
|
storage = value
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun test(): String {
|
||||||
|
val i = 1
|
||||||
|
i.foo = "OK"
|
||||||
|
return i.foo
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun box(): String {
|
fun box(): String {
|
||||||
return Test().test()
|
return Test().test()
|
||||||
}
|
}
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
val Int.foo: String = "OK"
|
val Int.foo: String
|
||||||
|
get() = "OK"
|
||||||
|
|
||||||
fun box(): String {
|
fun box(): String {
|
||||||
return 1.foo
|
return 1.foo
|
||||||
}
|
}
|
||||||
@@ -1,10 +1,22 @@
|
|||||||
var Double.fooDouble: String = "fail"
|
var fooStorage = "Fail"
|
||||||
var Long.fooLong: String = "fail"
|
var barStorage = "Fail"
|
||||||
|
|
||||||
|
var Double.foo: String
|
||||||
|
get() = fooStorage
|
||||||
|
set(value) {
|
||||||
|
fooStorage = value
|
||||||
|
}
|
||||||
|
|
||||||
|
var Long.bar: String
|
||||||
|
get() = barStorage
|
||||||
|
set(value) {
|
||||||
|
barStorage = value
|
||||||
|
}
|
||||||
|
|
||||||
fun box(): String {
|
fun box(): String {
|
||||||
val d = 1.0
|
val d = 1.0
|
||||||
d.fooDouble = "O"
|
d.foo = "O"
|
||||||
val l = 1.toLong()
|
val l = 1L
|
||||||
l.fooLong = "K"
|
l.bar = "K"
|
||||||
return d.fooDouble + l.fooLong
|
return d.foo + l.bar
|
||||||
}
|
}
|
||||||
@@ -1,17 +0,0 @@
|
|||||||
var Double.fooDouble: String = "fail"
|
|
||||||
set(str: String) {
|
|
||||||
$fooDouble = str
|
|
||||||
}
|
|
||||||
|
|
||||||
var Long.fooLong: String = "fail"
|
|
||||||
set(str: String) {
|
|
||||||
$fooLong = str
|
|
||||||
}
|
|
||||||
|
|
||||||
fun box(): String {
|
|
||||||
val d = 1.0
|
|
||||||
d.fooDouble = "O"
|
|
||||||
val l = 1.toLong()
|
|
||||||
l.fooLong = "K"
|
|
||||||
return d.fooDouble + l.fooLong
|
|
||||||
}
|
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
val Int.foo: String = "OK"
|
|
||||||
get() {
|
|
||||||
return $foo
|
|
||||||
}
|
|
||||||
|
|
||||||
fun box(): String {
|
|
||||||
return 1.foo
|
|
||||||
}
|
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
var Int.foo: String = "fail"
|
|
||||||
set(str: String) {
|
|
||||||
$foo = str
|
|
||||||
}
|
|
||||||
|
|
||||||
fun box(): String {
|
|
||||||
val i = 1
|
|
||||||
i.foo = "OK"
|
|
||||||
return i.foo
|
|
||||||
}
|
|
||||||
@@ -1,18 +0,0 @@
|
|||||||
class A { }
|
|
||||||
class B { }
|
|
||||||
|
|
||||||
public val A.prop: Int = 0;
|
|
||||||
public val B.prop: String = "1111";
|
|
||||||
public val prop: Double = 0.1;
|
|
||||||
|
|
||||||
public fun doTest() : String {
|
|
||||||
if (A().prop != 0) return "fail1"
|
|
||||||
if (B().prop != "1111") return "fail2"
|
|
||||||
if (prop != 0.1) return "fail3"
|
|
||||||
|
|
||||||
return "OK"
|
|
||||||
}
|
|
||||||
|
|
||||||
fun box() : String {
|
|
||||||
return doTest()
|
|
||||||
}
|
|
||||||
@@ -1,22 +0,0 @@
|
|||||||
class A { }
|
|
||||||
class B { }
|
|
||||||
|
|
||||||
class Test {
|
|
||||||
|
|
||||||
public val A.prop: Int = 0;
|
|
||||||
public val B.prop: String = "1111";
|
|
||||||
public val prop: Double = 0.1;
|
|
||||||
|
|
||||||
public fun doTest() : String {
|
|
||||||
if (A().prop != 0) return "fail1"
|
|
||||||
if (B().prop != "1111") return "fail2"
|
|
||||||
if (prop != 0.1) return "fail3"
|
|
||||||
|
|
||||||
return "OK"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
fun box() : String {
|
|
||||||
return Test().doTest()
|
|
||||||
}
|
|
||||||
@@ -9,10 +9,10 @@ class B {
|
|||||||
}
|
}
|
||||||
|
|
||||||
open class C
|
open class C
|
||||||
val C.attr = A()
|
val C.attr: A get() = A()
|
||||||
|
|
||||||
open class D: C()
|
open class D: C()
|
||||||
val D.attr = B()
|
val D.attr: B get() = B()
|
||||||
|
|
||||||
|
|
||||||
fun box(): String {
|
fun box(): String {
|
||||||
|
|||||||
@@ -3,27 +3,9 @@ val Int.getter: Int
|
|||||||
return this@getter
|
return this@getter
|
||||||
}
|
}
|
||||||
|
|
||||||
var Int.setter1: Int = 2
|
|
||||||
get() {
|
|
||||||
return this@setter1
|
|
||||||
}
|
|
||||||
set(i: Int) {
|
|
||||||
$setter1 = this@setter1
|
|
||||||
}
|
|
||||||
|
|
||||||
var Int.setter2: Int = 2
|
|
||||||
set(i: Int) {
|
|
||||||
$setter2 = this@setter2
|
|
||||||
}
|
|
||||||
|
|
||||||
fun box(): String {
|
fun box(): String {
|
||||||
val i = 1
|
val i = 1
|
||||||
if (i.getter != 1) return "getter failed"
|
if (i.getter != 1) return "getter failed"
|
||||||
|
|
||||||
i.setter1 = 2
|
|
||||||
if (i.setter1 != 1) return "setter1 failed"
|
|
||||||
i.setter2 = 2
|
|
||||||
if (i.setter2 != 1) return "setter2 failed"
|
|
||||||
|
|
||||||
return "OK"
|
return "OK"
|
||||||
}
|
}
|
||||||
@@ -5,19 +5,9 @@ val Int.getter: Int
|
|||||||
}.invoke()
|
}.invoke()
|
||||||
}
|
}
|
||||||
|
|
||||||
var Int.setter: Int = 1
|
|
||||||
set(i: Int) {
|
|
||||||
$setter = {
|
|
||||||
this@setter
|
|
||||||
}.invoke()
|
|
||||||
}
|
|
||||||
|
|
||||||
fun box(): String {
|
fun box(): String {
|
||||||
val i = 1
|
val i = 1
|
||||||
if (i.getter != 1) return "getter failed"
|
if (i.getter != 1) return "getter failed"
|
||||||
|
|
||||||
i.setter = 2
|
|
||||||
if (i.setter != 1) return "setter failed"
|
|
||||||
|
|
||||||
return "OK"
|
return "OK"
|
||||||
}
|
}
|
||||||
@@ -7,7 +7,8 @@ val Int.getter: Int
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
var Int.setter: Int = 1
|
var Int.setter: Int
|
||||||
|
get() = 1
|
||||||
set(i: Int) {
|
set(i: Int) {
|
||||||
val extFun = { Int.() ->
|
val extFun = { Int.() ->
|
||||||
this@setter
|
this@setter
|
||||||
|
|||||||
@@ -4,50 +4,16 @@ trait Base {
|
|||||||
|
|
||||||
val Int.getter: Int
|
val Int.getter: Int
|
||||||
get() {
|
get() {
|
||||||
return object: Base {
|
return object : Base {
|
||||||
override fun foo(): Int {
|
override fun foo(): Int {
|
||||||
return this@getter
|
return this@getter
|
||||||
}
|
}
|
||||||
}.foo()
|
}.foo()
|
||||||
}
|
}
|
||||||
|
|
||||||
var Int.setter1: Int = 2
|
|
||||||
set(i: Int) {
|
|
||||||
$setter1 = object: Base {
|
|
||||||
override fun foo(): Int {
|
|
||||||
this@setter1
|
|
||||||
return 1
|
|
||||||
}
|
|
||||||
}.foo()
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
var Int.setter2: Int = 2
|
|
||||||
get() {
|
|
||||||
return object: Base {
|
|
||||||
override fun foo(): Int {
|
|
||||||
return this@setter2
|
|
||||||
}
|
|
||||||
}.foo()
|
|
||||||
}
|
|
||||||
set(i: Int) {
|
|
||||||
$setter2 = object: Base {
|
|
||||||
override fun foo(): Int {
|
|
||||||
this@setter2
|
|
||||||
return 1
|
|
||||||
}
|
|
||||||
}.foo()
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
fun box(): String {
|
fun box(): String {
|
||||||
val i = 1
|
val i = 1
|
||||||
if (i.getter != 1) return "getter failed"
|
if (i.getter != 1) return "getter failed"
|
||||||
|
|
||||||
i.setter1 = 2
|
|
||||||
if (i.setter1 != 1) return "setter1 failed"
|
|
||||||
i.setter2 = 2
|
|
||||||
if (i.setter2 != 1) return "setter2 failed"
|
|
||||||
|
|
||||||
return "OK"
|
return "OK"
|
||||||
}
|
}
|
||||||
@@ -2,7 +2,7 @@ package As
|
|||||||
|
|
||||||
val staticProperty : String = "1"
|
val staticProperty : String = "1"
|
||||||
|
|
||||||
val String.staticExt = "1"
|
val String.staticExt: String get() = "1"
|
||||||
|
|
||||||
open class A(val init: String) {
|
open class A(val init: String) {
|
||||||
|
|
||||||
@@ -10,7 +10,7 @@ open class A(val init: String) {
|
|||||||
|
|
||||||
private val privateProperty : String = init
|
private val privateProperty : String = init
|
||||||
|
|
||||||
val String.ext = "1"
|
val String.ext: String get() = "1"
|
||||||
|
|
||||||
val Int.myInc : Int
|
val Int.myInc : Int
|
||||||
get() = this + 1
|
get() = this + 1
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
val Int.ext : () -> Int = { 5 }
|
val Int.ext: () -> Int get() = { 5 }
|
||||||
val Long.ext : Long = 4.ext().toLong() //(c.kt:4)
|
val Long.ext: Long get() = 4.ext().toLong() //(c.kt:4)
|
||||||
val y : Long = 10.toLong().ext
|
val y: Long get() = 10L.ext
|
||||||
|
|
||||||
fun box() : String = if (y == 5.toLong()) "OK" else "fail"
|
fun box(): String = if (y == 5L) "OK" else "fail: $y"
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
val Int.test = "test"
|
val Int.test: String get() = "test"
|
||||||
|
|
||||||
fun box(): String {
|
fun box(): String {
|
||||||
val x = "a ${1.test}"
|
val x = "a ${1.test}"
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ enum class E {
|
|||||||
entry
|
entry
|
||||||
}
|
}
|
||||||
|
|
||||||
val Int.entry = 42
|
val Int.entry: Int get() = 42
|
||||||
val Long.entry = 239
|
val Long.entry: Int get() = 239
|
||||||
|
|
||||||
val e = E.entry
|
val e = E.entry
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
package outer
|
package outer
|
||||||
|
|
||||||
fun Int?.optint() : Unit {}
|
fun Int?.optint() : Unit {}
|
||||||
val Int?.optval : Unit = Unit.VALUE
|
val Int?.optval : Unit get() = Unit.VALUE
|
||||||
|
|
||||||
fun <T: Any, E> T.foo(<!UNUSED_PARAMETER!>x<!> : E, y : A) : T {
|
fun <T: Any, E> T.foo(<!UNUSED_PARAMETER!>x<!> : E, y : A) : T {
|
||||||
y.plus(1)
|
y.plus(1)
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
//KT-819 Redeclaration error for extension properties with the same name and different receivers
|
//KT-819 Redeclaration error for extension properties with the same name and different receivers
|
||||||
|
|
||||||
import java.io.*
|
import java.io.*
|
||||||
@@ -15,16 +14,20 @@ open class A() {
|
|||||||
open fun String.foo() {}
|
open fun String.foo() {}
|
||||||
open fun Int.foo() {}
|
open fun Int.foo() {}
|
||||||
|
|
||||||
open val String.foo = 0
|
open val String.foo: Int
|
||||||
open val Int.foo = 1
|
get() = 0
|
||||||
|
open val Int.foo: Int
|
||||||
|
get() = 1
|
||||||
}
|
}
|
||||||
|
|
||||||
class B() : A() {
|
class B() : A() {
|
||||||
override fun String.foo() {}
|
override fun String.foo() {}
|
||||||
override fun Int.foo() {}
|
override fun Int.foo() {}
|
||||||
|
|
||||||
override val String.foo = 0
|
override val String.foo: Int
|
||||||
override val Int.foo = 0
|
get() = 0
|
||||||
|
override val Int.foo: Int
|
||||||
|
get() = 0
|
||||||
|
|
||||||
fun use(s: String) {
|
fun use(s: String) {
|
||||||
s.foo
|
s.foo
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
object O
|
object O
|
||||||
|
|
||||||
fun Any.foo() = 42
|
fun Any.foo() = 42
|
||||||
val Any?.bar = 239
|
val Any?.bar: Int get() = 239
|
||||||
|
|
||||||
val x = O.foo() + O.bar
|
val x = O.foo() + O.bar
|
||||||
|
|||||||
@@ -10,4 +10,5 @@ object A {
|
|||||||
|
|
||||||
class B
|
class B
|
||||||
|
|
||||||
val B.c : String = "test"
|
val B.c : String
|
||||||
|
get() = "test"
|
||||||
|
|||||||
+2
-2
@@ -1,4 +1,4 @@
|
|||||||
package foo
|
package foo
|
||||||
|
|
||||||
val Int.<!REDECLARATION!>foo<!> = 2
|
val Int.<!REDECLARATION!>foo<!>: Int get() = 2
|
||||||
val Int.<!REDECLARATION!>foo<!> = 3
|
val Int.<!REDECLARATION!>foo<!>: Int get() = 3
|
||||||
|
|||||||
@@ -26,5 +26,5 @@ class C {
|
|||||||
|
|
||||||
//KT-1728 Can't invoke extension property as a function
|
//KT-1728 Can't invoke extension property as a function
|
||||||
|
|
||||||
val Int.ext : () -> Int = { 5 }
|
val Int.ext : () -> Int get() = { 5 }
|
||||||
val x = 1.ext()
|
val x = 1.ext()
|
||||||
@@ -24,7 +24,8 @@ fun test(a: A) {
|
|||||||
//variable as extension
|
//variable as extension
|
||||||
trait B {
|
trait B {
|
||||||
}
|
}
|
||||||
val B.foo = Foo()
|
val B.foo: Foo
|
||||||
|
get() = Foo()
|
||||||
|
|
||||||
fun test(b: B) {
|
fun test(b: B) {
|
||||||
b.foo()
|
b.foo()
|
||||||
|
|||||||
@@ -22,7 +22,8 @@ fun test(a: A) {
|
|||||||
|
|
||||||
//variable as extension
|
//variable as extension
|
||||||
trait B {}
|
trait B {}
|
||||||
val B.foo = Foo()
|
val B.foo: Foo
|
||||||
|
get() = Foo()
|
||||||
|
|
||||||
|
|
||||||
fun test(b: B) {
|
fun test(b: B) {
|
||||||
|
|||||||
@@ -40,7 +40,8 @@ fun test(c: C, b: B) {
|
|||||||
//variable as extension,
|
//variable as extension,
|
||||||
trait D {
|
trait D {
|
||||||
}
|
}
|
||||||
val D.foo = Foo()
|
val D.foo: Foo
|
||||||
|
get() = Foo()
|
||||||
|
|
||||||
class E {
|
class E {
|
||||||
fun Foo.invoke() {}
|
fun Foo.invoke() {}
|
||||||
|
|||||||
@@ -10,10 +10,12 @@ class B {
|
|||||||
}
|
}
|
||||||
|
|
||||||
open class C
|
open class C
|
||||||
val C.attr = A()
|
val C.attr: A
|
||||||
|
get() = A()
|
||||||
|
|
||||||
open class D: C()
|
open class D: C()
|
||||||
val D.attr = B()
|
val D.attr: B
|
||||||
|
get() = B()
|
||||||
|
|
||||||
|
|
||||||
fun main(args: Array<String>) {
|
fun main(args: Array<String>) {
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
package i
|
package i
|
||||||
|
|
||||||
val <T> List<T>.length = <!UNRESOLVED_REFERENCE!>size<!>()
|
val <T> List<T>.length = <!EXTENSION_PROPERTY_WITH_BACKING_FIELD!><!UNRESOLVED_REFERENCE!>size<!>()<!>
|
||||||
|
|
||||||
val <T> List<T>.length1 : Int get() = size()
|
val <T> List<T>.length1 : Int get() = size()
|
||||||
|
|
||||||
val String.bd = <!NO_THIS!>this<!> <!DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE!>+<!> "!"
|
val String.bd = <!EXTENSION_PROPERTY_WITH_BACKING_FIELD!><!NO_THIS!>this<!> <!DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE!>+<!> "!"<!>
|
||||||
|
|
||||||
val String.bd1 : String get() = this + "!"
|
val String.bd1 : String get() = this + "!"
|
||||||
|
|
||||||
@@ -13,7 +13,7 @@ class A {
|
|||||||
val ii : Int = 1
|
val ii : Int = 1
|
||||||
}
|
}
|
||||||
|
|
||||||
val A.foo = <!UNRESOLVED_REFERENCE!>ii<!>
|
val A.foo = <!UNRESOLVED_REFERENCE, EXTENSION_PROPERTY_WITH_BACKING_FIELD!>ii<!>
|
||||||
|
|
||||||
val A.foo1 : Int get() = ii
|
val A.foo1 : Int get() = ii
|
||||||
|
|
||||||
@@ -22,8 +22,8 @@ class C {
|
|||||||
inner class D {}
|
inner class D {}
|
||||||
}
|
}
|
||||||
|
|
||||||
val C.foo : C.D = <!UNRESOLVED_REFERENCE!>D<!>()
|
val C.foo : C.D = <!EXTENSION_PROPERTY_WITH_BACKING_FIELD!><!UNRESOLVED_REFERENCE!>D<!>()<!>
|
||||||
|
|
||||||
val C.bar : C.D = C().D()
|
val C.bar : C.D = <!EXTENSION_PROPERTY_WITH_BACKING_FIELD!>C().D()<!>
|
||||||
|
|
||||||
val C.foo1 : C.D get() = D()
|
val C.foo1 : C.D get() = D()
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
trait Base {
|
trait Base {
|
||||||
fun foo()
|
fun foo()
|
||||||
}
|
}
|
||||||
val String.test: Base = object: Base {
|
val String.test: Base = <!EXTENSION_PROPERTY_WITH_BACKING_FIELD!>object: Base<!> {
|
||||||
override fun foo() {
|
override fun foo() {
|
||||||
this<!UNRESOLVED_REFERENCE!>@test<!>
|
this<!UNRESOLVED_REFERENCE!>@test<!>
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
package test
|
package test
|
||||||
|
|
||||||
val Long.date1: Object = java.util.Date()
|
val Long.date1: Any get() = java.util.Date()
|
||||||
|
|
||||||
internal val Long.date12: Object = java.util.Date()
|
internal val Long.date12: Any get() = java.util.Date()
|
||||||
|
|
||||||
private val Long.date3: java.util.Date = java.util.Date()
|
private val Long.date3: java.util.Date get() = java.util.Date()
|
||||||
|
|
||||||
public val Long.date4: java.util.Date = java.util.Date()
|
public val Long.date4: java.util.Date get() = java.util.Date()
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
package test
|
package test
|
||||||
|
|
||||||
internal val kotlin.Long.date1: java.lang.Object
|
internal val kotlin.Long.date1: kotlin.Any
|
||||||
internal fun kotlin.Long.<get-date1>(): java.lang.Object
|
internal fun kotlin.Long.<get-date1>(): kotlin.Any
|
||||||
internal val kotlin.Long.date12: java.lang.Object
|
internal val kotlin.Long.date12: kotlin.Any
|
||||||
internal fun kotlin.Long.<get-date12>(): java.lang.Object
|
internal fun kotlin.Long.<get-date12>(): kotlin.Any
|
||||||
private val kotlin.Long.date3: java.util.Date
|
private val kotlin.Long.date3: java.util.Date
|
||||||
private fun kotlin.Long.<get-date3>(): java.util.Date
|
private fun kotlin.Long.<get-date3>(): java.util.Date
|
||||||
public val kotlin.Long.date4: java.util.Date
|
public val kotlin.Long.date4: java.util.Date
|
||||||
|
|||||||
@@ -1,9 +1,28 @@
|
|||||||
package test
|
package test
|
||||||
|
|
||||||
var Long.date1: Object = java.util.Date()
|
var Long.date1: Any get() = java.util.Date()
|
||||||
|
set(value) {}
|
||||||
|
|
||||||
internal var Long.date12: Object = java.util.Date()
|
var Long.date2: Any get() = java.util.Date()
|
||||||
|
protected set(value) {}
|
||||||
|
|
||||||
private var Long.date3: java.util.Date = java.util.Date()
|
var Long.date3: Any get() = java.util.Date()
|
||||||
|
private set(value) {}
|
||||||
|
|
||||||
public var Long.date5: java.util.Date = java.util.Date()
|
private var Long.date4: java.util.Date get() = java.util.Date()
|
||||||
|
set(value) {}
|
||||||
|
|
||||||
|
public var Long.date7: java.util.Date get() = java.util.Date()
|
||||||
|
set(value) {}
|
||||||
|
|
||||||
|
public var Long.date8: java.util.Date get() = java.util.Date()
|
||||||
|
internal set(value) {}
|
||||||
|
|
||||||
|
public var Long.date9: java.util.Date get() = java.util.Date()
|
||||||
|
private set(value) {}
|
||||||
|
|
||||||
|
public var Long.date10: java.util.Date get() = java.util.Date()
|
||||||
|
protected set(value) {}
|
||||||
|
|
||||||
|
public var Long.date11: java.util.Date get() = java.util.Date()
|
||||||
|
public set(value) {}
|
||||||
|
|||||||
@@ -1,14 +1,29 @@
|
|||||||
package test
|
package test
|
||||||
|
|
||||||
internal var kotlin.Long.date1: java.lang.Object
|
internal var kotlin.Long.date1: kotlin.Any
|
||||||
internal fun kotlin.Long.<get-date1>(): java.lang.Object
|
internal fun kotlin.Long.<get-date1>(): kotlin.Any
|
||||||
internal fun kotlin.Long.<set-date1>(/*0*/ <set-?>: java.lang.Object): kotlin.Unit
|
internal fun kotlin.Long.<set-date1>(/*0*/ value: kotlin.Any): kotlin.Unit
|
||||||
internal var kotlin.Long.date12: java.lang.Object
|
public var kotlin.Long.date10: java.util.Date
|
||||||
internal fun kotlin.Long.<get-date12>(): java.lang.Object
|
public fun kotlin.Long.<get-date10>(): java.util.Date
|
||||||
internal fun kotlin.Long.<set-date12>(/*0*/ <set-?>: java.lang.Object): kotlin.Unit
|
protected fun kotlin.Long.<set-date10>(/*0*/ value: java.util.Date): kotlin.Unit
|
||||||
private var kotlin.Long.date3: java.util.Date
|
public var kotlin.Long.date11: java.util.Date
|
||||||
private fun kotlin.Long.<get-date3>(): java.util.Date
|
public fun kotlin.Long.<get-date11>(): java.util.Date
|
||||||
private fun kotlin.Long.<set-date3>(/*0*/ <set-?>: java.util.Date): kotlin.Unit
|
public fun kotlin.Long.<set-date11>(/*0*/ value: java.util.Date): kotlin.Unit
|
||||||
public var kotlin.Long.date5: java.util.Date
|
internal var kotlin.Long.date2: kotlin.Any
|
||||||
public fun kotlin.Long.<get-date5>(): java.util.Date
|
internal fun kotlin.Long.<get-date2>(): kotlin.Any
|
||||||
public fun kotlin.Long.<set-date5>(/*0*/ <set-?>: java.util.Date): kotlin.Unit
|
protected fun kotlin.Long.<set-date2>(/*0*/ value: kotlin.Any): kotlin.Unit
|
||||||
|
internal var kotlin.Long.date3: kotlin.Any
|
||||||
|
internal fun kotlin.Long.<get-date3>(): kotlin.Any
|
||||||
|
private fun kotlin.Long.<set-date3>(/*0*/ value: kotlin.Any): kotlin.Unit
|
||||||
|
private var kotlin.Long.date4: java.util.Date
|
||||||
|
private fun kotlin.Long.<get-date4>(): java.util.Date
|
||||||
|
private fun kotlin.Long.<set-date4>(/*0*/ value: java.util.Date): kotlin.Unit
|
||||||
|
public var kotlin.Long.date7: java.util.Date
|
||||||
|
public fun kotlin.Long.<get-date7>(): java.util.Date
|
||||||
|
public fun kotlin.Long.<set-date7>(/*0*/ value: java.util.Date): kotlin.Unit
|
||||||
|
public var kotlin.Long.date8: java.util.Date
|
||||||
|
public fun kotlin.Long.<get-date8>(): java.util.Date
|
||||||
|
internal fun kotlin.Long.<set-date8>(/*0*/ value: java.util.Date): kotlin.Unit
|
||||||
|
public var kotlin.Long.date9: java.util.Date
|
||||||
|
public fun kotlin.Long.<get-date9>(): java.util.Date
|
||||||
|
private fun kotlin.Long.<set-date9>(/*0*/ value: java.util.Date): kotlin.Unit
|
||||||
|
|||||||
@@ -1,28 +0,0 @@
|
|||||||
package test
|
|
||||||
|
|
||||||
var Long.date1: Object = java.util.Date()
|
|
||||||
set
|
|
||||||
|
|
||||||
var Long.date2: Object = java.util.Date()
|
|
||||||
protected set
|
|
||||||
|
|
||||||
var Long.date3: Object = java.util.Date()
|
|
||||||
private set
|
|
||||||
|
|
||||||
private var Long.date4: java.util.Date = java.util.Date()
|
|
||||||
set
|
|
||||||
|
|
||||||
public var Long.date7: java.util.Date = java.util.Date()
|
|
||||||
set
|
|
||||||
|
|
||||||
public var Long.date8: java.util.Date = java.util.Date()
|
|
||||||
internal set
|
|
||||||
|
|
||||||
public var Long.date9: java.util.Date = java.util.Date()
|
|
||||||
private set
|
|
||||||
|
|
||||||
public var Long.date10: java.util.Date = java.util.Date()
|
|
||||||
protected set
|
|
||||||
|
|
||||||
public var Long.date11: java.util.Date = java.util.Date()
|
|
||||||
public set
|
|
||||||
@@ -1,29 +0,0 @@
|
|||||||
package test
|
|
||||||
|
|
||||||
internal var kotlin.Long.date1: java.lang.Object
|
|
||||||
internal fun kotlin.Long.<get-date1>(): java.lang.Object
|
|
||||||
internal fun kotlin.Long.<set-date1>(/*0*/ <set-?>: java.lang.Object): kotlin.Unit
|
|
||||||
public var kotlin.Long.date10: java.util.Date
|
|
||||||
public fun kotlin.Long.<get-date10>(): java.util.Date
|
|
||||||
protected fun kotlin.Long.<set-date10>(/*0*/ <set-?>: java.util.Date): kotlin.Unit
|
|
||||||
public var kotlin.Long.date11: java.util.Date
|
|
||||||
public fun kotlin.Long.<get-date11>(): java.util.Date
|
|
||||||
public fun kotlin.Long.<set-date11>(/*0*/ <set-?>: java.util.Date): kotlin.Unit
|
|
||||||
internal var kotlin.Long.date2: java.lang.Object
|
|
||||||
internal fun kotlin.Long.<get-date2>(): java.lang.Object
|
|
||||||
protected fun kotlin.Long.<set-date2>(/*0*/ <set-?>: java.lang.Object): kotlin.Unit
|
|
||||||
internal var kotlin.Long.date3: java.lang.Object
|
|
||||||
internal fun kotlin.Long.<get-date3>(): java.lang.Object
|
|
||||||
private fun kotlin.Long.<set-date3>(/*0*/ <set-?>: java.lang.Object): kotlin.Unit
|
|
||||||
private var kotlin.Long.date4: java.util.Date
|
|
||||||
private fun kotlin.Long.<get-date4>(): java.util.Date
|
|
||||||
private fun kotlin.Long.<set-date4>(/*0*/ <set-?>: java.util.Date): kotlin.Unit
|
|
||||||
public var kotlin.Long.date7: java.util.Date
|
|
||||||
public fun kotlin.Long.<get-date7>(): java.util.Date
|
|
||||||
public fun kotlin.Long.<set-date7>(/*0*/ <set-?>: java.util.Date): kotlin.Unit
|
|
||||||
public var kotlin.Long.date8: java.util.Date
|
|
||||||
public fun kotlin.Long.<get-date8>(): java.util.Date
|
|
||||||
internal fun kotlin.Long.<set-date8>(/*0*/ <set-?>: java.util.Date): kotlin.Unit
|
|
||||||
public var kotlin.Long.date9: java.util.Date
|
|
||||||
public fun kotlin.Long.<get-date9>(): java.util.Date
|
|
||||||
private fun kotlin.Long.<set-date9>(/*0*/ <set-?>: java.util.Date): kotlin.Unit
|
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
class Test {
|
|
||||||
class object {
|
|
||||||
public val Test.prop: Int = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// TESTED_OBJECT_KIND: property
|
|
||||||
// TESTED_OBJECTS: Test, prop$ext
|
|
||||||
// FLAGS: ACC_FINAL, ACC_STATIC, ACC_PRIVATE
|
|
||||||
|
|
||||||
// TESTED_OBJECT_KIND: property
|
|
||||||
// TESTED_OBJECTS: Test$object, prop$ext
|
|
||||||
// ABSENT: TRUE
|
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
class Test {
|
|
||||||
class object {
|
|
||||||
public var Test.prop: Int = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// TESTED_OBJECT_KIND: property
|
|
||||||
// TESTED_OBJECTS: Test, prop$ext
|
|
||||||
// FLAGS: ACC_STATIC, ACC_PRIVATE
|
|
||||||
|
|
||||||
// TESTED_OBJECT_KIND: property
|
|
||||||
// TESTED_OBJECTS: Test$object, prop$ext
|
|
||||||
// ABSENT: TRUE
|
|
||||||
@@ -1,18 +0,0 @@
|
|||||||
class A { }
|
|
||||||
class B { }
|
|
||||||
|
|
||||||
class Test {
|
|
||||||
|
|
||||||
class object {
|
|
||||||
public val A.prop: Int = 0;
|
|
||||||
public val B.prop: Int = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// TESTED_OBJECT_KIND: property
|
|
||||||
// TESTED_OBJECTS: Test, prop$ext
|
|
||||||
// FLAGS: ACC_PRIVATE, ACC_FINAL, ACC_STATIC
|
|
||||||
|
|
||||||
// TESTED_OBJECT_KIND: property
|
|
||||||
// TESTED_OBJECTS: Test, prop$ext$1
|
|
||||||
// FLAGS: ACC_PRIVATE, ACC_FINAL, ACC_STATIC
|
|
||||||
@@ -1,16 +0,0 @@
|
|||||||
class Test {
|
|
||||||
|
|
||||||
public val prop: Int = 0;
|
|
||||||
|
|
||||||
class object {
|
|
||||||
public var Test.prop: Int = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// TESTED_OBJECT_KIND: property
|
|
||||||
// TESTED_OBJECTS: Test, prop
|
|
||||||
// FLAGS: ACC_PRIVATE, ACC_FINAL
|
|
||||||
|
|
||||||
// TESTED_OBJECT_KIND: property
|
|
||||||
// TESTED_OBJECTS: Test, prop$ext
|
|
||||||
// FLAGS: ACC_STATIC, ACC_PRIVATE
|
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
trait Test {
|
|
||||||
class object {
|
|
||||||
public val Test.prop: Int = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// TESTED_OBJECT_KIND: property
|
|
||||||
// TESTED_OBJECTS: Test, prop$ext
|
|
||||||
// ABSENT: TRUE
|
|
||||||
|
|
||||||
// TESTED_OBJECT_KIND: property
|
|
||||||
// TESTED_OBJECTS: Test$object, prop$ext
|
|
||||||
// FLAGS: ACC_FINAL, ACC_PRIVATE
|
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
trait Test {
|
|
||||||
class object {
|
|
||||||
public var Test.prop: Int = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// TESTED_OBJECT_KIND: property
|
|
||||||
// TESTED_OBJECTS: Test, prop$ext
|
|
||||||
// ABSENT: TRUE
|
|
||||||
|
|
||||||
// TESTED_OBJECT_KIND: property
|
|
||||||
// TESTED_OBJECTS: Test$object, prop$ext
|
|
||||||
// FLAGS: ACC_PRIVATE
|
|
||||||
@@ -500,16 +500,6 @@ public class WriteFlagsTestGenerated extends AbstractWriteFlagsTest {
|
|||||||
doTest("compiler/testData/writeFlags/property/classObject/class/delegatedPublicVal.kt");
|
doTest("compiler/testData/writeFlags/property/classObject/class/delegatedPublicVal.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestMetadata("extensionPublicVal.kt")
|
|
||||||
public void testExtensionPublicVal() throws Exception {
|
|
||||||
doTest("compiler/testData/writeFlags/property/classObject/class/extensionPublicVal.kt");
|
|
||||||
}
|
|
||||||
|
|
||||||
@TestMetadata("extensionPublicVar.kt")
|
|
||||||
public void testExtensionPublicVar() throws Exception {
|
|
||||||
doTest("compiler/testData/writeFlags/property/classObject/class/extensionPublicVar.kt");
|
|
||||||
}
|
|
||||||
|
|
||||||
@TestMetadata("internalVal.kt")
|
@TestMetadata("internalVal.kt")
|
||||||
public void testInternalVal() throws Exception {
|
public void testInternalVal() throws Exception {
|
||||||
doTest("compiler/testData/writeFlags/property/classObject/class/internalVal.kt");
|
doTest("compiler/testData/writeFlags/property/classObject/class/internalVal.kt");
|
||||||
@@ -608,16 +598,6 @@ public class WriteFlagsTestGenerated extends AbstractWriteFlagsTest {
|
|||||||
doTest("compiler/testData/writeFlags/property/classObject/rename/delegatedAndProperty.kt");
|
doTest("compiler/testData/writeFlags/property/classObject/rename/delegatedAndProperty.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestMetadata("extensionAndExtension.kt")
|
|
||||||
public void testExtensionAndExtension() throws Exception {
|
|
||||||
doTest("compiler/testData/writeFlags/property/classObject/rename/extensionAndExtension.kt");
|
|
||||||
}
|
|
||||||
|
|
||||||
@TestMetadata("extensionAndProperty.kt")
|
|
||||||
public void testExtensionAndProperty() throws Exception {
|
|
||||||
doTest("compiler/testData/writeFlags/property/classObject/rename/extensionAndProperty.kt");
|
|
||||||
}
|
|
||||||
|
|
||||||
@TestMetadata("propertyAndProperty.kt")
|
@TestMetadata("propertyAndProperty.kt")
|
||||||
public void testPropertyAndProperty() throws Exception {
|
public void testPropertyAndProperty() throws Exception {
|
||||||
doTest("compiler/testData/writeFlags/property/classObject/rename/propertyAndProperty.kt");
|
doTest("compiler/testData/writeFlags/property/classObject/rename/propertyAndProperty.kt");
|
||||||
@@ -641,16 +621,6 @@ public class WriteFlagsTestGenerated extends AbstractWriteFlagsTest {
|
|||||||
doTest("compiler/testData/writeFlags/property/classObject/trait/delegatedPublicVal.kt");
|
doTest("compiler/testData/writeFlags/property/classObject/trait/delegatedPublicVal.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestMetadata("extensionPublicVal.kt")
|
|
||||||
public void testExtensionPublicVal() throws Exception {
|
|
||||||
doTest("compiler/testData/writeFlags/property/classObject/trait/extensionPublicVal.kt");
|
|
||||||
}
|
|
||||||
|
|
||||||
@TestMetadata("extensionPublicVar.kt")
|
|
||||||
public void testExtensionPublicVar() throws Exception {
|
|
||||||
doTest("compiler/testData/writeFlags/property/classObject/trait/extensionPublicVar.kt");
|
|
||||||
}
|
|
||||||
|
|
||||||
@TestMetadata("internalVal.kt")
|
@TestMetadata("internalVal.kt")
|
||||||
public void testInternalVal() throws Exception {
|
public void testInternalVal() throws Exception {
|
||||||
doTest("compiler/testData/writeFlags/property/classObject/trait/internalVal.kt");
|
doTest("compiler/testData/writeFlags/property/classObject/trait/internalVal.kt");
|
||||||
|
|||||||
+5
-30
@@ -2272,6 +2272,11 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
|
|||||||
|
|
||||||
@TestMetadata("compiler/testData/codegen/box/extensionProperties")
|
@TestMetadata("compiler/testData/codegen/box/extensionProperties")
|
||||||
public static class ExtensionProperties extends AbstractBlackBoxCodegenTest {
|
public static class ExtensionProperties extends AbstractBlackBoxCodegenTest {
|
||||||
|
@TestMetadata("accessorForPrivateSetter.kt")
|
||||||
|
public void testAccessorForPrivateSetter() throws Exception {
|
||||||
|
doTest("compiler/testData/codegen/box/extensionProperties/accessorForPrivateSetter.kt");
|
||||||
|
}
|
||||||
|
|
||||||
public void testAllFilesPresentInExtensionProperties() throws Exception {
|
public void testAllFilesPresentInExtensionProperties() throws Exception {
|
||||||
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.TestsPackage", new File("compiler/testData/codegen/box/extensionProperties"), Pattern.compile("^(.+)\\.kt$"), true);
|
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.TestsPackage", new File("compiler/testData/codegen/box/extensionProperties"), Pattern.compile("^(.+)\\.kt$"), true);
|
||||||
}
|
}
|
||||||
@@ -2286,11 +2291,6 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
|
|||||||
doTest("compiler/testData/codegen/box/extensionProperties/inClassLongTypeInReceiver.kt");
|
doTest("compiler/testData/codegen/box/extensionProperties/inClassLongTypeInReceiver.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestMetadata("inClassWithEmptySetter.kt")
|
|
||||||
public void testInClassWithEmptySetter() throws Exception {
|
|
||||||
doTest("compiler/testData/codegen/box/extensionProperties/inClassWithEmptySetter.kt");
|
|
||||||
}
|
|
||||||
|
|
||||||
@TestMetadata("inClassWithGetter.kt")
|
@TestMetadata("inClassWithGetter.kt")
|
||||||
public void testInClassWithGetter() throws Exception {
|
public void testInClassWithGetter() throws Exception {
|
||||||
doTest("compiler/testData/codegen/box/extensionProperties/inClassWithGetter.kt");
|
doTest("compiler/testData/codegen/box/extensionProperties/inClassWithGetter.kt");
|
||||||
@@ -2321,21 +2321,6 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
|
|||||||
doTest("compiler/testData/codegen/box/extensionProperties/topLevelLongTypeInReceiver.kt");
|
doTest("compiler/testData/codegen/box/extensionProperties/topLevelLongTypeInReceiver.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestMetadata("topLevelSetterLongTypeInReceiver.kt")
|
|
||||||
public void testTopLevelSetterLongTypeInReceiver() throws Exception {
|
|
||||||
doTest("compiler/testData/codegen/box/extensionProperties/topLevelSetterLongTypeInReceiver.kt");
|
|
||||||
}
|
|
||||||
|
|
||||||
@TestMetadata("topLevelWithGetter.kt")
|
|
||||||
public void testTopLevelWithGetter() throws Exception {
|
|
||||||
doTest("compiler/testData/codegen/box/extensionProperties/topLevelWithGetter.kt");
|
|
||||||
}
|
|
||||||
|
|
||||||
@TestMetadata("topLevelWithSetter.kt")
|
|
||||||
public void testTopLevelWithSetter() throws Exception {
|
|
||||||
doTest("compiler/testData/codegen/box/extensionProperties/topLevelWithSetter.kt");
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestMetadata("compiler/testData/codegen/box/fakeOverride")
|
@TestMetadata("compiler/testData/codegen/box/fakeOverride")
|
||||||
@@ -2387,16 +2372,6 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
|
|||||||
doTest("compiler/testData/codegen/box/fieldRename/genericPropertyWithItself.kt");
|
doTest("compiler/testData/codegen/box/fieldRename/genericPropertyWithItself.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestMetadata("inPackage.kt")
|
|
||||||
public void testInPackage() throws Exception {
|
|
||||||
doTest("compiler/testData/codegen/box/fieldRename/inPackage.kt");
|
|
||||||
}
|
|
||||||
|
|
||||||
@TestMetadata("simple.kt")
|
|
||||||
public void testSimple() throws Exception {
|
|
||||||
doTest("compiler/testData/codegen/box/fieldRename/simple.kt");
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestMetadata("compiler/testData/codegen/box/finally")
|
@TestMetadata("compiler/testData/codegen/box/finally")
|
||||||
|
|||||||
@@ -2774,11 +2774,6 @@ public class LoadJavaTestGenerated extends AbstractLoadJavaTest {
|
|||||||
doTestCompiledKotlin("compiler/testData/loadJava/compiledKotlin/prop/defaultAccessors/ExtVarLong.kt");
|
doTestCompiledKotlin("compiler/testData/loadJava/compiledKotlin/prop/defaultAccessors/ExtVarLong.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestMetadata("ExtVarLongWithSet.kt")
|
|
||||||
public void testExtVarLongWithSet() throws Exception {
|
|
||||||
doTestCompiledKotlin("compiler/testData/loadJava/compiledKotlin/prop/defaultAccessors/ExtVarLongWithSet.kt");
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Test innerSuite() {
|
public static Test innerSuite() {
|
||||||
|
|||||||
-5
@@ -1252,11 +1252,6 @@ public class LazyResolveRecursiveComparingTestGenerated extends AbstractLazyReso
|
|||||||
doTestCheckingPrimaryConstructorsAndAccessors("compiler/testData/loadJava/compiledKotlin/prop/defaultAccessors/ExtVarLong.kt");
|
doTestCheckingPrimaryConstructorsAndAccessors("compiler/testData/loadJava/compiledKotlin/prop/defaultAccessors/ExtVarLong.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestMetadata("ExtVarLongWithSet.kt")
|
|
||||||
public void testExtVarLongWithSet() throws Exception {
|
|
||||||
doTestCheckingPrimaryConstructorsAndAccessors("compiler/testData/loadJava/compiledKotlin/prop/defaultAccessors/ExtVarLongWithSet.kt");
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Test innerSuite() {
|
public static Test innerSuite() {
|
||||||
|
|||||||
@@ -50,28 +50,14 @@ public final class JvmAbi {
|
|||||||
return fqName.lastSegmentIs(Name.identifier(CLASS_OBJECT_CLASS_NAME));
|
return fqName.lastSegmentIs(Name.identifier(CLASS_OBJECT_CLASS_NAME));
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
|
||||||
public static String getPropertyDelegateName(@NotNull Name name) {
|
|
||||||
return name.asString() + DELEGATED_PROPERTY_NAME_SUFFIX;
|
|
||||||
}
|
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
public static String getSyntheticMethodNameForAnnotatedProperty(@NotNull Name propertyName) {
|
public static String getSyntheticMethodNameForAnnotatedProperty(@NotNull Name propertyName) {
|
||||||
return propertyName.asString() + ANNOTATED_PROPERTY_METHOD_NAME_SUFFIX;
|
return propertyName.asString() + ANNOTATED_PROPERTY_METHOD_NAME_SUFFIX;
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
public static String getDefaultPropertyName(@NotNull Name propertyName, boolean isDelegated, boolean isExtensionProperty) {
|
public static String getDefaultFieldNameForProperty(@NotNull Name propertyName, boolean isDelegated) {
|
||||||
if (isDelegated) {
|
return isDelegated ? propertyName.asString() + DELEGATED_PROPERTY_NAME_SUFFIX : propertyName.asString();
|
||||||
return getPropertyDelegateName(propertyName);
|
|
||||||
}
|
|
||||||
|
|
||||||
String name = propertyName.asString();
|
|
||||||
if (isExtensionProperty) {
|
|
||||||
name += "$ext";
|
|
||||||
}
|
|
||||||
return name;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private JvmAbi() {
|
private JvmAbi() {
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
fun Int?.optint() : Unit {}
|
fun Int?.optint() : Unit {}
|
||||||
val Int?.optval : Unit = Unit.VALUE
|
val Int?.optval : Unit get() = Unit.VALUE
|
||||||
|
|
||||||
fun <T: Any, E> T.foo(<warning>x</warning> : E, y : A) : T {
|
fun <T: Any, E> T.foo(<warning>x</warning> : E, y : A) : T {
|
||||||
y.plus(1)
|
y.plus(1)
|
||||||
|
|||||||
@@ -25,4 +25,4 @@ object B {
|
|||||||
fun PairParam<<error>T</error>, <error>T</error>>() {}
|
fun PairParam<<error>T</error>, <error>T</error>>() {}
|
||||||
class PParam<<error>T</error>, <error>T</error>> {}
|
class PParam<<error>T</error>, <error>T</error>> {}
|
||||||
|
|
||||||
val <<error>T</error>, <error>T</error>> T.fooParam : Int = 1
|
val <<error>T</error>, <error>T</error>> T.fooParam : Int get() = 1
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ object TestObject {
|
|||||||
}
|
}
|
||||||
|
|
||||||
val testVal = 1
|
val testVal = 1
|
||||||
val Int.testExtVal = 1
|
val Int.testExtVal: Int get() = 1
|
||||||
val testDelVal by Delegate()
|
val testDelVal by Delegate()
|
||||||
|
|
||||||
class Delegate {
|
class Delegate {
|
||||||
|
|||||||
@@ -1252,11 +1252,6 @@ public class LazyResolveByStubTestGenerated extends AbstractLazyResolveByStubTes
|
|||||||
doTestCheckingPrimaryConstructorsAndAccessors("compiler/testData/loadJava/compiledKotlin/prop/defaultAccessors/ExtVarLong.kt");
|
doTestCheckingPrimaryConstructorsAndAccessors("compiler/testData/loadJava/compiledKotlin/prop/defaultAccessors/ExtVarLong.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestMetadata("ExtVarLongWithSet.kt")
|
|
||||||
public void testExtVarLongWithSet() throws Exception {
|
|
||||||
doTestCheckingPrimaryConstructorsAndAccessors("compiler/testData/loadJava/compiledKotlin/prop/defaultAccessors/ExtVarLongWithSet.kt");
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Test innerSuite() {
|
public static Test innerSuite() {
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ native public fun String.match(regex : String) : Array<String> = js.noImpl
|
|||||||
native public fun String.trim() : String = js.noImpl
|
native public fun String.trim() : String = js.noImpl
|
||||||
|
|
||||||
native("length")
|
native("length")
|
||||||
public val CharSequence.size: Int = js.noImpl
|
public val CharSequence.size: Int get() = js.noImpl
|
||||||
|
|
||||||
library
|
library
|
||||||
public fun CharSequence.length(): Int = js.noImpl
|
public fun CharSequence.length(): Int = js.noImpl
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ public fun createDocument(): Document {
|
|||||||
return js.dom.html.document.implementation.createDocument(null, null, null)
|
return js.dom.html.document.implementation.createDocument(null, null, null)
|
||||||
}
|
}
|
||||||
|
|
||||||
native public val Node.outerHTML: String = js.noImpl
|
native public val Node.outerHTML: String get() = js.noImpl
|
||||||
|
|
||||||
/** Converts the node to an XML String */
|
/** Converts the node to an XML String */
|
||||||
public fun Node.toXmlString(): String = this.outerHTML
|
public fun Node.toXmlString(): String = this.outerHTML
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ fun bar(): Any? {
|
|||||||
}
|
}
|
||||||
|
|
||||||
native
|
native
|
||||||
val Exception.message: String = noImpl
|
val Exception.message: String get() = noImpl
|
||||||
|
|
||||||
fun box(): String {
|
fun box(): String {
|
||||||
val a: String? = null
|
val a: String? = null
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ var Test.b: Int
|
|||||||
a = c - 1
|
a = c - 1
|
||||||
}
|
}
|
||||||
|
|
||||||
val Test.d: Int = 44
|
val Test.d: Int get() = 44
|
||||||
|
|
||||||
fun box(): Boolean {
|
fun box(): Boolean {
|
||||||
val c = Test()
|
val c = Test()
|
||||||
|
|||||||
@@ -5,8 +5,8 @@ fun Int.foo() {
|
|||||||
fun String.foo() {
|
fun String.foo() {
|
||||||
}
|
}
|
||||||
|
|
||||||
val Int.bar = 1
|
val Int.bar: Int get() = 1
|
||||||
val String.bar = 2
|
val String.bar: Int get() = 2
|
||||||
|
|
||||||
fun box(): String {
|
fun box(): String {
|
||||||
val a = 43
|
val a = 43
|
||||||
|
|||||||
@@ -9,8 +9,8 @@ native("\"O\"") val foo: String = noImpl
|
|||||||
native("boo") val bar: String = noImpl
|
native("boo") val bar: String = noImpl
|
||||||
|
|
||||||
class A
|
class A
|
||||||
native("__proto__") val Any.proto: String = noImpl
|
native("__proto__") val Any.proto: String get() = noImpl
|
||||||
native("__proto__") val A.proto: String = noImpl
|
native("__proto__") val A.proto: String get() = noImpl
|
||||||
|
|
||||||
fun actual(foo: String, native("boo") bar: String) = foo + bar
|
fun actual(foo: String, native("boo") bar: String) = foo + bar
|
||||||
fun expected(foo: String, boo: String) = foo + boo
|
fun expected(foo: String, boo: String) = foo + boo
|
||||||
|
|||||||
@@ -5,8 +5,8 @@ val PACKAGE = "Kotlin.modules.JS_TESTS.foo"
|
|||||||
native fun eval(e: String): Any? = noImpl
|
native fun eval(e: String): Any? = noImpl
|
||||||
|
|
||||||
class A
|
class A
|
||||||
native val Any.__proto__: String = noImpl
|
native val Any.__proto__: String get() = noImpl
|
||||||
native val A.__proto__: String = noImpl
|
native val A.__proto__: String get() = noImpl
|
||||||
|
|
||||||
fun box(): String {
|
fun box(): String {
|
||||||
val a = A()
|
val a = A()
|
||||||
|
|||||||
@@ -3,9 +3,9 @@ package foo
|
|||||||
class T
|
class T
|
||||||
|
|
||||||
open class A {
|
open class A {
|
||||||
open val T.foo: Int = 34
|
open val T.foo: Int
|
||||||
get() {
|
get() {
|
||||||
return $foo
|
return 34
|
||||||
}
|
}
|
||||||
fun test(): Int {
|
fun test(): Int {
|
||||||
return T().foo
|
return T().foo
|
||||||
@@ -13,7 +13,7 @@ open class A {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class B : A() {
|
class B : A() {
|
||||||
override val T.foo: Int = 5
|
override val T.foo: Int get() = 5
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
package foo
|
package foo
|
||||||
|
|
||||||
native val Exception.message: String = noImpl
|
native val Exception.message: String get() = noImpl
|
||||||
|
|
||||||
public fun <T : Throwable> failsWith(block: () -> Any): T {
|
public fun <T : Throwable> failsWith(block: () -> Any): T {
|
||||||
try {
|
try {
|
||||||
|
|||||||
Reference in New Issue
Block a user