dbl -> toDouble
This commit is contained in:
@@ -330,8 +330,8 @@ public class Converter {
|
||||
final String typeToKotlin = f.getType().toKotlin();
|
||||
if (typeToKotlin.equals("Boolean")) return "false";
|
||||
if (typeToKotlin.equals("Char")) return "' '";
|
||||
if (typeToKotlin.equals("Double")) return "0." + OperatorConventions.DOUBLE;
|
||||
if (typeToKotlin.equals("Float")) return "0." + OperatorConventions.FLOAT;
|
||||
if (typeToKotlin.equals("Double")) return "0." + OperatorConventions.DOUBLE + "()";
|
||||
if (typeToKotlin.equals("Float")) return "0." + OperatorConventions.FLOAT + "()";
|
||||
return "0";
|
||||
}
|
||||
}
|
||||
@@ -799,7 +799,7 @@ public class Converter {
|
||||
conversions.put(JAVA_LANG_CHARACTER, CHAR);
|
||||
|
||||
if (conversions.containsKey(type)) {
|
||||
return "." + conversions.get(type);
|
||||
return "." + conversions.get(type) + "()";
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
@@ -76,8 +76,8 @@ public class ArrayInitializerExpression extends Expression {
|
||||
|
||||
@NotNull
|
||||
private static String getConversion(@NotNull final String afterReplace) {
|
||||
if (afterReplace.contains("double")) return DOT + OperatorConventions.DOUBLE;
|
||||
if (afterReplace.contains("float")) return DOT + OperatorConventions.FLOAT;
|
||||
if (afterReplace.contains("double")) return DOT + OperatorConventions.DOUBLE + "()";
|
||||
if (afterReplace.contains("float")) return DOT + OperatorConventions.FLOAT + "()";
|
||||
return "";
|
||||
}
|
||||
|
||||
|
||||
@@ -22,6 +22,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.jet.j2k.Converter;
|
||||
import org.jetbrains.jet.j2k.ast.*;
|
||||
import org.jetbrains.jet.lang.types.expressions.OperatorConventions;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
@@ -208,7 +209,7 @@ public class ExpressionVisitor extends StatementVisitor {
|
||||
text = text.replace("D", "").replace("d", "");
|
||||
}
|
||||
if (canonicalTypeStr.equals("float") || canonicalTypeStr.equals(JAVA_LANG_FLOAT)) {
|
||||
text = text.replace("F", "").replace("f", "") + "." + "float";
|
||||
text = text.replace("F", "").replace("f", "") + "." + OperatorConventions.FLOAT + "()";
|
||||
}
|
||||
if (canonicalTypeStr.equals("long") || canonicalTypeStr.equals(JAVA_LANG_LONG)) {
|
||||
text = text.replace("L", "").replace("l", "");
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
var a : Double = 0
|
||||
var b : Double = 0
|
||||
var c : Double = 0
|
||||
var ds : DoubleArray? = doubleArray((a).double, (b).double, (c).double)
|
||||
var ds : DoubleArray? = doubleArray((a).toDouble(), (b).toDouble(), (c).toDouble())
|
||||
@@ -1,8 +1,8 @@
|
||||
public open class Test(_myName : String?, _a : Boolean, _b : Double, _c : Float, _d : Long, _e : Int, _f : Short, _g : Char) {
|
||||
private val myName : String?
|
||||
private var a : Boolean = false
|
||||
private var b : Double = 0.double
|
||||
private var c : Float = 0.float
|
||||
private var b : Double = 0.toDouble()
|
||||
private var c : Float = 0.toFloat()
|
||||
private var d : Long = 0
|
||||
private var e : Int = 0
|
||||
private var f : Short = 0
|
||||
@@ -19,11 +19,11 @@ g = _g
|
||||
}
|
||||
class object {
|
||||
open public fun init() : Test {
|
||||
val __ = Test(null, false, 0.double, 0.float, 0, 0, 0, ' ')
|
||||
val __ = Test(null, false, 0.toDouble(), 0.toFloat(), 0, 0, 0, ' ')
|
||||
return __
|
||||
}
|
||||
open public fun init(name : String?) : Test {
|
||||
val __ = Test(foo(name), false, 0.double, 0.float, 0, 0, 0, ' ')
|
||||
val __ = Test(foo(name), false, 0.toDouble(), 0.toFloat(), 0, 0, 0, ' ')
|
||||
return __
|
||||
}
|
||||
open fun foo(n : String?) : String? {
|
||||
|
||||
@@ -4,8 +4,8 @@ open fun putInt(i : Int?) : Unit {
|
||||
}
|
||||
open fun test() : Unit {
|
||||
var b : Byte = 10
|
||||
putInt((b).int)
|
||||
putInt((b).toInt())
|
||||
var b2 : Byte? = 10
|
||||
putInt((b2).int)
|
||||
putInt((b2).toInt())
|
||||
}
|
||||
}
|
||||
@@ -4,6 +4,6 @@ open fun putInt(i : Int) : Unit {
|
||||
}
|
||||
open fun test() : Unit {
|
||||
var b : Byte = 10
|
||||
putInt((b).int)
|
||||
putInt((b).toInt())
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,6 @@ package demo
|
||||
open class Test(i : Int) {
|
||||
open fun test() : Unit {
|
||||
var b : Byte = 10
|
||||
Test((b).int)
|
||||
Test((b).toInt())
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
open class Test() {
|
||||
open fun getInt() : Int {
|
||||
var b : Byte = 10
|
||||
return b.int
|
||||
return b.toInt()
|
||||
}
|
||||
}
|
||||
@@ -8,5 +8,5 @@ var myContainer : Container? = Container()
|
||||
}
|
||||
}
|
||||
open class Test() {
|
||||
var b : Byte = One.myContainer?.myInt.sure().byte
|
||||
var b : Byte = One.myContainer?.myInt.sure().toByte()
|
||||
}
|
||||
@@ -9,6 +9,6 @@ var myContainer : Container? = Container()
|
||||
}
|
||||
open class Test() {
|
||||
open fun test() : Unit {
|
||||
var b : Byte = One.myContainer?.myInt.sure().byte
|
||||
var b : Byte = One.myContainer?.myInt.sure().toByte()
|
||||
}
|
||||
}
|
||||
@@ -2,17 +2,17 @@ open class Test() {
|
||||
open fun test() : Unit {
|
||||
var l1 : Long = 10
|
||||
var d1 : Double = 10.0
|
||||
var f1 : Float = 10.0.float
|
||||
var f1 : Float = 10.0.toFloat()
|
||||
var l2 : Long = 10
|
||||
var d2 : Double = 10.0
|
||||
var f2 : Float = 10.0.float
|
||||
var f2 : Float = 10.0.toFloat()
|
||||
}
|
||||
open fun testBoxed() : Unit {
|
||||
var l1 : Long? = 10
|
||||
var d1 : Double? = 10.0
|
||||
var f1 : Float? = 10.0.float
|
||||
var f1 : Float? = 10.0.toFloat()
|
||||
var l2 : Long? = 10
|
||||
var d2 : Double? = 10.0
|
||||
var f2 : Float? = 10.0.float
|
||||
var f2 : Float? = 10.0.toFloat()
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user