Unextend Char from Number

This is impossible to achieve on JVM, where java/lang/Character does not extend
java/lang/Number
This commit is contained in:
Alexander Udalov
2013-12-03 21:44:13 +04:00
parent 77d8a745bd
commit 1c3383c811
36 changed files with 39 additions and 23 deletions
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,9 +1,9 @@
&!2
&"2

Z
0B
Z
&0LB
&0MB
j
Ć0B
!
"
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,5 +1,5 @@
&
2
2
 Z
&06B
 Z
@@ -1,3 +1,3 @@
fÀ2
Z æ0aB
%
&
Binary file not shown.
Binary file not shown.
@@ -1,9 +1,9 @@
Ć2
ZB
ĆZ
B
B
&Z B
j-
+Ć0:
+Ć0:
×
&:Ř
Binary file not shown.
+8 -8
View File
@@ -166,7 +166,7 @@ public final class ByteRange : jet.Range<jet.Byte>, jet.Progression<jet.Byte> {
}
}
public final class Char : jet.Number, jet.Comparable<jet.Char> {
public final class Char : jet.Hashable, jet.Comparable<jet.Char> {
/*primary*/ private constructor Char()
public final fun compareTo(/*0*/ other: jet.Byte): jet.Int
public open override /*1*/ fun compareTo(/*0*/ other: jet.Char): jet.Int
@@ -213,13 +213,13 @@ public final class Char : jet.Number, jet.Comparable<jet.Char> {
public final fun times(/*0*/ other: jet.Int): jet.Int
public final fun times(/*0*/ other: jet.Long): jet.Long
public final fun times(/*0*/ other: jet.Short): jet.Int
public open override /*1*/ fun toByte(): jet.Byte
public open override /*1*/ fun toChar(): jet.Char
public open override /*1*/ fun toDouble(): jet.Double
public open override /*1*/ fun toFloat(): jet.Float
public open override /*1*/ fun toInt(): jet.Int
public open override /*1*/ fun toLong(): jet.Long
public open override /*1*/ fun toShort(): jet.Short
public open fun toByte(): jet.Byte
public open fun toChar(): jet.Char
public open fun toDouble(): jet.Double
public open fun toFloat(): jet.Float
public open fun toInt(): jet.Int
public open fun toLong(): jet.Long
public open fun toShort(): jet.Short
}
public final class CharArray {
@@ -0,0 +1,11 @@
fun foo(n: Number) = n
fun test() {
foo(<!CONSTANT_EXPECTED_TYPE_MISMATCH!>'a'<!>)
val c = 'c'
foo(<!TYPE_MISMATCH!>c<!>)
val d: Char? = 'd'
foo(<!TYPE_MISMATCH!>d<!>!!)
}
@@ -4620,6 +4620,11 @@ public class JetDiagnosticsTestGenerated extends AbstractDiagnosticsTestWithEage
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.GenerateTests", new File("compiler/testData/diagnostics/tests/numbers"), Pattern.compile("^(.+)\\.kt$"), true);
}
@TestMetadata("characterIsNotANumber.kt")
public void testCharacterIsNotANumber() throws Exception {
doTest("compiler/testData/diagnostics/tests/numbers/characterIsNotANumber.kt");
}
@TestMetadata("doublesInSimpleConstraints.kt")
public void testDoublesInSimpleConstraints() throws Exception {
doTest("compiler/testData/diagnostics/tests/numbers/doublesInSimpleConstraints.kt");
+8 -8
View File
@@ -328,7 +328,7 @@ public class Int private () : Number, Comparable<Int> {
public override fun equals(other : Any?) : Boolean
}
public class Char private () : Number, Comparable<Char> {
public class Char private () : Hashable, Comparable<Char> {
public fun compareTo(other : Double) : Int
public fun compareTo(other : Float) : Int
public fun compareTo(other : Long) : Int
@@ -384,13 +384,13 @@ public class Char private () : Number, Comparable<Char> {
public fun plus() : Int
public fun minus() : Int
public override fun toDouble() : Double
public override fun toFloat() : Float
public override fun toLong() : Long
public override fun toInt() : Int
public override fun toChar() : Char
public override fun toShort() : Short
public override fun toByte() : Byte
public fun toDouble() : Double
public fun toFloat() : Float
public fun toLong() : Long
public fun toInt() : Int
public fun toChar() : Char
public fun toShort() : Short
public fun toByte() : Byte
public override fun hashCode() : Int
public override fun equals(other : Any?) : Boolean