Fix with hack bridge codegen for indexOf and lastIndexOf methods. More sophisticated solution is required.
This commit is contained in:
@@ -887,7 +887,11 @@ public class FunctionCodegen {
|
||||
|
||||
iv.ifne(afterBarrier);
|
||||
|
||||
StackValue.none().put(bridge.getReturnType(), iv);
|
||||
String shortName = getFqName(descriptor).shortName().asString();
|
||||
StackValue returnValue =
|
||||
("indexOf".equals(shortName) || "lastIndexOf".equals(shortName)) ? StackValue.constant(-1, Type.INT_TYPE) : StackValue.none();
|
||||
|
||||
returnValue.put(bridge.getReturnType(), iv);
|
||||
iv.areturn(bridge.getReturnType());
|
||||
|
||||
iv.visitLabel(afterBarrier);
|
||||
|
||||
@@ -32,8 +32,8 @@ public fun <T> CompareContext<List<T>>.listBehavior() {
|
||||
|
||||
propertyFails { this[size()] }
|
||||
|
||||
propertyEquals { indexOf(elementAtOrNull(0)) }
|
||||
propertyEquals { lastIndexOf(elementAtOrNull(0)) }
|
||||
propertyEquals { (this as List<T?>).indexOf(elementAtOrNull(0)) }
|
||||
propertyEquals { (this as List<T?>).lastIndexOf(elementAtOrNull(0)) }
|
||||
|
||||
propertyFails { subList(0, size() + 1)}
|
||||
propertyFails { subList(-1, 0)}
|
||||
|
||||
Reference in New Issue
Block a user