Got rid of "tuple" word all over the code.

This commit is contained in:
Evgeny Gerashchenko
2013-03-19 23:43:37 +04:00
parent 0b41436e7a
commit 5ccbce6de6
26 changed files with 35 additions and 50 deletions
@@ -33,7 +33,7 @@ import org.jetbrains.jet.checkers.AbstractDiagnosticsTestWithEagerResolve;
@InnerTestClasses({JetDiagnosticsTestGenerated.Tests.class, JetDiagnosticsTestGenerated.Script.class})
public class JetDiagnosticsTestGenerated extends AbstractDiagnosticsTestWithEagerResolve {
@TestMetadata("compiler/testData/diagnostics/tests")
@InnerTestClasses({Tests.Annotations.class, Tests.BackingField.class, Tests.Cast.class, Tests.CheckArguments.class, Tests.ControlFlowAnalysis.class, Tests.ControlStructures.class, Tests.DataClasses.class, Tests.DataFlow.class, Tests.DataFlowInfoTraversal.class, Tests.DeclarationChecks.class, Tests.Deparenthesize.class, Tests.Enum.class, Tests.Extensions.class, Tests.FunctionLiterals.class, Tests.Generics.class, Tests.IncompleteCode.class, Tests.Inference.class, Tests.Infos.class, Tests.Inner.class, Tests.J_k.class, Tests.Jdk_annotations.class, Tests.Library.class, Tests.NullabilityAndAutoCasts.class, Tests.NullableTypes.class, Tests.Objects.class, Tests.OperatorsOverloading.class, Tests.Overload.class, Tests.Override.class, Tests.Redeclarations.class, Tests.Regressions.class, Tests.Resolve.class, Tests.Scopes.class, Tests.SenselessComparison.class, Tests.Shadowing.class, Tests.SmartCasts.class, Tests.Substitutions.class, Tests.Subtyping.class, Tests.ThisAndSuper.class, Tests.Tuples.class, Tests.Varargs.class})
@InnerTestClasses({Tests.Annotations.class, Tests.BackingField.class, Tests.Cast.class, Tests.CheckArguments.class, Tests.ControlFlowAnalysis.class, Tests.ControlStructures.class, Tests.DataClasses.class, Tests.DataFlow.class, Tests.DataFlowInfoTraversal.class, Tests.DeclarationChecks.class, Tests.Deparenthesize.class, Tests.Enum.class, Tests.Extensions.class, Tests.FunctionLiterals.class, Tests.Generics.class, Tests.IncompleteCode.class, Tests.Inference.class, Tests.Infos.class, Tests.Inner.class, Tests.J_k.class, Tests.Jdk_annotations.class, Tests.Library.class, Tests.NullabilityAndAutoCasts.class, Tests.NullableTypes.class, Tests.Objects.class, Tests.OperatorsOverloading.class, Tests.Overload.class, Tests.Override.class, Tests.Redeclarations.class, Tests.Regressions.class, Tests.Resolve.class, Tests.Scopes.class, Tests.SenselessComparison.class, Tests.Shadowing.class, Tests.SmartCasts.class, Tests.Substitutions.class, Tests.Subtyping.class, Tests.ThisAndSuper.class, Tests.Varargs.class})
public static class Tests extends AbstractDiagnosticsTestWithEagerResolve {
@TestMetadata("Abstract.kt")
public void testAbstract() throws Exception {
@@ -484,6 +484,11 @@ public class JetDiagnosticsTestGenerated extends AbstractDiagnosticsTestWithEage
doTest("compiler/testData/diagnostics/tests/UnitByDefaultForFunctionTypes.kt");
}
@TestMetadata("UnitValue.kt")
public void testUnitValue() throws Exception {
doTest("compiler/testData/diagnostics/tests/UnitValue.kt");
}
@TestMetadata("UnreachableCode.kt")
public void testUnreachableCode() throws Exception {
doTest("compiler/testData/diagnostics/tests/UnreachableCode.kt");
@@ -4359,19 +4364,6 @@ public class JetDiagnosticsTestGenerated extends AbstractDiagnosticsTestWithEage
}
@TestMetadata("compiler/testData/diagnostics/tests/tuples")
public static class Tuples extends AbstractDiagnosticsTestWithEagerResolve {
public void testAllFilesPresentInTuples() throws Exception {
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.GenerateTests", new File("compiler/testData/diagnostics/tests/tuples"), Pattern.compile("^(.+)\\.kt$"), true);
}
@TestMetadata("UnitValue.kt")
public void testUnitValue() throws Exception {
doTest("compiler/testData/diagnostics/tests/tuples/UnitValue.kt");
}
}
@TestMetadata("compiler/testData/diagnostics/tests/varargs")
public static class Varargs extends AbstractDiagnosticsTestWithEagerResolve {
public void testAllFilesPresentInVarargs() throws Exception {
@@ -4476,7 +4468,6 @@ public class JetDiagnosticsTestGenerated extends AbstractDiagnosticsTestWithEage
suite.addTestSuite(Substitutions.class);
suite.addTestSuite(Subtyping.class);
suite.addTestSuite(ThisAndSuper.class);
suite.addTestSuite(Tuples.class);
suite.addTestSuite(Varargs.class);
return suite;
}
@@ -76,9 +76,9 @@ public class LazyResolveDescriptorRendererTestGenerated extends AbstractLazyReso
doTest("compiler/testData/renderer/KeywordsInNames.kt");
}
@TestMetadata("TupleTypes.kt")
public void testTupleTypes() throws Exception {
doTest("compiler/testData/renderer/TupleTypes.kt");
@TestMetadata("UnitType.kt")
public void testUnitType() throws Exception {
doTest("compiler/testData/renderer/UnitType.kt");
}
}
@@ -61,7 +61,7 @@ public class DescriptorRendererTest extends JetLiteFixture {
doTest();
}
public void testTupleTypes() throws IOException {
public void testUnitType() throws IOException {
doTest();
}
+2 -2
View File
@@ -14,10 +14,10 @@ public fun Json.set(paramName : String, value : Any?) : Unit = js.noImpl
library("jsonGet")
public fun Json.get(paramName : String) : Any? = js.noImpl
library("jsonFromTuples")
library("jsonFromPairs")
public fun json(vararg pairs : Pair<String, Any?>) : Json = js.noImpl
library("jsonFromTuples")
library("jsonFromPairs")
public fun json2(pairs : Array<Pair<String, Any?>>) : Json = js.noImpl
library("jsonAddProperties")
+1 -1
View File
@@ -106,7 +106,7 @@ native public fun String.getBytes(charset : java.nio.charset.Charset) : ByteArra
native public fun String.getBytes(charsetName : String) : ByteArray = (this as java.lang.String).getBytes(charsetName)!!
native public fun String.getChars(srcBegin : Int, srcEnd : Int, dst : CharArray, dstBegin : Int) : Tuple0 = (this as java.lang.String).getChars(srcBegin, srcEnd, dst, dstBegin)!!
native public fun String.getChars(srcBegin : Int, srcEnd : Int, dst : CharArray, dstBegin : Int) : Unit = (this as java.lang.String).getChars(srcBegin, srcEnd, dst, dstBegin)!!
native public fun String.intern() : String = (this as java.lang.String).intern()!!
+2 -2
View File
@@ -8,10 +8,10 @@ public fun <K, V> MutableMap<K, V>.set(key : K, value : V): Unit {
}
/**
* Returns a new [[HashMap]] populated with the given tuple values where the first value in each tuple
* Returns a new [[HashMap]] populated with the given pairs where the first value in each pair
* is the key and the second value is the value
*
* @includeFunctionBody ../../test/MapTest.kt createUsingTuples
* @includeFunctionBody ../../test/MapTest.kt createUsingPairs
*/
public inline fun <K,V> hashMap(vararg values: Pair<K,V>): HashMap<K,V> {
val answer = HashMap<K,V>()
+1 -1
View File
@@ -531,7 +531,7 @@ var kotlin = {set:function (receiver, key, value) {
return obj.toString();
};
Kotlin.jsonFromTuples = function (pairArr) {
Kotlin.jsonFromPairs = function (pairArr) {
var i = pairArr.length;
var res = {};
while (i > 0) {
@@ -343,7 +343,7 @@ public trait Traversable<T>: Iterable<T> {
}
/**
* Convert collection of arbitrary elements to collection of tuples of the index and the element
* Convert collection of arbitrary elements to collection of pairs of the index and the element
*
* @includeFunctionBody ../../test/ListTest.kt withIndices
*/
+1 -1
View File
@@ -360,7 +360,7 @@ public inline fun <T> Array<out T>.withIndices() : Iterator<Pair<Int, T>> {
/**
* Copies all elements into a [[List]] and sorts it by value of compare_function(element)
* E.g. arrayList("two" to 2, "one" to 1).sortBy({it._2}) returns list sorted by second element of tuple
* E.g. arrayList("two" to 2, "one" to 1).sortBy({it.second}) returns list sorted by second element of pair
*/
public inline fun <T, R: Comparable<R>> Array<out T>.sortBy(f: (T) -> R) : List<T> {
val sortedList = toCollection(ArrayList<T>())
@@ -333,7 +333,7 @@ public inline fun BooleanArray.withIndices() : Iterator<Pair<Int, Boolean>> {
/**
* Copies all elements into a [[List]] and sorts it by value of compare_function(element)
* E.g. arrayList("two" to 2, "one" to 1).sortBy({it._2}) returns list sorted by second element of tuple
* E.g. arrayList("two" to 2, "one" to 1).sortBy({it.second}) returns list sorted by second element of pair
*/
public inline fun <R: Comparable<R>> BooleanArray.sortBy(f: (Boolean) -> R) : List<Boolean> {
val sortedList = toCollection(ArrayList<Boolean>())
@@ -333,7 +333,7 @@ public inline fun ByteArray.withIndices() : Iterator<Pair<Int, Byte>> {
/**
* Copies all elements into a [[List]] and sorts it by value of compare_function(element)
* E.g. arrayList("two" to 2, "one" to 1).sortBy({it._2}) returns list sorted by second element of tuple
* E.g. arrayList("two" to 2, "one" to 1).sortBy({it.second}) returns list sorted by second element of pair
*/
public inline fun <R: Comparable<R>> ByteArray.sortBy(f: (Byte) -> R) : List<Byte> {
val sortedList = toCollection(ArrayList<Byte>())
@@ -333,7 +333,7 @@ public inline fun CharArray.withIndices() : Iterator<Pair<Int, Char>> {
/**
* Copies all elements into a [[List]] and sorts it by value of compare_function(element)
* E.g. arrayList("two" to 2, "one" to 1).sortBy({it._2}) returns list sorted by second element of tuple
* E.g. arrayList("two" to 2, "one" to 1).sortBy({it.second}) returns list sorted by second element of pair
*/
public inline fun <R: Comparable<R>> CharArray.sortBy(f: (Char) -> R) : List<Char> {
val sortedList = toCollection(ArrayList<Char>())
@@ -333,7 +333,7 @@ public inline fun DoubleArray.withIndices() : Iterator<Pair<Int, Double>> {
/**
* Copies all elements into a [[List]] and sorts it by value of compare_function(element)
* E.g. arrayList("two" to 2, "one" to 1).sortBy({it._2}) returns list sorted by second element of tuple
* E.g. arrayList("two" to 2, "one" to 1).sortBy({it.second}) returns list sorted by second element of pair
*/
public inline fun <R: Comparable<R>> DoubleArray.sortBy(f: (Double) -> R) : List<Double> {
val sortedList = toCollection(ArrayList<Double>())
@@ -333,7 +333,7 @@ public inline fun FloatArray.withIndices() : Iterator<Pair<Int, Float>> {
/**
* Copies all elements into a [[List]] and sorts it by value of compare_function(element)
* E.g. arrayList("two" to 2, "one" to 1).sortBy({it._2}) returns list sorted by second element of tuple
* E.g. arrayList("two" to 2, "one" to 1).sortBy({it.second}) returns list sorted by second element of pair
*/
public inline fun <R: Comparable<R>> FloatArray.sortBy(f: (Float) -> R) : List<Float> {
val sortedList = toCollection(ArrayList<Float>())
+1 -1
View File
@@ -333,7 +333,7 @@ public inline fun IntArray.withIndices() : Iterator<Pair<Int, Int>> {
/**
* Copies all elements into a [[List]] and sorts it by value of compare_function(element)
* E.g. arrayList("two" to 2, "one" to 1).sortBy({it._2}) returns list sorted by second element of tuple
* E.g. arrayList("two" to 2, "one" to 1).sortBy({it.second}) returns list sorted by second element of pair
*/
public inline fun <R: Comparable<R>> IntArray.sortBy(f: (Int) -> R) : List<Int> {
val sortedList = toCollection(ArrayList<Int>())
+1 -1
View File
@@ -245,7 +245,7 @@ public inline fun <T> Iterable<T>.withIndices() : Iterator<Pair<Int, T>> {
/**
* Copies all elements into a [[List]] and sorts it by value of compare_function(element)
* E.g. arrayList("two" to 2, "one" to 1).sortBy({it._2}) returns list sorted by second element of tuple
* E.g. arrayList("two" to 2, "one" to 1).sortBy({it.second}) returns list sorted by second element of pair
*/
public inline fun <T, R: Comparable<R>> Iterable<T>.sortBy(f: (T) -> R) : List<T> {
val sortedList = toCollection(ArrayList<T>())
@@ -245,7 +245,7 @@ public inline fun <T> Iterator<T>.withIndices() : Iterator<Pair<Int, T>> {
/**
* Copies all elements into a [[List]] and sorts it by value of compare_function(element)
* E.g. arrayList("two" to 2, "one" to 1).sortBy({it._2}) returns list sorted by second element of tuple
* E.g. arrayList("two" to 2, "one" to 1).sortBy({it.second}) returns list sorted by second element of pair
*/
public inline fun <T, R: Comparable<R>> Iterator<T>.sortBy(f: (T) -> R) : List<T> {
val sortedList = toCollection(ArrayList<T>())
@@ -333,7 +333,7 @@ public inline fun LongArray.withIndices() : Iterator<Pair<Int, Long>> {
/**
* Copies all elements into a [[List]] and sorts it by value of compare_function(element)
* E.g. arrayList("two" to 2, "one" to 1).sortBy({it._2}) returns list sorted by second element of tuple
* E.g. arrayList("two" to 2, "one" to 1).sortBy({it.second}) returns list sorted by second element of pair
*/
public inline fun <R: Comparable<R>> LongArray.sortBy(f: (Long) -> R) : List<Long> {
val sortedList = toCollection(ArrayList<Long>())
@@ -333,7 +333,7 @@ public inline fun ShortArray.withIndices() : Iterator<Pair<Int, Short>> {
/**
* Copies all elements into a [[List]] and sorts it by value of compare_function(element)
* E.g. arrayList("two" to 2, "one" to 1).sortBy({it._2}) returns list sorted by second element of tuple
* E.g. arrayList("two" to 2, "one" to 1).sortBy({it.second}) returns list sorted by second element of pair
*/
public inline fun <R: Comparable<R>> ShortArray.sortBy(f: (Short) -> R) : List<Short> {
val sortedList = toCollection(ArrayList<Short>())
+4 -4
View File
@@ -46,10 +46,10 @@ deprecated("Use sortedSetOf(...) instead")
public fun sortedSet<T>(comparator: Comparator<T>, vararg values: T) : TreeSet<T> = sortedSetOf(comparator, *values)
/**
* Returns a new [[HashMap]] populated with the given tuple values where the first value in each tuple
* Returns a new [[HashMap]] populated with the given pairs where the first value in each pair
* is the key and the second value is the value
*
* @includeFunctionBody ../../test/MapTest.kt createUsingTuples
* @includeFunctionBody ../../test/MapTest.kt createUsingPairs
*/
public fun <K,V> hashMapOf(vararg values: Pair<K,V>): HashMap<K,V> {
val answer = HashMap<K,V>(values.size)
@@ -67,7 +67,7 @@ deprecated("Use mapOf(...) or hashMapOf(...) instead")
public fun <K,V> hashMap(vararg values: Pair<K,V>): HashMap<K,V> = hashMapOf(*values)
/**
* Returns a new [[SortedMap]] populated with the given tuple values where the first value in each tuple
* Returns a new [[SortedMap]] populated with the given pairs where the first value in each pair
* is the key and the second value is the value
*
* @includeFunctionBody ../../test/MapTest.kt createSortedMap
@@ -88,7 +88,7 @@ deprecated("Use sortedMapOf(...) instead")
public fun <K,V> sortedMap(vararg values: Pair<K, V>): SortedMap<K,V> = sortedMapOf(*values)
/**
* Returns a new [[LinkedHashMap]] populated with the given tuple values where the first value in each tuple
* Returns a new [[LinkedHashMap]] populated with the given pairs where the first value in each pair
* is the key and the second value is the value. This map preserves insertion order so iterating through
* the map's entries will be in the same order
*
+1 -1
View File
@@ -127,7 +127,7 @@ class MapTest {
assertEquals(arrayList("beer2", "Mells2"), m2.values().toList())
}
test fun createUsingTuples() {
test fun createUsingPairs() {
val map = hashMap(Pair("a", 1), Pair("b", 2))
assertEquals(2, map.size)
assertEquals(1, map.get("a"))
+1 -1
View File
@@ -103,7 +103,7 @@ class MapJsTest {
}
*/
test fun createUsingTuples() {
test fun createUsingPairs() {
val map = hashMap(Pair("a", 1), Pair("b", 2))
assertEquals(2, map.size)
assertEquals(1, map.get("a"))
@@ -139,12 +139,6 @@ abstract class KDocTemplate() : TextTemplate() {
// TODO use drop()
val rest = arguments.subList(0, arguments.size - 1).orEmpty()
"${typeArguments(rest, "(", ")", "()")}&nbsp;<A HREF=\"${href(c)}\" title=\"${c.kind} in ${c.packageName}\">-&gt;</a>&nbsp;${link(rt)}"
} else if (cname.startsWith("jet.Tuple")) {
if (arguments.isEmpty()) {
"Unit"
} else {
"<A HREF=\"${href(c)}\" title=\"${c.kind} in ${c.packageName}\">#</a>${typeArguments(arguments, "(", ")", "()")}"
}
} else {
val name = if (fullName) cname else c.simpleName
"<A HREF=\"${href(c)}\" title=\"${c.kind} in ${c.packageName}\">$prefix$name</A>${typeArguments(arguments)}"
@@ -518,7 +518,7 @@ fun collections() {
f("sortBy(f: (T) -> R)") {
doc = """
Copies all elements into a [[List]] and sorts it by value of compare_function(element)
E.g. arrayList("two" to 2, "one" to 1).sortBy({it._2}) returns list sorted by second element of tuple
E.g. arrayList("two" to 2, "one" to 1).sortBy({it.second}) returns list sorted by second element of pair
"""
returns("List<T>")
typeParam("R: Comparable<R>")