From 7d964593576d566a9a732aefbfe070ef4e8b282c Mon Sep 17 00:00:00 2001 From: Andrey Breslav Date: Fri, 13 May 2011 15:33:44 +0400 Subject: [PATCH] TypeInfo moved to jet.typeinfo namespace --- idea/src/jet/Library.jet | 32 ++++++++++--------- .../jet/lang/types/JetStandardLibrary.java | 2 +- .../jet/types/JetTypeCheckerTest.java | 4 +-- 3 files changed, 20 insertions(+), 18 deletions(-) diff --git a/idea/src/jet/Library.jet b/idea/src/jet/Library.jet index aa7a2b95e66..e428ef10db5 100644 --- a/idea/src/jet/Library.jet +++ b/idea/src/jet/Library.jet @@ -1,13 +1,16 @@ namespace jet -class TypeInfo { - fun isSubtypeOf(other : TypeInfo<*>) : Boolean - fun isInstance(obj : Any?) : Boolean +namespace typeinfo { + class TypeInfo { + fun isSubtypeOf(other : TypeInfo<*>) : Boolean + fun isInstance(obj : Any?) : Boolean + } } + class Iterator { fun next() : T - val hasNext : Boolean + abstract val hasNext : Boolean } class Iterable { @@ -38,7 +41,7 @@ class Boolean : Comparable { fun equals(other : Any?) : Boolean } -class String : Comparable { +class String() : Comparable { fun get(index : Int) : Char val length : Int @@ -50,19 +53,18 @@ class Range> { fun contains(item : T) : Boolean } -class IntRange : Range, Iterable { +class IntRange> : Range, Iterable { } 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 { fun dec() : Byte fun plus() : Int fun minus() : Int -} \ No newline at end of file +} diff --git a/idea/src/org/jetbrains/jet/lang/types/JetStandardLibrary.java b/idea/src/org/jetbrains/jet/lang/types/JetStandardLibrary.java index e64977081e3..161f02b6af2 100644 --- a/idea/src/org/jetbrains/jet/lang/types/JetStandardLibrary.java +++ b/idea/src/org/jetbrains/jet/lang/types/JetStandardLibrary.java @@ -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()); diff --git a/idea/tests/org/jetbrains/jet/types/JetTypeCheckerTest.java b/idea/tests/org/jetbrains/jet/types/JetTypeCheckerTest.java index 762fca93e9a..48bac7f15dd 100644 --- a/idea/tests/org/jetbrains/jet/types/JetTypeCheckerTest.java +++ b/idea/tests/org/jetbrains/jet/types/JetTypeCheckerTest.java @@ -82,8 +82,8 @@ public class JetTypeCheckerTest extends LightDaemonAnalyzerTestCase { } public void testTypeInfo() throws Exception { - assertType("typeof(1)", "TypeInfo"); - assertType("typeof(typeof(1))", "TypeInfo>"); + assertType("typeof(1)", "typeinfo.TypeInfo"); + assertType("typeof(typeof(1))", "typeinfo.TypeInfo>"); } public void testJumps() throws Exception {