KT-1306123.lng or 123.sht is not good name

This commit is contained in:
Andrey Breslav
2012-02-20 21:42:13 +04:00
parent 5eb483b7a7
commit bff62484b1
68 changed files with 233 additions and 220 deletions
+6 -6
View File
@@ -1,13 +1,13 @@
package jet
abstract class Number : Hashable {
abstract val dbl : Double
abstract val flt : Float
abstract val lng : Long
abstract val double : Double
abstract val float : Float
abstract val long : Long
abstract val int : Int
abstract val chr : Char
abstract val sht : Short
abstract val byt : Byte
abstract val char : Char
abstract val short : Short
abstract val byte : Byte
// fun equals(other : Double) : Boolean
// fun equals(other : Float) : Boolean
// fun equals(other : Long) : Boolean
@@ -180,8 +180,8 @@ public class OverloadResolver {
continue;
}
OverloadUtil.OverloadCompatibilityInfo overloadble = OverloadUtil.isOverloadble(function, function2);
if (!overloadble.isSuccess()) {
OverloadUtil.OverloadCompatibilityInfo overloadable = OverloadUtil.isOverloadable(function, function2);
if (!overloadable.isSuccess()) {
JetDeclaration member = (JetDeclaration) context.getTrace().get(BindingContext.DESCRIPTOR_TO_DECLARATION, function);
if (member == null) {
assert context.getTrace().get(DELEGATED, function);
@@ -29,7 +29,7 @@ public class OverloadUtil {
/**
* Does not check names.
*/
public static OverloadCompatibilityInfo isOverloadble(CallableDescriptor a, CallableDescriptor b) {
public static OverloadCompatibilityInfo isOverloadable(CallableDescriptor a, CallableDescriptor b) {
int abc = braceCount(a);
int bbc = braceCount(b);
@@ -59,6 +59,6 @@ public class ByteValue implements CompileTimeConstant<Byte> {
@Override
public String toString() {
return value + ".byt";
return value + ".byte";
}
}
@@ -49,6 +49,6 @@ public class DoubleValue implements CompileTimeConstant<Double> {
@Override
public String toString() {
return value + ".dbl";
return value + ".double";
}
}
@@ -49,6 +49,6 @@ public class FloatValue implements CompileTimeConstant<Float> {
@Override
public String toString() {
return value + ".flt";
return value + ".float";
}
}
@@ -58,6 +58,6 @@ public class LongValue implements CompileTimeConstant<Long> {
@Override
public String toString() {
return value + ".lng";
return value + ".long";
}
}
@@ -59,7 +59,7 @@ public class ShortValue implements CompileTimeConstant<Short> {
@Override
public String toString() {
return value + ".sht";
return value + ".short";
}
}
@@ -52,6 +52,7 @@ import static org.jetbrains.jet.lang.resolve.BindingContext.*;
import static org.jetbrains.jet.lang.resolve.scopes.receivers.ReceiverDescriptor.NO_RECEIVER;
import static org.jetbrains.jet.lang.types.TypeUtils.NO_EXPECTED_TYPE;
import static org.jetbrains.jet.lang.types.expressions.ExpressionTypingUtils.*;
import static org.jetbrains.jet.lang.types.expressions.OperatorConventions.*;
/**
* @author abreslav
@@ -570,22 +571,22 @@ public class BasicExpressionTypingVisitor extends ExpressionTypingVisitor {
Number value = (Number) receiverValue.getValue();
String referencedName = selectorExpression.getReferencedName();
if (OperatorConventions.NUMBER_CONVERSIONS.contains(referencedName)) {
if ("dbl".equals(referencedName)) {
if (DOUBLE.equals(referencedName)) {
context.trace.record(BindingContext.COMPILE_TIME_VALUE, expression, new DoubleValue(value.doubleValue()));
}
else if ("flt".equals(referencedName)) {
else if (FLOAT.equals(referencedName)) {
context.trace.record(BindingContext.COMPILE_TIME_VALUE, expression, new FloatValue(value.floatValue()));
}
else if ("lng".equals(referencedName)) {
else if (LONG.equals(referencedName)) {
context.trace.record(BindingContext.COMPILE_TIME_VALUE, expression, new LongValue(value.longValue()));
}
else if ("sht".equals(referencedName)) {
else if (SHORT.equals(referencedName)) {
context.trace.record(BindingContext.COMPILE_TIME_VALUE, expression, new ShortValue(value.shortValue()));
}
else if ("byt".equals(referencedName)) {
else if (BYTE.equals(referencedName)) {
context.trace.record(BindingContext.COMPILE_TIME_VALUE, expression, new ByteValue(value.byteValue()));
}
else if ("int".equals(referencedName)) {
else if (INT.equals(referencedName)) {
context.trace.record(BindingContext.COMPILE_TIME_VALUE, expression, new IntValue(value.intValue()));
}
}
@@ -35,13 +35,18 @@ public class OperatorConventions {
private OperatorConventions() {}
// Names for primitive type conversion properties
public static final String DOUBLE = "double";
public static final String FLOAT = "float";
public static final String LONG = "long";
public static final String INT = "int";
public static final String CHAR = "char";
public static final String SHORT = "short";
public static final String BYTE = "byte";
public static final ImmutableSet<String> NUMBER_CONVERSIONS = ImmutableSet.of(
"dbl",
"flt",
"lng",
"sht",
"byt",
"int"
DOUBLE, FLOAT, LONG, INT, SHORT, BYTE, CHAR
);
public static final ImmutableBiMap<JetToken, String> UNARY_OPERATION_NAMES = ImmutableBiMap.<JetToken, String>builder()