diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/evaluate/OperationsMapGenerated.kt b/compiler/frontend/src/org/jetbrains/jet/lang/evaluate/OperationsMapGenerated.kt index e012d126219..3bd110ca271 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lang/evaluate/OperationsMapGenerated.kt +++ b/compiler/frontend/src/org/jetbrains/jet/lang/evaluate/OperationsMapGenerated.kt @@ -32,8 +32,8 @@ private val unaryOperations: HashMap, Pair a.toChar() }, emptyUnaryFun), unaryOperation(BYTE, "toLong", { a -> a.toLong() }, emptyUnaryFun), unaryOperation(BYTE, "plus", { a -> a.plus() }, emptyUnaryFun), - unaryOperation(BYTE, "toFloat", { a -> a.toFloat() }, emptyUnaryFun), unaryOperation(BYTE, "toDouble", { a -> a.toDouble() }, emptyUnaryFun), + unaryOperation(BYTE, "toFloat", { a -> a.toFloat() }, emptyUnaryFun), unaryOperation(BYTE, "toShort", { a -> a.toShort() }, emptyUnaryFun), unaryOperation(BYTE, "toByte", { a -> a.toByte() }, emptyUnaryFun), unaryOperation(CHAR, "toInt", { a -> a.toInt() }, emptyUnaryFun), @@ -41,8 +41,8 @@ private val unaryOperations: HashMap, Pair a.toChar() }, emptyUnaryFun), unaryOperation(CHAR, "toLong", { a -> a.toLong() }, emptyUnaryFun), unaryOperation(CHAR, "plus", { a -> a.plus() }, emptyUnaryFun), - unaryOperation(CHAR, "toFloat", { a -> a.toFloat() }, emptyUnaryFun), unaryOperation(CHAR, "toDouble", { a -> a.toDouble() }, emptyUnaryFun), + unaryOperation(CHAR, "toFloat", { a -> a.toFloat() }, emptyUnaryFun), unaryOperation(CHAR, "toShort", { a -> a.toShort() }, emptyUnaryFun), unaryOperation(CHAR, "toByte", { a -> a.toByte() }, emptyUnaryFun), unaryOperation(DOUBLE, "toInt", { a -> a.toInt() }, emptyUnaryFun), @@ -50,8 +50,8 @@ private val unaryOperations: HashMap, Pair a.toChar() }, emptyUnaryFun), unaryOperation(DOUBLE, "toLong", { a -> a.toLong() }, emptyUnaryFun), unaryOperation(DOUBLE, "plus", { a -> a.plus() }, emptyUnaryFun), - unaryOperation(DOUBLE, "toFloat", { a -> a.toFloat() }, emptyUnaryFun), unaryOperation(DOUBLE, "toDouble", { a -> a.toDouble() }, emptyUnaryFun), + unaryOperation(DOUBLE, "toFloat", { a -> a.toFloat() }, emptyUnaryFun), unaryOperation(DOUBLE, "toShort", { a -> a.toShort() }, emptyUnaryFun), unaryOperation(DOUBLE, "toByte", { a -> a.toByte() }, emptyUnaryFun), unaryOperation(FLOAT, "toInt", { a -> a.toInt() }, emptyUnaryFun), @@ -59,37 +59,37 @@ private val unaryOperations: HashMap, Pair a.toChar() }, emptyUnaryFun), unaryOperation(FLOAT, "toLong", { a -> a.toLong() }, emptyUnaryFun), unaryOperation(FLOAT, "plus", { a -> a.plus() }, emptyUnaryFun), - unaryOperation(FLOAT, "toFloat", { a -> a.toFloat() }, emptyUnaryFun), unaryOperation(FLOAT, "toDouble", { a -> a.toDouble() }, emptyUnaryFun), + unaryOperation(FLOAT, "toFloat", { a -> a.toFloat() }, emptyUnaryFun), unaryOperation(FLOAT, "toShort", { a -> a.toShort() }, emptyUnaryFun), unaryOperation(FLOAT, "toByte", { a -> a.toByte() }, emptyUnaryFun), - unaryOperation(INT, "plus", { a -> a.plus() }, emptyUnaryFun), - unaryOperation(INT, "toShort", { a -> a.toShort() }, emptyUnaryFun), - unaryOperation(INT, "toByte", { a -> a.toByte() }, emptyUnaryFun), unaryOperation(INT, "inv", { a -> a.inv() }, emptyUnaryFun), unaryOperation(INT, "toInt", { a -> a.toInt() }, emptyUnaryFun), unaryOperation(INT, "minus", { a -> a.minus() }, { a -> a.minus() }), unaryOperation(INT, "toChar", { a -> a.toChar() }, emptyUnaryFun), unaryOperation(INT, "toLong", { a -> a.toLong() }, emptyUnaryFun), - unaryOperation(INT, "toDouble", { a -> a.toDouble() }, emptyUnaryFun), + unaryOperation(INT, "plus", { a -> a.plus() }, emptyUnaryFun), unaryOperation(INT, "toFloat", { a -> a.toFloat() }, emptyUnaryFun), - unaryOperation(LONG, "plus", { a -> a.plus() }, emptyUnaryFun), - unaryOperation(LONG, "toShort", { a -> a.toShort() }, emptyUnaryFun), - unaryOperation(LONG, "toByte", { a -> a.toByte() }, emptyUnaryFun), + unaryOperation(INT, "toDouble", { a -> a.toDouble() }, emptyUnaryFun), + unaryOperation(INT, "toShort", { a -> a.toShort() }, emptyUnaryFun), + unaryOperation(INT, "toByte", { a -> a.toByte() }, emptyUnaryFun), unaryOperation(LONG, "inv", { a -> a.inv() }, emptyUnaryFun), unaryOperation(LONG, "toInt", { a -> a.toInt() }, emptyUnaryFun), unaryOperation(LONG, "minus", { a -> a.minus() }, { a -> a.minus() }), unaryOperation(LONG, "toChar", { a -> a.toChar() }, emptyUnaryFun), unaryOperation(LONG, "toLong", { a -> a.toLong() }, emptyUnaryFun), - unaryOperation(LONG, "toDouble", { a -> a.toDouble() }, emptyUnaryFun), + unaryOperation(LONG, "plus", { a -> a.plus() }, emptyUnaryFun), unaryOperation(LONG, "toFloat", { a -> a.toFloat() }, emptyUnaryFun), + unaryOperation(LONG, "toDouble", { a -> a.toDouble() }, emptyUnaryFun), + unaryOperation(LONG, "toShort", { a -> a.toShort() }, emptyUnaryFun), + unaryOperation(LONG, "toByte", { a -> a.toByte() }, emptyUnaryFun), unaryOperation(SHORT, "toInt", { a -> a.toInt() }, emptyUnaryFun), unaryOperation(SHORT, "minus", { a -> a.minus() }, { a -> a.minus() }), unaryOperation(SHORT, "toChar", { a -> a.toChar() }, emptyUnaryFun), unaryOperation(SHORT, "toLong", { a -> a.toLong() }, emptyUnaryFun), unaryOperation(SHORT, "plus", { a -> a.plus() }, emptyUnaryFun), - unaryOperation(SHORT, "toFloat", { a -> a.toFloat() }, emptyUnaryFun), unaryOperation(SHORT, "toDouble", { a -> a.toDouble() }, emptyUnaryFun), + unaryOperation(SHORT, "toFloat", { a -> a.toFloat() }, emptyUnaryFun), unaryOperation(SHORT, "toShort", { a -> a.toShort() }, emptyUnaryFun), unaryOperation(SHORT, "toByte", { a -> a.toByte() }, emptyUnaryFun), unaryOperation(STRING, "toString", { a -> a.toString() }, emptyUnaryFun) @@ -99,9 +99,9 @@ private val binaryOperations: HashMap, Pair, Pair, Function2>>( binaryOperation(BOOLEAN, BOOLEAN, "xor", { a, b -> a.xor(b) }, emptyBinaryFun), binaryOperation(BOOLEAN, BOOLEAN, "or", { a, b -> a.or(b) }, emptyBinaryFun), - binaryOperation(BOOLEAN, ANY, "equals", { a, b -> a.equals(b) }, emptyBinaryFun), binaryOperation(BOOLEAN, BOOLEAN, "and", { a, b -> a.and(b) }, emptyBinaryFun), binaryOperation(BOOLEAN, BOOLEAN, "compareTo", { a, b -> a.compareTo(b) }, emptyBinaryFun), + binaryOperation(BOOLEAN, ANY, "equals", { a, b -> a.equals(b) }, emptyBinaryFun), binaryOperation(BYTE, BYTE, "minus", { a, b -> a.minus(b) }, { a, b -> a.subtract(b) }), binaryOperation(BYTE, CHAR, "minus", { a, b -> a.minus(b) }, emptyBinaryFun), binaryOperation(BYTE, DOUBLE, "minus", { a, b -> a.minus(b) }, emptyBinaryFun), @@ -269,6 +269,14 @@ private val binaryOperations: HashMap, Pair a.times(b) }, emptyBinaryFun), binaryOperation(FLOAT, SHORT, "times", { a, b -> a.times(b) }, emptyBinaryFun), binaryOperation(FLOAT, ANY, "equals", { a, b -> a.equals(b) }, emptyBinaryFun), + binaryOperation(INT, BYTE, "minus", { a, b -> a.minus(b) }, { a, b -> a.subtract(b) }), + binaryOperation(INT, CHAR, "minus", { a, b -> a.minus(b) }, emptyBinaryFun), + binaryOperation(INT, DOUBLE, "minus", { a, b -> a.minus(b) }, emptyBinaryFun), + binaryOperation(INT, FLOAT, "minus", { a, b -> a.minus(b) }, emptyBinaryFun), + binaryOperation(INT, INT, "minus", { a, b -> a.minus(b) }, { a, b -> a.subtract(b) }), + binaryOperation(INT, LONG, "minus", { a, b -> a.minus(b) }, { a, b -> a.subtract(b) }), + binaryOperation(INT, SHORT, "minus", { a, b -> a.minus(b) }, { a, b -> a.subtract(b) }), + binaryOperation(INT, INT, "and", { a, b -> a.and(b) }, { a, b -> a.and(b) }), binaryOperation(INT, BYTE, "compareTo", { a, b -> a.compareTo(b) }, emptyBinaryFun), binaryOperation(INT, CHAR, "compareTo", { a, b -> a.compareTo(b) }, emptyBinaryFun), binaryOperation(INT, DOUBLE, "compareTo", { a, b -> a.compareTo(b) }, emptyBinaryFun), @@ -300,6 +308,7 @@ private val binaryOperations: HashMap, Pair a.mod(b) }, { a, b -> a.mod(b) }), binaryOperation(INT, LONG, "mod", { a, b -> a.mod(b) }, { a, b -> a.mod(b) }), binaryOperation(INT, SHORT, "mod", { a, b -> a.mod(b) }, { a, b -> a.mod(b) }), + binaryOperation(INT, INT, "xor", { a, b -> a.xor(b) }, { a, b -> a.xor(b) }), binaryOperation(INT, BYTE, "times", { a, b -> a.times(b) }, { a, b -> a.multiply(b) }), binaryOperation(INT, CHAR, "times", { a, b -> a.times(b) }, emptyBinaryFun), binaryOperation(INT, DOUBLE, "times", { a, b -> a.times(b) }, emptyBinaryFun), @@ -308,16 +317,15 @@ private val binaryOperations: HashMap, Pair a.times(b) }, { a, b -> a.multiply(b) }), binaryOperation(INT, SHORT, "times", { a, b -> a.times(b) }, { a, b -> a.multiply(b) }), binaryOperation(INT, INT, "or", { a, b -> a.or(b) }, { a, b -> a.or(b) }), - binaryOperation(INT, BYTE, "minus", { a, b -> a.minus(b) }, { a, b -> a.subtract(b) }), - binaryOperation(INT, CHAR, "minus", { a, b -> a.minus(b) }, emptyBinaryFun), - binaryOperation(INT, DOUBLE, "minus", { a, b -> a.minus(b) }, emptyBinaryFun), - binaryOperation(INT, FLOAT, "minus", { a, b -> a.minus(b) }, emptyBinaryFun), - binaryOperation(INT, INT, "minus", { a, b -> a.minus(b) }, { a, b -> a.subtract(b) }), - binaryOperation(INT, LONG, "minus", { a, b -> a.minus(b) }, { a, b -> a.subtract(b) }), - binaryOperation(INT, SHORT, "minus", { a, b -> a.minus(b) }, { a, b -> a.subtract(b) }), - binaryOperation(INT, INT, "and", { a, b -> a.and(b) }, { a, b -> a.and(b) }), - binaryOperation(INT, INT, "xor", { a, b -> a.xor(b) }, { a, b -> a.xor(b) }), binaryOperation(INT, ANY, "equals", { a, b -> a.equals(b) }, emptyBinaryFun), + binaryOperation(LONG, BYTE, "minus", { a, b -> a.minus(b) }, { a, b -> a.subtract(b) }), + binaryOperation(LONG, CHAR, "minus", { a, b -> a.minus(b) }, emptyBinaryFun), + binaryOperation(LONG, DOUBLE, "minus", { a, b -> a.minus(b) }, emptyBinaryFun), + binaryOperation(LONG, FLOAT, "minus", { a, b -> a.minus(b) }, emptyBinaryFun), + binaryOperation(LONG, INT, "minus", { a, b -> a.minus(b) }, { a, b -> a.subtract(b) }), + binaryOperation(LONG, LONG, "minus", { a, b -> a.minus(b) }, { a, b -> a.subtract(b) }), + binaryOperation(LONG, SHORT, "minus", { a, b -> a.minus(b) }, { a, b -> a.subtract(b) }), + binaryOperation(LONG, LONG, "and", { a, b -> a.and(b) }, { a, b -> a.and(b) }), binaryOperation(LONG, BYTE, "compareTo", { a, b -> a.compareTo(b) }, emptyBinaryFun), binaryOperation(LONG, CHAR, "compareTo", { a, b -> a.compareTo(b) }, emptyBinaryFun), binaryOperation(LONG, DOUBLE, "compareTo", { a, b -> a.compareTo(b) }, emptyBinaryFun), @@ -349,6 +357,7 @@ private val binaryOperations: HashMap, Pair a.mod(b) }, { a, b -> a.mod(b) }), binaryOperation(LONG, LONG, "mod", { a, b -> a.mod(b) }, { a, b -> a.mod(b) }), binaryOperation(LONG, SHORT, "mod", { a, b -> a.mod(b) }, { a, b -> a.mod(b) }), + binaryOperation(LONG, LONG, "xor", { a, b -> a.xor(b) }, { a, b -> a.xor(b) }), binaryOperation(LONG, BYTE, "times", { a, b -> a.times(b) }, { a, b -> a.multiply(b) }), binaryOperation(LONG, CHAR, "times", { a, b -> a.times(b) }, emptyBinaryFun), binaryOperation(LONG, DOUBLE, "times", { a, b -> a.times(b) }, emptyBinaryFun), @@ -357,15 +366,6 @@ private val binaryOperations: HashMap, Pair a.times(b) }, { a, b -> a.multiply(b) }), binaryOperation(LONG, SHORT, "times", { a, b -> a.times(b) }, { a, b -> a.multiply(b) }), binaryOperation(LONG, LONG, "or", { a, b -> a.or(b) }, { a, b -> a.or(b) }), - binaryOperation(LONG, BYTE, "minus", { a, b -> a.minus(b) }, { a, b -> a.subtract(b) }), - binaryOperation(LONG, CHAR, "minus", { a, b -> a.minus(b) }, emptyBinaryFun), - binaryOperation(LONG, DOUBLE, "minus", { a, b -> a.minus(b) }, emptyBinaryFun), - binaryOperation(LONG, FLOAT, "minus", { a, b -> a.minus(b) }, emptyBinaryFun), - binaryOperation(LONG, INT, "minus", { a, b -> a.minus(b) }, { a, b -> a.subtract(b) }), - binaryOperation(LONG, LONG, "minus", { a, b -> a.minus(b) }, { a, b -> a.subtract(b) }), - binaryOperation(LONG, SHORT, "minus", { a, b -> a.minus(b) }, { a, b -> a.subtract(b) }), - binaryOperation(LONG, LONG, "and", { a, b -> a.and(b) }, { a, b -> a.and(b) }), - binaryOperation(LONG, LONG, "xor", { a, b -> a.xor(b) }, { a, b -> a.xor(b) }), binaryOperation(LONG, ANY, "equals", { a, b -> a.equals(b) }, emptyBinaryFun), binaryOperation(SHORT, BYTE, "minus", { a, b -> a.minus(b) }, { a, b -> a.subtract(b) }), binaryOperation(SHORT, CHAR, "minus", { a, b -> a.minus(b) }, emptyBinaryFun), @@ -412,6 +412,6 @@ private val binaryOperations: HashMap, Pair a.equals(b) }, emptyBinaryFun), binaryOperation(STRING, ANY, "plus", { a, b -> a.plus(b) }, emptyBinaryFun), binaryOperation(STRING, INT, "get", { a, b -> a.get(b) }, emptyBinaryFun), - binaryOperation(STRING, ANY, "equals", { a, b -> a.equals(b) }, emptyBinaryFun), - binaryOperation(STRING, STRING, "compareTo", { a, b -> a.compareTo(b) }, emptyBinaryFun) + binaryOperation(STRING, STRING, "compareTo", { a, b -> a.compareTo(b) }, emptyBinaryFun), + binaryOperation(STRING, ANY, "equals", { a, b -> a.equals(b) }, emptyBinaryFun) ) diff --git a/generators/src/org/jetbrains/jet/generators/evaluate/GenerateOperationsMap.kt b/generators/src/org/jetbrains/jet/generators/evaluate/GenerateOperationsMap.kt index 3e9dc4210e7..50223759ee8 100644 --- a/generators/src/org/jetbrains/jet/generators/evaluate/GenerateOperationsMap.kt +++ b/generators/src/org/jetbrains/jet/generators/evaluate/GenerateOperationsMap.kt @@ -167,7 +167,7 @@ private fun JetType.isIntegerType(): Boolean { private fun FunctionDescriptor.getParametersTypes(): List { - val list = arrayListOf(getExpectedThisObject()!!.getType()) + val list = arrayListOf((getContainingDeclaration() as ClassDescriptor).getDefaultType()) getValueParameters().map { it.getType() }.forEach { list.add(TypeUtils.makeNotNullable(it)) }