replace .sure with !!
This commit is contained in:
@@ -14,5 +14,5 @@ var <T> ArrayList<T>.length : Int
|
|||||||
set(value: Int) = throw java.lang.Error()
|
set(value: Int) = throw java.lang.Error()
|
||||||
|
|
||||||
var <T> ArrayList<T>.last : T
|
var <T> ArrayList<T>.last : T
|
||||||
get() = get(size()-1).sure()
|
get() = get(size()-1)!!
|
||||||
set(el : T) { set(size()-1, el) }
|
set(el : T) { set(size()-1, el) }
|
||||||
|
|||||||
@@ -246,7 +246,7 @@ public class ArrayGenTest extends CodegenTestCase {
|
|||||||
public void testCollectionAssignGetMultiIndex () throws Exception {
|
public void testCollectionAssignGetMultiIndex () throws Exception {
|
||||||
loadText("import java.util.ArrayList\n" +
|
loadText("import java.util.ArrayList\n" +
|
||||||
"fun box() : String { val s = ArrayList<String>(1); s.add(\"\"); s [1, -1] = \"5\"; s[2, -2] += \"7\"; return s[2,-2] }\n" +
|
"fun box() : String { val s = ArrayList<String>(1); s.add(\"\"); s [1, -1] = \"5\"; s[2, -2] += \"7\"; return s[2,-2] }\n" +
|
||||||
"fun ArrayList<String>.get(index1: Int, index2 : Int) = this[index1+index2].sure()\n" +
|
"fun ArrayList<String>.get(index1: Int, index2 : Int) = this[index1+index2]!!\n" +
|
||||||
"fun ArrayList<String>.set(index1: Int, index2 : Int, elem: String) { this[index1+index2] = elem }\n");
|
"fun ArrayList<String>.set(index1: Int, index2 : Int, elem: String) { this[index1+index2] = elem }\n");
|
||||||
// System.out.println(generateToText());
|
// System.out.println(generateToText());
|
||||||
Method foo = generateFunction("box");
|
Method foo = generateFunction("box");
|
||||||
@@ -266,7 +266,7 @@ public class ArrayGenTest extends CodegenTestCase {
|
|||||||
public void testCollectionGetMultiIndex () throws Exception {
|
public void testCollectionGetMultiIndex () throws Exception {
|
||||||
loadText("import java.util.ArrayList\n" +
|
loadText("import java.util.ArrayList\n" +
|
||||||
"fun box() : String { val s = ArrayList<String>(1); s.add(\"\"); s [1, -1] = \"5\"; return s[2, -2] }\n" +
|
"fun box() : String { val s = ArrayList<String>(1); s.add(\"\"); s [1, -1] = \"5\"; return s[2, -2] }\n" +
|
||||||
"fun ArrayList<String>.get(index1: Int, index2 : Int) = this[index1+index2].sure()\n" +
|
"fun ArrayList<String>.get(index1: Int, index2 : Int) = this[index1+index2]!!\n" +
|
||||||
"fun ArrayList<String>.set(index1: Int, index2 : Int, elem: String) { this[index1+index2] = elem }\n");
|
"fun ArrayList<String>.set(index1: Int, index2 : Int, elem: String) { this[index1+index2] = elem }\n");
|
||||||
// System.out.println(generateToText());
|
// System.out.println(generateToText());
|
||||||
Method foo = generateFunction("box");
|
Method foo = generateFunction("box");
|
||||||
|
|||||||
Reference in New Issue
Block a user