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
+16 -14
View File
@@ -1,13 +1,16 @@
namespace jet namespace jet
class TypeInfo<T> { namespace typeinfo {
fun isSubtypeOf(other : TypeInfo<*>) : Boolean class TypeInfo<T> {
fun isInstance(obj : Any?) : Boolean fun isSubtypeOf(other : TypeInfo<*>) : Boolean
fun isInstance(obj : Any?) : Boolean
}
} }
class Iterator<out T> { class Iterator<out T> {
fun next() : T fun next() : T
val hasNext : Boolean abstract val hasNext : Boolean
} }
class Iterable<out T> { class Iterable<out T> {
@@ -38,7 +41,7 @@ class Boolean : Comparable<Boolean> {
fun equals(other : Any?) : Boolean fun equals(other : Any?) : Boolean
} }
class String : Comparable<String> { class String() : Comparable<String> {
fun get(index : Int) : Char fun get(index : Int) : Char
val length : Int val length : Int
@@ -50,19 +53,18 @@ class Range<in T : Comparable<T>> {
fun contains(item : T) : Boolean fun contains(item : T) : Boolean
} }
class IntRange<T> : Range<T>, Iterable<T> { class IntRange<T : Comparable<T>> : Range<T>, Iterable<T> {
} }
class Number : Hashable { class Number : Hashable {
val dbl : Double abstract val dbl : Double
val flt : Float abstract val flt : Float
val lng : Long abstract val lng : Long
val int : Int abstract val int : Int
val chr : Char abstract val chr : Char
val sht : Short abstract val sht : Short
val byt : Byte abstract val byt : Byte
// fun equals(other : Double) : Boolean // fun equals(other : Double) : Boolean
// fun equals(other : Float) : Boolean // fun equals(other : Float) : Boolean
// fun equals(other : Long) : Boolean // fun equals(other : Long) : Boolean
@@ -87,7 +87,7 @@ public class JetStandardLibrary {
this.stringClass = (ClassDescriptor) libraryScope.getClassifier("String"); this.stringClass = (ClassDescriptor) libraryScope.getClassifier("String");
this.arrayClass = (ClassDescriptor) libraryScope.getClassifier("Array"); this.arrayClass = (ClassDescriptor) libraryScope.getClassifier("Array");
this.iterableClass = (ClassDescriptor) libraryScope.getClassifier("Iterable"); 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.byteType = new JetTypeImpl(getByte());
this.charType = new JetTypeImpl(getChar()); this.charType = new JetTypeImpl(getChar());
@@ -82,8 +82,8 @@ public class JetTypeCheckerTest extends LightDaemonAnalyzerTestCase {
} }
public void testTypeInfo() throws Exception { public void testTypeInfo() throws Exception {
assertType("typeof(1)", "TypeInfo<Int>"); assertType("typeof(1)", "typeinfo.TypeInfo<Int>");
assertType("typeof(typeof(1))", "TypeInfo<TypeInfo<Int>>"); assertType("typeof(typeof(1))", "typeinfo.TypeInfo<typeinfo.TypeInfo<Int>>");
} }
public void testJumps() throws Exception { public void testJumps() throws Exception {