From 8c97d9ebb3b8269430634657e5273ed520e24f6e Mon Sep 17 00:00:00 2001 From: Alexander Udalov Date: Mon, 10 Feb 2014 23:01:08 +0400 Subject: [PATCH] Fix rangeTo between Float and Long Float.rangeTo(Long) and Long.rangeTo(Float) now both return FloatRange for consistency with other binary operations between floats and longs which, in turn, return float to be consistent with Java --- compiler/testData/builtin-classes.txt | 2 +- core/builtins/native/jet/Numbers.kt | 2 +- core/runtime.jvm/src/jet/runtime/Ranges.java | 5 ++--- .../jet/generators/builtins/GenerateRangeIntrinsics.java | 1 - 4 files changed, 4 insertions(+), 6 deletions(-) diff --git a/compiler/testData/builtin-classes.txt b/compiler/testData/builtin-classes.txt index 5b6d016e385..567d1ab1ebf 100644 --- a/compiler/testData/builtin-classes.txt +++ b/compiler/testData/builtin-classes.txt @@ -585,7 +585,7 @@ public final class Float : jet.Number, jet.Comparable { public final fun rangeTo(/*0*/ other: jet.Double): jet.DoubleRange public final fun rangeTo(/*0*/ other: jet.Float): jet.FloatRange public final fun rangeTo(/*0*/ other: jet.Int): jet.FloatRange - public final fun rangeTo(/*0*/ other: jet.Long): jet.DoubleRange + public final fun rangeTo(/*0*/ other: jet.Long): jet.FloatRange public final fun rangeTo(/*0*/ other: jet.Short): jet.FloatRange public final fun times(/*0*/ other: jet.Byte): jet.Float public final fun times(/*0*/ other: jet.Char): jet.Float diff --git a/core/builtins/native/jet/Numbers.kt b/core/builtins/native/jet/Numbers.kt index 6cfb95265c2..af76f4e95bf 100644 --- a/core/builtins/native/jet/Numbers.kt +++ b/core/builtins/native/jet/Numbers.kt @@ -141,7 +141,7 @@ public class Float private () : Number, Comparable { public fun rangeTo(other : Double) : DoubleRange public fun rangeTo(other : Float) : FloatRange - public fun rangeTo(other : Long) : DoubleRange + public fun rangeTo(other : Long) : FloatRange public fun rangeTo(other : Int) : FloatRange public fun rangeTo(other : Short) : FloatRange public fun rangeTo(other : Byte) : FloatRange diff --git a/core/runtime.jvm/src/jet/runtime/Ranges.java b/core/runtime.jvm/src/jet/runtime/Ranges.java index 8f5f69d4d3d..f0802ba2c95 100644 --- a/core/runtime.jvm/src/jet/runtime/Ranges.java +++ b/core/runtime.jvm/src/jet/runtime/Ranges.java @@ -1,5 +1,5 @@ /* - * Copyright 2010-2013 JetBrains s.r.o. + * Copyright 2010-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,12 +14,11 @@ * limitations under the License. */ - package jet.runtime; import jet.*; -/* This file is generated by org.jetbrains.jet.generators.runtime.GenerateRanges. DO NOT EDIT! */ +/* This file is generated by org.jetbrains.jet.generators.builtins.GenerateRangeIntrinsics. DO NOT EDIT! */ public class Ranges { public static ByteRange rangeTo(byte from, byte to) { return new ByteRange(from, to); diff --git a/generators/src/org/jetbrains/jet/generators/builtins/GenerateRangeIntrinsics.java b/generators/src/org/jetbrains/jet/generators/builtins/GenerateRangeIntrinsics.java index 7751d3d0868..77b53215e4a 100644 --- a/generators/src/org/jetbrains/jet/generators/builtins/GenerateRangeIntrinsics.java +++ b/generators/src/org/jetbrains/jet/generators/builtins/GenerateRangeIntrinsics.java @@ -38,7 +38,6 @@ public class GenerateRangeIntrinsics { try { String copyright = "injector-generator/copyright.txt"; out.println(FileUtil.loadFile(new File(copyright))); - out.println(); out.println("package jet.runtime;"); out.println();