Added a bunch of tests which were omitted because of using ArrayList.
This commit is contained in:
@@ -45,6 +45,7 @@ public final class StandardClasses {
|
|||||||
standardClasses.declareStandardInnerDeclaration(arrayListFQName, "isEmpty", "isEmpty");
|
standardClasses.declareStandardInnerDeclaration(arrayListFQName, "isEmpty", "isEmpty");
|
||||||
standardClasses.declareStandardInnerDeclaration(arrayListFQName, "set", "set");
|
standardClasses.declareStandardInnerDeclaration(arrayListFQName, "set", "set");
|
||||||
standardClasses.declareStandardInnerDeclaration(arrayListFQName, "remove", "remove");
|
standardClasses.declareStandardInnerDeclaration(arrayListFQName, "remove", "remove");
|
||||||
|
standardClasses.declareStandardInnerDeclaration(arrayListFQName, "addAll", "addAll");
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO: more generic ways to declare standard classes
|
//TODO: more generic ways to declare standard classes
|
||||||
|
|||||||
@@ -115,11 +115,12 @@ public final class PropertyAccessTranslator extends AccessTranslator {
|
|||||||
private final PropertyDescriptor propertyDescriptor;
|
private final PropertyDescriptor propertyDescriptor;
|
||||||
private final boolean isBackingFieldAccess;
|
private final boolean isBackingFieldAccess;
|
||||||
|
|
||||||
|
//TODO: make one constructor
|
||||||
private PropertyAccessTranslator(@NotNull JetSimpleNameExpression simpleName,
|
private PropertyAccessTranslator(@NotNull JetSimpleNameExpression simpleName,
|
||||||
@NotNull TranslationContext context) {
|
@NotNull TranslationContext context) {
|
||||||
super(context);
|
super(context);
|
||||||
this.qualifier = null;
|
this.qualifier = null;
|
||||||
this.propertyDescriptor = getPropertyDescriptor(simpleName);
|
this.propertyDescriptor = getPropertyDescriptor(simpleName).getOriginal();
|
||||||
this.isBackingFieldAccess = isBackingFieldReference(simpleName);
|
this.isBackingFieldAccess = isBackingFieldReference(simpleName);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -128,7 +129,7 @@ public final class PropertyAccessTranslator extends AccessTranslator {
|
|||||||
super(context);
|
super(context);
|
||||||
this.qualifier = qualifiedExpression.getReceiverExpression();
|
this.qualifier = qualifiedExpression.getReceiverExpression();
|
||||||
JetSimpleNameExpression selector = getNotNullSelector(qualifiedExpression);
|
JetSimpleNameExpression selector = getNotNullSelector(qualifiedExpression);
|
||||||
this.propertyDescriptor = getPropertyDescriptor(selector);
|
this.propertyDescriptor = getPropertyDescriptor(selector).getOriginal();
|
||||||
this.isBackingFieldAccess = isBackingFieldReference(selector);
|
this.isBackingFieldAccess = isBackingFieldReference(selector);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -136,7 +137,7 @@ public final class PropertyAccessTranslator extends AccessTranslator {
|
|||||||
@NotNull TranslationContext context) {
|
@NotNull TranslationContext context) {
|
||||||
super(context);
|
super(context);
|
||||||
this.qualifier = null;
|
this.qualifier = null;
|
||||||
this.propertyDescriptor = descriptor;
|
this.propertyDescriptor = descriptor.getOriginal();
|
||||||
this.isBackingFieldAccess = false;
|
this.isBackingFieldAccess = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -94,4 +94,9 @@ public class OperatorOverloadingTest extends TranslationTest {
|
|||||||
testFooBoxIsTrue("usingModInCaseModAssignNotAvailable.kt");
|
testFooBoxIsTrue("usingModInCaseModAssignNotAvailable.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void overloadPlusAssignArrayList() throws Exception {
|
||||||
|
testFooBoxIsOk("overloadPlusAssignArrayList.kt");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+4
-1
@@ -10,7 +10,10 @@ class ArrayWrapper<T>() {
|
|||||||
fun minus(): ArrayWrapper<T> {
|
fun minus(): ArrayWrapper<T> {
|
||||||
val result = ArrayWrapper<T>()
|
val result = ArrayWrapper<T>()
|
||||||
result.contents.addAll(contents)
|
result.contents.addAll(contents)
|
||||||
Collections.reverse(result.contents)
|
var i = contents.size();
|
||||||
|
for (a in contents) {
|
||||||
|
result.contents[--i] = a;
|
||||||
|
}
|
||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
class Foo() : java.util.ArrayList<Int>()
|
|
||||||
+2
@@ -1,3 +1,5 @@
|
|||||||
|
namespace foo
|
||||||
|
|
||||||
import java.util.*
|
import java.util.*
|
||||||
|
|
||||||
class ArrayWrapper<T>() {
|
class ArrayWrapper<T>() {
|
||||||
Reference in New Issue
Block a user