TypeInfo moved to jet.typeinfo namespace

This commit is contained in:
Andrey Breslav
2011-05-13 15:33:44 +04:00
parent d9bbecfaee
commit 7d96459357
3 changed files with 20 additions and 18 deletions
+17 -15
View File
@@ -1,13 +1,16 @@
namespace jet
class TypeInfo<T> {
fun isSubtypeOf(other : TypeInfo<*>) : Boolean
fun isInstance(obj : Any?) : Boolean
namespace typeinfo {
class TypeInfo<T> {
fun isSubtypeOf(other : TypeInfo<*>) : Boolean
fun isInstance(obj : Any?) : Boolean
}
}
class Iterator<out T> {
fun next() : T
val hasNext : Boolean
abstract val hasNext : Boolean
}
class Iterable<out T> {
@@ -38,7 +41,7 @@ class Boolean : Comparable<Boolean> {
fun equals(other : Any?) : Boolean
}
class String : Comparable<String> {
class String() : Comparable<String> {
fun get(index : Int) : Char
val length : Int
@@ -50,19 +53,18 @@ class Range<in T : Comparable<T>> {
fun contains(item : T) : Boolean
}
class IntRange<T> : Range<T>, Iterable<T> {
class IntRange<T : Comparable<T>> : Range<T>, Iterable<T> {
}
class Number : Hashable {
val dbl : Double
val flt : Float
val lng : Long
val int : Int
val chr : Char
val sht : Short
val byt : Byte
abstract val dbl : Double
abstract val flt : Float
abstract val lng : Long
abstract val int : Int
abstract val chr : Char
abstract val sht : Short
abstract val byt : Byte
// fun equals(other : Double) : Boolean
// fun equals(other : Float) : Boolean
// fun equals(other : Long) : Boolean
@@ -526,4 +528,4 @@ class Byte : Number, Comparable<Byte> {
fun dec() : Byte
fun plus() : Int
fun minus() : Int
}
}
@@ -87,7 +87,7 @@ public class JetStandardLibrary {
this.stringClass = (ClassDescriptor) libraryScope.getClassifier("String");
this.arrayClass = (ClassDescriptor) libraryScope.getClassifier("Array");
this.iterableClass = (ClassDescriptor) libraryScope.getClassifier("Iterable");
this.typeInfoClass = (ClassDescriptor) libraryScope.getClassifier("TypeInfo");
this.typeInfoClass = (ClassDescriptor) libraryScope.getNamespace("typeinfo").getMemberScope().getClassifier("TypeInfo");
this.byteType = new JetTypeImpl(getByte());
this.charType = new JetTypeImpl(getChar());
@@ -82,8 +82,8 @@ public class JetTypeCheckerTest extends LightDaemonAnalyzerTestCase {
}
public void testTypeInfo() throws Exception {
assertType("typeof(1)", "TypeInfo<Int>");
assertType("typeof(typeof(1))", "TypeInfo<TypeInfo<Int>>");
assertType("typeof(1)", "typeinfo.TypeInfo<Int>");
assertType("typeof(typeof(1))", "typeinfo.TypeInfo<typeinfo.TypeInfo<Int>>");
}
public void testJumps() throws Exception {