JET-50 Drop the 'new' keyword

This commit is contained in:
Andrey Breslav
2011-06-15 18:00:10 +04:00
parent c9d9001ad8
commit c2fbbff782
103 changed files with 921 additions and 980 deletions
+3 -2
View File
@@ -1,6 +1,6 @@
== foo ==
fun foo() {
val a = new Array<Int>
val a = Array<Int>
3
a[10] = 4
2
@@ -11,7 +11,8 @@ fun foo() {
---------------------
l0:
<START>
r(new Array<Int>)
r(Array)
r(Array<Int>)
w(a)
r(3)
r(4)
+1 -1
View File
@@ -1,5 +1,5 @@
fun foo() {
val a = new Array<Int>
val a = Array<Int>
3
a[10] = 4
2
+3 -2
View File
@@ -9,7 +9,7 @@ fun assignments() : Unit {
val y = true && false
val z = false && true
val t = new Test();
val t = Test();
t.x = 1
}
---------------------
@@ -43,7 +43,8 @@ l4:
l5:
r(false && true)
w(z)
r(new Test())
r(Test)
r(Test())
w(t)
r(1)
r(t)
+1 -1
View File
@@ -12,6 +12,6 @@ fun assignments() : Unit {
val y = true && false
val z = false && true
val t = new Test();
val t = Test();
t.x = 1
}
+7 -2
View File
@@ -1,11 +1,16 @@
== fail ==
fun fail() : Nothing {
throw new java.lang.RuntimeException()
throw java.lang.RuntimeException()
}
---------------------
l0:
<START>
r(new java.lang.RuntimeException())
r(java)
r(lang)
r(java.lang)
r(RuntimeException)
r(RuntimeException())
r(java.lang.RuntimeException())
jmp(error)
l1:
<END>
+1 -1
View File
@@ -1,3 +1,3 @@
fun fail() : Nothing {
throw new java.lang.RuntimeException()
throw java.lang.RuntimeException()
}
@@ -21,9 +21,9 @@ fun f(): Unit {
x == 1
x != 1
<error>new A() == 1</error>
new B() <error>==</error> 1
new C() <error>==</error> 1
<error>A() == 1</error>
B() <error>==</error> 1
C() <error>==</error> 1
<error>x === "1"</error>
<error>x !== "1"</error>
+6 -6
View File
@@ -4,14 +4,14 @@ namespace boundsWithSubstitutors {
class C : A<C>
val a = new B<C>()
val a1 = new B<<error>Int</error>>()
val a = B<C>()
val a1 = B<<error>Int</error>>()
class X<A, B : A>()
val b = new X<Any, X<A<C>, C>>
val b0 = new X<Any, <error>Any?</error>>
val b1 = new X<Any, X<A<C>, <error>String</error>>>
val b = X<Any, X<A<C>, C>>
val b0 = X<Any, <error>Any?</error>>
val b1 = X<Any, X<A<C>, <error>String</error>>>
}
@@ -19,7 +19,7 @@ namespace boundsWithSubstitutors {
open class B<T : A>()
class C<T : B<<error>Int</error>>, X : {(B<<error>Char</error>>) : (B<<error>Any</error>>, B<A>)}>() : B<<error>Any</error>>() { // 2 errors
val a = new B<<error>Char</error>>() // error
val a = B<<error>Char</error>>() // error
val x : {(B<<error>Char</error>>) : B<<error>Any</error>>}
}
+1 -1
View File
@@ -61,7 +61,7 @@ namespace null_safety {
command.equals1(null)
command<warning>?.</warning>equals1(null)
val c = new Command()
val c = Command()
c<warning>?.</warning>equals(null)
if (command == null) 1
+10 -10
View File
@@ -66,16 +66,16 @@ class Range1() {
}
fun test() {
for (i in <error>new NotRange1()</error>);
for (i in <error>new NotRange2()</error>);
for (i in <error>new NotRange3()</error>);
for (i in <error>new NotRange4()</error>);
for (i in <error>new NotRange5()</error>);
for (i in <error>new NotRange6()</error>);
for (i in <error>new NotRange7()</error>);
for (i in new Range0());
for (i in new Range1());
for (i in <error>NotRange1()</error>);
for (i in <error>NotRange2()</error>);
for (i in <error>NotRange3()</error>);
for (i in <error>NotRange4()</error>);
for (i in <error>NotRange5()</error>);
for (i in <error>NotRange6()</error>);
for (i in <error>NotRange7()</error>);
for (i in Range0());
for (i in Range1());
for (i in (new ArrayList<Int>() : List<Int>));
for (i in (ArrayList<Int>() : List<Int>));
}
+3 -3
View File
@@ -4,7 +4,7 @@ class IncDec() {
}
fun testIncDec() {
var x = new IncDec()
var x = IncDec()
x++
++x
x--
@@ -21,7 +21,7 @@ class WrongIncDec() {
}
fun testWrongIncDec() {
var x = new WrongIncDec()
var x = WrongIncDec()
x<error>++</error>
<error>++</error>x
x<error>--</error>
@@ -34,7 +34,7 @@ class UnitIncDec() {
}
fun testUnitIncDec() {
var x = new UnitIncDec()
var x = UnitIncDec()
x++
++x
x--
+6 -6
View File
@@ -32,9 +32,9 @@ class Test1<T : A>
}
fun test() {
new Test1<<error>B</error>>()
new Test1<<error>A</error>>()
new Test1<C>()
Test1<<error>B</error>>()
Test1<<error>A</error>>()
Test1<C>()
}
class Foo() {}
@@ -60,9 +60,9 @@ fun <T : A>
t.bar()
}
val test1 = test2<<error>A</error>>(new A())
val test2 = test2<<error>B</error>>(new B())
val test3 = test2<C>(new C())
val test1 = test2<<error>A</error>>(A())
val test2 = test2<<error>B</error>>(B())
val test3 = test2<C>(C())
class Test<<error>T</error>>
where
+5 -5
View File
@@ -5,7 +5,7 @@ import <error>utils</error>.*
import java.io.PrintStream
import java.lang.Comparable as Com
val l : List<in Int> = new ArrayList<Int>()
val l : List<in Int> = ArrayList<Int>()
fun test(l : java.util.List<Int>) {
val x : java.<error>List</error>
@@ -24,7 +24,7 @@ fun test(l : java.util.List<Int>) {
Collections.singleton<Int>(1) : Set<Int>?
Collections.singleton<Int><error>(1.0)</error>
<error>new List<Int></error>
<error>List</error><Int>
val o = "sdf" <warning>as</warning> Object
@@ -36,14 +36,14 @@ fun test(l : java.util.List<Int>) {
System.out?.println(e.getMessage())
}
new PrintStream("sdf")
PrintStream("sdf")
val c : Com<Int>? = null
c : java.lang.Comparable<Int>?
// Collections.sort<Integer>(new ArrayList<Integer>())
new xxx.<error>Class</error>()
// Collections.sort<Integer>(ArrayList<Integer>())
xxx.Class<error>()</error>
}
+1 -1
View File
@@ -149,7 +149,7 @@ fun foo(a : Nothing) : Unit {
}
fun fail() : Nothing {
throw new java.lang.RuntimeException()
throw java.lang.RuntimeException()
}
fun nullIsNotNothing() : Unit {
@@ -10,15 +10,15 @@ fun takeFirst(expr: StringBuilder): Char {
}
fun evaluateArg(expr: AbstractStringBuilder, numbers: ArrayList<Int>): Int {
if (expr.length() == 0) throw new Exception("Syntax error: Character expected");
if (expr.length() == 0) throw Exception("Syntax error: Character expected");
val c = takeFirst<error>(expr)</error>
if (c <error>>=</error> '0' && c <error><=</error> '9') {
val n = c - '0'
if (!numbers.contains(n)) throw new Exception("You used incorrect number: " + n)
if (!numbers.contains(n)) throw Exception("You used incorrect number: " + n)
numbers.remove(n)
return n
}
throw new Exception("Syntax error: Unrecognized character " + c)
throw Exception("Syntax error: Unrecognized character " + c)
}
fun evaluateAdd(expr: StringBuilder, numbers: ArrayList<Int>): Int {
@@ -40,9 +40,9 @@ fun evaluate(expr: StringBuilder, numbers: ArrayList<Int>): Int {
fun main(args: Array<String>) {
System.out?.println("24 game")
val numbers = new ArrayList<Int>(4)
val rnd = new Random();
val prompt = new StringBuilder()
val numbers = ArrayList<Int>(4)
val rnd = Random();
val prompt = StringBuilder()
for(val i in 0..3) {
val n = rnd.nextInt(9) + 1
numbers.add(n)
@@ -51,8 +51,8 @@ fun main(args: Array<String>) {
}
System.out?.println("Your numbers: " + prompt)
System.out?.println("Enter your expression:")
val reader = new BufferedReader(new InputStreamReader(System.`in`))
val expr = new StringBuilder(reader.readLine())
val reader = BufferedReader(InputStreamReader(System.`in`))
val expr = StringBuilder(reader.readLine())
try {
val result = evaluate(expr, numbers)
if (result != 24)
+1 -1
View File
@@ -6,7 +6,7 @@ class Item(val room: Object) {
val name : String
}
val items: ArrayList<Item> = new ArrayList<Item>
val items: ArrayList<Item> = ArrayList<Item>
fun test(room : Object) {
for(val item: Item in items) {
@@ -11,7 +11,7 @@ fun vl(l : Left) : Int = l.v
fun vr(r : Right) : Int = r.v
fun box() : String {
val d = new D()
val d = D()
d.v = 42
if (d.v != 42) return "Fail #1"
@@ -10,8 +10,8 @@ class Derived2() : Abstract, Base() {}
fun test(s : Base) : Boolean = s.n(238) == 239
fun box() : String {
if (!test(new Base())) return "Fail #1"
if (!test(new Derived1())) return "Fail #2"
if (!test(new Derived2())) return "Fail #3"
if (!test(Base())) return "Fail #1"
if (!test(Derived1())) return "Fail #2"
if (!test(Derived2())) return "Fail #3"
return "OK"
}
@@ -11,22 +11,22 @@ class P3(x : Int, yy : Y) : X(x), Y by yy, Abstract {}
class P4(x : Int, yy : Y) : Y by yy, Abstract, X(x) {}
fun box() : String {
if (new X(239).x != 239) return "FAIL #1"
if (new Y(239).y != 239) return "FAIL #2"
if (X(239).x != 239) return "FAIL #1"
if (Y(239).y != 239) return "FAIL #2"
val p = new Point(240, -1)
val p = Point(240, -1)
if (p.x + p.y != 239) return "FAIL #3"
val y = new Y(-1)
val p1 = new P1(240, y)
val y = Y(-1)
val p1 = P1(240, y)
if (p1.x + p1.y != 239) return "FAIL #4"
val p2 = new P2(240, y)
val p2 = P2(240, y)
if (p2.x + p2.y != 239) return "FAIL #5"
val p3 = new P3(240, y)
val p3 = P3(240, y)
if (p3.x + p3.y != 239) return "FAIL #6"
val p4 = new P4(240, y)
val p4 = P4(240, y)
if (p4.x + p4.y != 239) return "FAIL #7"
"OK"
@@ -5,10 +5,10 @@ class Outer() {
class InnerDerived(): InnerBase() {
}
public val foo: InnerBase? = new InnerDerived()
public val foo: InnerBase? = InnerDerived()
}
fun box() {
val o = new Outer()
val o = Outer()
return if (o.foo === null) "fail" else "OK"
}
@@ -7,7 +7,7 @@ class Bar(): Foo {
}
fun box() {
val bar = new Bar()
val bar = Bar()
val f = bar.test()
return if (f == "xyzzy") "OK" else "fail"
}
@@ -7,7 +7,7 @@ class C() {
}
fun box(): String {
val c = new C()
val c = C()
if (c.f != 610) return "fail"
return "OK"
}
@@ -2,7 +2,7 @@ import java.util.*
import java.io.*
class World() {
public val items: ArrayList<Item> = new ArrayList<Item>
public val items: ArrayList<Item> = ArrayList<Item>
class Item() {
{
@@ -10,11 +10,11 @@ class World() {
}
}
val foo = new Item()
val foo = Item()
}
fun box() {
val w = new World()
val w = World()
if (w.items.size() != 1) return "fail"
return "OK"
}
+3 -3
View File
@@ -6,13 +6,13 @@ class Outer(val foo: StringBuilder) {
}
fun test() {
return new Inner()
return Inner()
}
}
fun box(): String {
val sb = new StringBuilder("xyzzy")
val o = new Outer(sb)
val sb = StringBuilder("xyzzy")
val o = Outer(sb)
val i = o.test()
val l = i.len()
return if (l != 5) "fail" else "OK"
@@ -3,6 +3,6 @@ class SimpleClass() {
}
fun test() {
val c = new SimpleClass()
val c = SimpleClass()
return c.foo()
}
+2 -2
View File
@@ -3,10 +3,10 @@ class Outer() {
val outer: Outer get() = this@Outer
}
public val x = new Inner()
public val x = Inner()
}
fun box() {
val o = new Outer()
val o = Outer()
return if (o === o.x.outer) "OK" else "fail"
}
@@ -26,8 +26,8 @@ fun code(s : Base) : Int {
fun test(s : Base) : Boolean = code(s) == 0
fun box() : String {
if (!test(new Base())) return "Fail #1"
if (!test(new Derived1())) return "Fail #2"
if (!test(new Derived2())) return "Fail #3"
if (!test(Base())) return "Fail #1"
if (!test(Derived1())) return "Fail #2"
if (!test(Derived2())) return "Fail #3"
return "OK"
}
@@ -7,10 +7,10 @@ class Outer() {
class InnerDerived(): InnerBase(s) {
}
public val x = new InnerDerived()
public val x = InnerDerived()
}
fun box() {
val o = new Outer()
val o = Outer()
return if (o.x.name != "xyzzy") "fail" else "OK"
}
@@ -8,8 +8,8 @@ class D() : Left(), Right() {
}
fun box() : String {
val r : Right = new Right()
val d : D = new D()
val r : Right = Right()
val d : D = D()
if (r.f() != 42) return "Fail #1"
if (d.f() != 239) return "Fail #2"
@@ -1,7 +1,7 @@
import java.util.*
fun concat(l: List<String>): String? {
val sb = new StringBuilder()
val sb = StringBuilder()
for(s in l) {
sb.append(s)
}
@@ -1,5 +1,5 @@
fun concat(l: Array<String>): String? {
val sb = new StringBuilder()
val sb = StringBuilder()
for(s in l) {
sb.append(s)
}
@@ -1,3 +1,3 @@
fun StringBuilder.first() = this.charAt(0)
fun foo() = new StringBuilder("foo").first()
fun foo() = StringBuilder("foo").first()
@@ -8,7 +8,7 @@ fun StringBuilder.takeFirst(): Char {
fun foo(expr: StringBuilder): Int {
val c = expr.takeFirst()
when(c) {
'\0' => throw new Exception("zero")
else => throw new Exception("nonzero" + c)
'\0' => throw Exception("zero")
else => throw Exception("nonzero" + c)
}
}
+1 -1
View File
@@ -1,5 +1,5 @@
fun f() {
val x = new StringBuilder();
val x = StringBuilder();
g(x);
return x.toString();
}
@@ -5,6 +5,6 @@ class SimpleClass {
}
fun test() {
val c = new SimpleClass()
val c = SimpleClass()
return c.foo()
}
+1 -1
View File
@@ -1,6 +1,6 @@
import java.io.*
fun main(args: Array<String>) {
val reader = new BufferedReader(new InputStreamReader(System.`in`))
val reader = BufferedReader(InputStreamReader(System.`in`))
while(true) {
val cmd = reader.readLine() as String
}
@@ -3,6 +3,6 @@ class Wrapper<T>() {
}
fun foo() {
val wrapper = new Wrapper<Int>()
return wrapper.castToSelf(new Wrapper<String>())
val wrapper = Wrapper<Int>()
return wrapper.castToSelf(Wrapper<String>())
}
@@ -1,4 +1,4 @@
class Point() {
}
fun foo() = new Point()
fun foo() = Point()
@@ -3,6 +3,6 @@ class Wrapper<T>() {
}
fun foo() {
val wrapper = new Wrapper<Int>()
return wrapper.isSameWrapper(new Wrapper<String>())
val wrapper = Wrapper<Int>()
return wrapper.isSameWrapper(Wrapper<String>())
}
@@ -2,6 +2,6 @@ class Wrapper<T>() {
}
fun foo() {
val wrapper = new Wrapper<Int>()
val wrapper = Wrapper<Int>()
return wrapper is Wrapper<String>
}
@@ -2,6 +2,6 @@ class Point() {
}
fun foo() {
val p = new Point();
val p = Point();
return typeof(p);
}
+1 -1
View File
@@ -1,6 +1,6 @@
fun a(
a : foo = throw new Foo(),
a : foo = throw Foo(),
a : foo = return 10,
a : foo = break,
a : foo = break @la,
+3 -7
View File
@@ -22,13 +22,9 @@ JetFile: ControlStructures.jet
THROW
PsiElement(throw)('throw')
PsiWhiteSpace(' ')
NEW
PsiElement(new)('new')
PsiWhiteSpace(' ')
TYPE_REFERENCE
USER_TYPE
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('Foo')
CALL_EXPRESSION
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('Foo')
VALUE_ARGUMENT_LIST
PsiElement(LPAR)('(')
PsiElement(RPAR)(')')
+1 -1
View File
@@ -2,4 +2,4 @@
val z = System.out
fun foo() { throw new Exception(); }
fun foo() { throw Exception(); }
+3 -7
View File
@@ -30,13 +30,9 @@ JetFile: ModifierAsSelector.jet
THROW
PsiElement(throw)('throw')
PsiWhiteSpace(' ')
NEW
PsiElement(new)('new')
PsiWhiteSpace(' ')
TYPE_REFERENCE
USER_TYPE
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('Exception')
CALL_EXPRESSION
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('Exception')
VALUE_ARGUMENT_LIST
PsiElement(LPAR)('(')
PsiElement(RPAR)(')')
+1 -1
View File
@@ -5,7 +5,7 @@ class X
namespace foo.bar {
fun foo() {
namespace.foo.bar.X
new namespace.foo.bar.X()
namespace.foo.bar.X()
when (e) {
is namespace.foo.bar.X @ (x) => {}
}
+16 -18
View File
@@ -52,26 +52,24 @@ JetFile: RootNamespace.jet
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('X')
PsiWhiteSpace('\n ')
NEW
PsiElement(new)('new')
PsiWhiteSpace(' ')
TYPE_REFERENCE
USER_TYPE
USER_TYPE
USER_TYPE
PsiElement(namespace)('namespace')
PsiElement(DOT)('.')
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('foo')
PsiElement(DOT)('.')
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('bar')
DOT_QUALIFIED_EXPRESSION
DOT_QUALIFIED_EXPRESSION
DOT_QUALIFIED_EXPRESSION
ROOT_NAMESPACE
PsiElement(namespace)('namespace')
PsiElement(DOT)('.')
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('X')
VALUE_ARGUMENT_LIST
PsiElement(LPAR)('(')
PsiElement(RPAR)(')')
PsiElement(IDENTIFIER)('foo')
PsiElement(DOT)('.')
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('bar')
PsiElement(DOT)('.')
CALL_EXPRESSION
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('X')
VALUE_ARGUMENT_LIST
PsiElement(LPAR)('(')
PsiElement(RPAR)(')')
PsiWhiteSpace('\n ')
WHEN
PsiElement(when)('when')
+5 -5
View File
@@ -19,12 +19,12 @@ fun a(
a : foo = (10),
a : foo = (10, "A", 0xf),
a : foo = typeof(10),
a : foo = new Foo(bar),
a : foo = new Foo<A>(bar),
a : foo = new Foo(),
a : foo = new Foo<bar>(),
a : foo = Foo(bar),
a : foo = Foo<A>(bar),
a : foo = Foo(),
a : foo = Foo<bar>(),
a : foo = object : Foo{},
a : foo = throw new Foo(),
a : foo = throw Foo(),
a : foo = return 10,
a : foo = break,
a : foo = break @la,
+31 -51
View File
@@ -366,13 +366,9 @@ JetFile: SimpleExpressions.jet
PsiWhiteSpace(' ')
PsiElement(EQ)('=')
PsiWhiteSpace(' ')
NEW
PsiElement(new)('new')
PsiWhiteSpace(' ')
TYPE_REFERENCE
USER_TYPE
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('Foo')
CALL_EXPRESSION
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('Foo')
VALUE_ARGUMENT_LIST
PsiElement(LPAR)('(')
VALUE_ARGUMENT
@@ -393,21 +389,17 @@ JetFile: SimpleExpressions.jet
PsiWhiteSpace(' ')
PsiElement(EQ)('=')
PsiWhiteSpace(' ')
NEW
PsiElement(new)('new')
PsiWhiteSpace(' ')
TYPE_REFERENCE
USER_TYPE
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('Foo')
TYPE_ARGUMENT_LIST
PsiElement(LT)('<')
TYPE_PROJECTION
TYPE_REFERENCE
USER_TYPE
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('A')
PsiElement(GT)('>')
CALL_EXPRESSION
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('Foo')
TYPE_ARGUMENT_LIST
PsiElement(LT)('<')
TYPE_PROJECTION
TYPE_REFERENCE
USER_TYPE
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('A')
PsiElement(GT)('>')
VALUE_ARGUMENT_LIST
PsiElement(LPAR)('(')
VALUE_ARGUMENT
@@ -428,13 +420,9 @@ JetFile: SimpleExpressions.jet
PsiWhiteSpace(' ')
PsiElement(EQ)('=')
PsiWhiteSpace(' ')
NEW
PsiElement(new)('new')
PsiWhiteSpace(' ')
TYPE_REFERENCE
USER_TYPE
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('Foo')
CALL_EXPRESSION
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('Foo')
VALUE_ARGUMENT_LIST
PsiElement(LPAR)('(')
PsiElement(RPAR)(')')
@@ -452,21 +440,17 @@ JetFile: SimpleExpressions.jet
PsiWhiteSpace(' ')
PsiElement(EQ)('=')
PsiWhiteSpace(' ')
NEW
PsiElement(new)('new')
PsiWhiteSpace(' ')
TYPE_REFERENCE
USER_TYPE
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('Foo')
TYPE_ARGUMENT_LIST
PsiElement(LT)('<')
TYPE_PROJECTION
TYPE_REFERENCE
USER_TYPE
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('bar')
PsiElement(GT)('>')
CALL_EXPRESSION
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('Foo')
TYPE_ARGUMENT_LIST
PsiElement(LT)('<')
TYPE_PROJECTION
TYPE_REFERENCE
USER_TYPE
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('bar')
PsiElement(GT)('>')
VALUE_ARGUMENT_LIST
PsiElement(LPAR)('(')
PsiElement(RPAR)(')')
@@ -516,13 +500,9 @@ JetFile: SimpleExpressions.jet
THROW
PsiElement(throw)('throw')
PsiWhiteSpace(' ')
NEW
PsiElement(new)('new')
PsiWhiteSpace(' ')
TYPE_REFERENCE
USER_TYPE
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('Foo')
CALL_EXPRESSION
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('Foo')
VALUE_ARGUMENT_LIST
PsiElement(LPAR)('(')
PsiElement(RPAR)(')')
+1 -1
View File
@@ -1,6 +1,6 @@
class Foo<T : List<This>>(a : This, b : bar<This>) : List<This> by foo as List<This> {
fun foo(a : This) : This {
val a : This = new Foo<This>();
val a : This = Foo<This>();
}
}
+10 -14
View File
@@ -131,20 +131,16 @@ JetFile: ThisType.jet
PsiWhiteSpace(' ')
PsiElement(EQ)('=')
PsiWhiteSpace(' ')
NEW
PsiElement(new)('new')
PsiWhiteSpace(' ')
TYPE_REFERENCE
USER_TYPE
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('Foo')
TYPE_ARGUMENT_LIST
PsiElement(LT)('<')
TYPE_PROJECTION
TYPE_REFERENCE
SELF_TYPE
PsiElement(This)('This')
PsiElement(GT)('>')
CALL_EXPRESSION
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('Foo')
TYPE_ARGUMENT_LIST
PsiElement(LT)('<')
TYPE_PROJECTION
TYPE_REFERENCE
SELF_TYPE
PsiElement(This)('This')
PsiElement(GT)('>')
VALUE_ARGUMENT_LIST
PsiElement(LPAR)('(')
PsiElement(RPAR)(')')
@@ -17,7 +17,7 @@ enum class GodMessages {
// Type of this variable is GOD_AnonymousClass
val GOD = object {
fun sendMessage(message : GodMEssage) = throw new RuntimeException(message.name)
fun sendMessage(message : GodMEssage) = throw RuntimeException(message.name)
};
}
@@ -186,13 +186,9 @@ JetFile: AnonymousObjects.jet
THROW
PsiElement(throw)('throw')
PsiWhiteSpace(' ')
NEW
PsiElement(new)('new')
PsiWhiteSpace(' ')
TYPE_REFERENCE
USER_TYPE
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('RuntimeException')
CALL_EXPRESSION
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('RuntimeException')
VALUE_ARGUMENT_LIST
PsiElement(LPAR)('(')
VALUE_ARGUMENT
+2 -2
View File
@@ -5,7 +5,7 @@ val foo = object : AntBuilder() {
}
[lazy] val gant = library {
new File("$gantHome/lib").files.each {
File("$gantHome/lib").files.each {
classpath(it)
}
}
@@ -32,7 +32,7 @@ class AntBuilder {
}
fun library(initializer : { Library.() : Library}) {
val lib = new Library()
val lib = Library()
lib.initializer()
return lib
}
+6 -14
View File
@@ -91,13 +91,9 @@ JetFile: Builder.jet
BODY
DOT_QUALIFIED_EXPRESSION
DOT_QUALIFIED_EXPRESSION
NEW
PsiElement(new)('new')
PsiWhiteSpace(' ')
TYPE_REFERENCE
USER_TYPE
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('File')
CALL_EXPRESSION
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('File')
VALUE_ARGUMENT_LIST
PsiElement(LPAR)('(')
VALUE_ARGUMENT
@@ -401,13 +397,9 @@ JetFile: Builder.jet
PsiWhiteSpace(' ')
PsiElement(EQ)('=')
PsiWhiteSpace(' ')
NEW
PsiElement(new)('new')
PsiWhiteSpace(' ')
TYPE_REFERENCE
USER_TYPE
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('Library')
CALL_EXPRESSION
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('Library')
VALUE_ARGUMENT_LIST
PsiElement(LPAR)('(')
PsiElement(RPAR)(')')
+7 -7
View File
@@ -4,28 +4,28 @@ class Edge<V, E>(val from : V, val data : E, val to : V)
class Graph<V, E> {
private val mutableEdges = new ArrayList<Edge<V, E>>() // type is ArrayList, but I want IMutableList
private val mutableEdges = ArrayList<Edge<V, E>>() // type is ArrayList, but I want IMutableList
/* options:
private val edges : IMutableList<Edge<V, E>> = new ArrayList<Edge<V, E>>()
private val edges : IMutableList<Edge<V, E>> = new ArrayList() // not an erasure, but a request to infer parameters
private val edges : IMutableList<Edge<V, E>> = ArrayList<Edge<V, E>>()
private val edges : IMutableList<Edge<V, E>> = ArrayList() // not an erasure, but a request to infer parameters
*/
private val mutableVertices = new HashSet<Vertex<V>>()
private val mutableVertices = HashSet<Vertex<V>>()
val edges : IList<Edge<V, E>> = mutableEdges;
val vertices : ISet<Edge<V, E>> = mutableVertices;
fun addEdge(from : V, data : E, to : V) {
mutableEdges.add(new Edge(from, data, to)) // constructor parameters are inferred
mutableEdges.add(Edge(from, data, to)) // constructor parameters are inferred
}
fun addVertex(v : V) {
mutableEdges.add(new Edge(from, data, to)) // constructor parameters are inferred
mutableEdges.add(Edge(from, data, to)) // constructor parameters are inferred
}
fun neighbours(v : Vertex<V>) = edges.filter{it.from == v}.map{it.to} // type is IIterable<Vertex<V>>
fun dfs(handler : {(V) : Unit}) {
val visited = new HashSet<Vertex<V>>()
val visited = HashSet<Vertex<V>>()
vertices.foreach{dfs(it, visited, handler)}
fun dfs(current : Vertex<V>, visited : ISet<Vertex<V>>, handler : {(V) : Unit}) {
+71 -91
View File
@@ -105,43 +105,39 @@ JetFile: Graph.jet
PsiWhiteSpace(' ')
PsiElement(EQ)('=')
PsiWhiteSpace(' ')
NEW
PsiElement(new)('new')
PsiWhiteSpace(' ')
TYPE_REFERENCE
USER_TYPE
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('ArrayList')
TYPE_ARGUMENT_LIST
PsiElement(LT)('<')
TYPE_PROJECTION
TYPE_REFERENCE
USER_TYPE
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('Edge')
TYPE_ARGUMENT_LIST
PsiElement(LT)('<')
TYPE_PROJECTION
TYPE_REFERENCE
USER_TYPE
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('V')
PsiElement(COMMA)(',')
PsiWhiteSpace(' ')
TYPE_PROJECTION
TYPE_REFERENCE
USER_TYPE
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('E')
PsiElement(GT)('>')
PsiElement(GT)('>')
CALL_EXPRESSION
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('ArrayList')
TYPE_ARGUMENT_LIST
PsiElement(LT)('<')
TYPE_PROJECTION
TYPE_REFERENCE
USER_TYPE
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('Edge')
TYPE_ARGUMENT_LIST
PsiElement(LT)('<')
TYPE_PROJECTION
TYPE_REFERENCE
USER_TYPE
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('V')
PsiElement(COMMA)(',')
PsiWhiteSpace(' ')
TYPE_PROJECTION
TYPE_REFERENCE
USER_TYPE
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('E')
PsiElement(GT)('>')
PsiElement(GT)('>')
VALUE_ARGUMENT_LIST
PsiElement(LPAR)('(')
PsiElement(RPAR)(')')
PsiWhiteSpace(' ')
PsiComment(EOL_COMMENT)('// type is ArrayList, but I want IMutableList')
PsiWhiteSpace('\n')
PsiComment(BLOCK_COMMENT)('/* options:\n private val edges : IMutableList<Edge<V, E>> = new ArrayList<Edge<V, E>>()\n private val edges : IMutableList<Edge<V, E>> = new ArrayList() // not an erasure, but a request to infer parameters\n*/')
PsiComment(BLOCK_COMMENT)('/* options:\n private val edges : IMutableList<Edge<V, E>> = ArrayList<Edge<V, E>>()\n private val edges : IMutableList<Edge<V, E>> = ArrayList() // not an erasure, but a request to infer parameters\n*/')
PsiWhiteSpace('\n\n ')
PROPERTY
MODIFIER_LIST
@@ -153,29 +149,25 @@ JetFile: Graph.jet
PsiWhiteSpace(' ')
PsiElement(EQ)('=')
PsiWhiteSpace(' ')
NEW
PsiElement(new)('new')
PsiWhiteSpace(' ')
TYPE_REFERENCE
USER_TYPE
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('HashSet')
TYPE_ARGUMENT_LIST
PsiElement(LT)('<')
TYPE_PROJECTION
TYPE_REFERENCE
USER_TYPE
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('Vertex')
TYPE_ARGUMENT_LIST
PsiElement(LT)('<')
TYPE_PROJECTION
TYPE_REFERENCE
USER_TYPE
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('V')
PsiElement(GT)('>')
PsiElement(GT)('>')
CALL_EXPRESSION
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('HashSet')
TYPE_ARGUMENT_LIST
PsiElement(LT)('<')
TYPE_PROJECTION
TYPE_REFERENCE
USER_TYPE
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('Vertex')
TYPE_ARGUMENT_LIST
PsiElement(LT)('<')
TYPE_PROJECTION
TYPE_REFERENCE
USER_TYPE
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('V')
PsiElement(GT)('>')
PsiElement(GT)('>')
VALUE_ARGUMENT_LIST
PsiElement(LPAR)('(')
PsiElement(RPAR)(')')
@@ -314,13 +306,9 @@ JetFile: Graph.jet
VALUE_ARGUMENT_LIST
PsiElement(LPAR)('(')
VALUE_ARGUMENT
NEW
PsiElement(new)('new')
PsiWhiteSpace(' ')
TYPE_REFERENCE
USER_TYPE
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('Edge')
CALL_EXPRESSION
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('Edge')
VALUE_ARGUMENT_LIST
PsiElement(LPAR)('(')
VALUE_ARGUMENT
@@ -373,13 +361,9 @@ JetFile: Graph.jet
VALUE_ARGUMENT_LIST
PsiElement(LPAR)('(')
VALUE_ARGUMENT
NEW
PsiElement(new)('new')
PsiWhiteSpace(' ')
TYPE_REFERENCE
USER_TYPE
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('Edge')
CALL_EXPRESSION
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('Edge')
VALUE_ARGUMENT_LIST
PsiElement(LPAR)('(')
VALUE_ARGUMENT
@@ -513,29 +497,25 @@ JetFile: Graph.jet
PsiWhiteSpace(' ')
PsiElement(EQ)('=')
PsiWhiteSpace(' ')
NEW
PsiElement(new)('new')
PsiWhiteSpace(' ')
TYPE_REFERENCE
USER_TYPE
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('HashSet')
TYPE_ARGUMENT_LIST
PsiElement(LT)('<')
TYPE_PROJECTION
TYPE_REFERENCE
USER_TYPE
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('Vertex')
TYPE_ARGUMENT_LIST
PsiElement(LT)('<')
TYPE_PROJECTION
TYPE_REFERENCE
USER_TYPE
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('V')
PsiElement(GT)('>')
PsiElement(GT)('>')
CALL_EXPRESSION
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('HashSet')
TYPE_ARGUMENT_LIST
PsiElement(LT)('<')
TYPE_PROJECTION
TYPE_REFERENCE
USER_TYPE
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('Vertex')
TYPE_ARGUMENT_LIST
PsiElement(LT)('<')
TYPE_PROJECTION
TYPE_REFERENCE
USER_TYPE
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('V')
PsiElement(GT)('>')
PsiElement(GT)('>')
VALUE_ARGUMENT_LIST
PsiElement(LPAR)('(')
PsiElement(RPAR)(')')
+2 -2
View File
@@ -5,7 +5,7 @@ class Queue<T> : IPushPop<T> {
private var tail : Item<T> = null
override fun push(item : T) {
val i = new Item(item)
val i = Item(item)
if (tail == null) {
head = i
tail = head
@@ -17,7 +17,7 @@ class Queue<T> : IPushPop<T> {
override fun pop() =
if (head == null)
throw new UnderflowException()
throw UnderflowException()
else {
val result = head.data
head = head.next
+6 -14
View File
@@ -164,13 +164,9 @@ JetFile: Queue.jet
PsiWhiteSpace(' ')
PsiElement(EQ)('=')
PsiWhiteSpace(' ')
NEW
PsiElement(new)('new')
PsiWhiteSpace(' ')
TYPE_REFERENCE
USER_TYPE
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('Item')
CALL_EXPRESSION
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('Item')
VALUE_ARGUMENT_LIST
PsiElement(LPAR)('(')
VALUE_ARGUMENT
@@ -289,13 +285,9 @@ JetFile: Queue.jet
THROW
PsiElement(throw)('throw')
PsiWhiteSpace(' ')
NEW
PsiElement(new)('new')
PsiWhiteSpace(' ')
TYPE_REFERENCE
USER_TYPE
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('UnderflowException')
CALL_EXPRESSION
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('UnderflowException')
VALUE_ARGUMENT_LIST
PsiElement(LPAR)('(')
PsiElement(RPAR)(')')
+1 -1
View File
@@ -1,5 +1,5 @@
class Stack<T> : IPushPop<T> {
private val data = new ArrayList<T>();
private val data = ArrayList<T>();
override fun push(item : T) {
data.add(item) // Problem: I would like to write push(...) = data.add(...), but the types do not match
+11 -15
View File
@@ -40,21 +40,17 @@ JetFile: Stack.jet
PsiWhiteSpace(' ')
PsiElement(EQ)('=')
PsiWhiteSpace(' ')
NEW
PsiElement(new)('new')
PsiWhiteSpace(' ')
TYPE_REFERENCE
USER_TYPE
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('ArrayList')
TYPE_ARGUMENT_LIST
PsiElement(LT)('<')
TYPE_PROJECTION
TYPE_REFERENCE
USER_TYPE
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('T')
PsiElement(GT)('>')
CALL_EXPRESSION
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('ArrayList')
TYPE_ARGUMENT_LIST
PsiElement(LT)('<')
TYPE_PROJECTION
TYPE_REFERENCE
USER_TYPE
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('T')
PsiElement(GT)('>')
VALUE_ARGUMENT_LIST
PsiElement(LPAR)('(')
PsiElement(RPAR)(')')
@@ -1,11 +1,11 @@
class Pair(x : Int, y : Int) {
class object {
fun copy(from : Pair, x : Int = from.x, y : Int = from.y) = new Pair(x, y)
fun copy(from : Pair, x : Int = from.x, y : Int = from.y) = Pair(x, y)
}
}
// One can say:
val p = new Point(1, 2)
val p = Point(1, 2)
val p1 = Point.Copy(p, x = 2)
val p2 = Point.Copy(p1, y = -1)
val p3 = Point.Copy(p)
+6 -14
View File
@@ -101,13 +101,9 @@ JetFile: UpdateOperation.jet
PsiWhiteSpace(' ')
PsiElement(EQ)('=')
PsiWhiteSpace(' ')
NEW
PsiElement(new)('new')
PsiWhiteSpace(' ')
TYPE_REFERENCE
USER_TYPE
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('Pair')
CALL_EXPRESSION
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('Pair')
VALUE_ARGUMENT_LIST
PsiElement(LPAR)('(')
VALUE_ARGUMENT
@@ -133,13 +129,9 @@ JetFile: UpdateOperation.jet
PsiWhiteSpace(' ')
PsiElement(EQ)('=')
PsiWhiteSpace(' ')
NEW
PsiElement(new)('new')
PsiWhiteSpace(' ')
TYPE_REFERENCE
USER_TYPE
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('Point')
CALL_EXPRESSION
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('Point')
VALUE_ARGUMENT_LIST
PsiElement(LPAR)('(')
VALUE_ARGUMENT
@@ -11,13 +11,13 @@ class ArrayList<T> : IMutableList<T> {
private fun checkVersion() {
if (version != myVersion)
throw new ConcurrentModificationException()
throw ConcurrentModificationException()
}
override fun next() {
checkVersion()
if (hasNext)
throw new NoMoreElementsException()
throw NoMoreElementsException()
data[index++]
}
@@ -40,7 +40,7 @@ class ArrayList<T> : IMutableList<T> {
private fun checkIndex(index : Int) {
if (index > used)
throw new IndexOutOfBoundsException(index)
throw IndexOutOfBoundsException(index)
}
override val isEmpty
@@ -220,13 +220,9 @@ JetFile: ArrayList.jet
THROW
PsiElement(throw)('throw')
PsiWhiteSpace(' ')
NEW
PsiElement(new)('new')
PsiWhiteSpace(' ')
TYPE_REFERENCE
USER_TYPE
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('ConcurrentModificationException')
CALL_EXPRESSION
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('ConcurrentModificationException')
VALUE_ARGUMENT_LIST
PsiElement(LPAR)('(')
PsiElement(RPAR)(')')
@@ -267,13 +263,9 @@ JetFile: ArrayList.jet
THROW
PsiElement(throw)('throw')
PsiWhiteSpace(' ')
NEW
PsiElement(new)('new')
PsiWhiteSpace(' ')
TYPE_REFERENCE
USER_TYPE
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('NoMoreElementsException')
CALL_EXPRESSION
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('NoMoreElementsException')
VALUE_ARGUMENT_LIST
PsiElement(LPAR)('(')
PsiElement(RPAR)(')')
@@ -475,13 +467,9 @@ JetFile: ArrayList.jet
THROW
PsiElement(throw)('throw')
PsiWhiteSpace(' ')
NEW
PsiElement(new)('new')
PsiWhiteSpace(' ')
TYPE_REFERENCE
USER_TYPE
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('IndexOutOfBoundsException')
CALL_EXPRESSION
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('IndexOutOfBoundsException')
VALUE_ARGUMENT_LIST
PsiElement(LPAR)('(')
VALUE_ARGUMENT
@@ -19,7 +19,7 @@ virtual class IMap<K, V> {
class HashableWrapper wraps (val obj : Any) : IHashable
// equals and hashCode implementations are inherited
[inline] fun Any.hashable() : HashableWrapper = new HashableWrapper(this)
[inline] fun Any.hashable() : HashableWrapper = HashableWrapper(this)
virtual class IHashingStrategy<K> {
fun equals(a : K, b : K) : Boolean
@@ -50,9 +50,9 @@ class StrategyHashMap<K, V>(hashingStrategy : IHashingStrategy<K>) : IMap<K, V>
// where !(K : IHashable)
this() : this(new JavaObjectHashingStrategy<K>()) {}
this() : this(JavaObjectHashingStrategy<K>()) {}
//this() where (K : IHashable) : this(new DefaultHashingStrategy<K>()) {}
//this() where (K : IHashable) : this(DefaultHashingStrategy<K>()) {}
//...
}
@@ -364,13 +364,9 @@ JetFile: HashMap.jet
PsiWhiteSpace(' ')
PsiElement(EQ)('=')
PsiWhiteSpace(' ')
NEW
PsiElement(new)('new')
PsiWhiteSpace(' ')
TYPE_REFERENCE
USER_TYPE
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('HashableWrapper')
CALL_EXPRESSION
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('HashableWrapper')
VALUE_ARGUMENT_LIST
PsiElement(LPAR)('(')
VALUE_ARGUMENT
@@ -955,21 +951,17 @@ JetFile: HashMap.jet
VALUE_ARGUMENT_LIST
PsiElement(LPAR)('(')
VALUE_ARGUMENT
NEW
PsiElement(new)('new')
PsiWhiteSpace(' ')
TYPE_REFERENCE
USER_TYPE
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('JavaObjectHashingStrategy')
TYPE_ARGUMENT_LIST
PsiElement(LT)('<')
TYPE_PROJECTION
TYPE_REFERENCE
USER_TYPE
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('K')
PsiElement(GT)('>')
CALL_EXPRESSION
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('JavaObjectHashingStrategy')
TYPE_ARGUMENT_LIST
PsiElement(LT)('<')
TYPE_PROJECTION
TYPE_REFERENCE
USER_TYPE
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('K')
PsiElement(GT)('>')
VALUE_ARGUMENT_LIST
PsiElement(LPAR)('(')
PsiElement(RPAR)(')')
@@ -979,7 +971,7 @@ JetFile: HashMap.jet
PsiElement(LBRACE)('{')
PsiElement(RBRACE)('}')
PsiWhiteSpace('\n\n ')
PsiComment(EOL_COMMENT)('//this() where (K : IHashable) : this(new DefaultHashingStrategy<K>()) {}')
PsiComment(EOL_COMMENT)('//this() where (K : IHashable) : this(DefaultHashingStrategy<K>()) {}')
PsiWhiteSpace('\n ')
PsiComment(EOL_COMMENT)('//...')
PsiWhiteSpace('\n\n')
+1 -1
View File
@@ -6,7 +6,7 @@
~foo~fun foo(~foo.a~a : `std::Char`Char) = `foo.a`a`:std::Char`
~fooB~fun fooB() = `foo`foo('1')`:std::Char`
~foo.1~fun foo() : Int = (1.`std::Int.plus(Int)`plus(1))`:std::Int`
~foo1~fun foo1() : `B`B = new `B()`B()`:B`
~foo1~fun foo1() : `B`B = `B()`B()`:B`
~A.a~val a : `std::Int`Int
}
+1 -1
View File
@@ -12,4 +12,4 @@ namespace Jet86
val a = `A`A.`A.x`x
val c = `B`B.`!null`x
val d = new B().`B.x`x
val d = B().`B.x`x
@@ -1,5 +1,5 @@
class C(~x~x : Int, ~y~val y : Int) : Base(`x`x /*parameter*/), Base1 by new Base1(`x`x) {
class C(~x~x : Int, ~y~val y : Int) : Base(`x`x /*parameter*/), Base1 by Base1(`x`x) {
var z = `x`x // parameter
get() = `$x`x // property
@@ -5,7 +5,7 @@ class A(~a~val a : Int) {
}
fun test() {
~va~val a = new A()
~va~val a = A()
`va`a.`$a`a`:std::Int`
a.`b`b`:std::Int`
a.`f`f()`:std::Int`
+11 -11
View File
@@ -1,56 +1,56 @@
class In<in T> {
class In<in T>() {
~In.f:T->Unit~fun f(t : T) : Unit {}
~In.f:Int->Int~fun f(t : Int) : Int {}
~In.f1~fun f1(t : T) : Unit {}
}
class Out<out T> {
class Out<out T>() {
~Out.f~fun f() : T {}
~Out.f(a)~fun f(a : Int) : Int {a}
}
class Inv<T> {
class Inv<T>() {
~Inv.f~fun f(t : T) : T {t}
~Inv.inf~fun inf(t : T) : Unit {}
~Inv.outf~fun outf() : T {}
}
fun testInOut() {
new In<String>().`In.f:T->Unit`f("1");
In<String>().`In.f:T->Unit`f("1");
(return : In<in String>).`In.f:T->Unit`f("1");
(return : In<out String>).`!`f("1")
(return : In<*>).`!`f("1");
new In<String>().`In.f:Int->Int`f(1);
In<String>().`In.f:Int->Int`f(1);
(return : In<in String>).`In.f:Int->Int`f(1);
(return : In<out String>).`In.f:Int->Int`f(1)
(return : In<out String>).`!`f1(1)
(return : In<*>).`In.f:Int->Int`f(1);
new Out<Int>().`Out.f(a)`f(1)
Out<Int>().`Out.f(a)`f(1)
(return : Out<out Int>).`Out.f(a)`f(1)
(return : Out<in Int>).`Out.f(a)`f(1)
(return : Out<*>).`Out.f(a)`f(1)
new Out<Int>().`Out.f`f()
Out<Int>().`Out.f`f()
(return : Out<out Int>).`Out.f`f()
(return : Out<in Int>).`Out.f`f()
(return : Out<*>).`Out.f`f()
new Inv<Int>().`Inv.f`f(1)
Inv<Int>().`Inv.f`f(1)
(return : Inv<in Int>).`Inv.f`f(1)
(return : Inv<out Int>).`!`f(1)
(return : Inv<*>).`!`f(1)
new Inv<Int>().`Inv.inf`inf(1)
Inv<Int>().`Inv.inf`inf(1)
(return : Inv<in Int>).`Inv.inf`inf(1)
(return : Inv<out Int>).`!`inf(1)
(return : Inv<*>).`!`inf(1)
new Inv<Int>().`Inv.outf`outf()
Inv<Int>().`Inv.outf`outf()
((return : Inv<in Int>).`Inv.outf`outf())`:std::Any`
(return : Inv<out Int>).`Inv.outf`outf()
(return : Inv<*>).`Inv.outf`outf()
new Inv<Int>().`Inv.outf`outf(1)
Inv<Int>().`Inv.outf`outf(1)
}
@@ -23,13 +23,13 @@ fun f_plus(): Int {
~t~fun <~t.T~T> t(~t.t~t : `t.T`T) : `t.T`T {
`t`t<Int>(1)`:std::Int`
`t`t<`t.T`T>(`t.t`t)`:t.T`
new `X()`X<`t.T`T>()
`X()`X<`t.T`T>()
1 `std::Int.plus(Int)`+ 1
1 `std::Int.plus(Int)`+= 1
new X<String>() `plus`+ "1"
new X<String>() `plus`plus "sadfas"
new X<String>().`plus`plus("")
val x = new X<String>()
X<String>() `plus`+ "1"
X<String>() `plus`plus "sadfas"
X<String>().`plus`plus("")
val x = X<String>()
x `minus`- ""
x `times`* ""
x `div`/ ""
@@ -61,7 +61,7 @@ fun f_plus(): Int {
fun <T> tt(t : T) : T {
val x : List<Int> = 0
x`java::java.util.List.get()`[1]
val foo = new `Bar()`Bar()
val foo = `Bar()`Bar()
foo`!`[null, 1]
foo`get2`[1, 1]
foo`get1`[1]
@@ -72,7 +72,7 @@ fun <T> tt(t : T) : T {
x`!`[null] = null
(x`!`[null, 2]) = null
(`not`!foo)[1]`:std::Char`
val y = new Bar()
val y = Bar()
y`inc`++
`inc`++y
`dec`--y
@@ -87,13 +87,13 @@ fun <T> tt(t : T) : T {
}
class UnitIncDec {
class UnitIncDec() {
~uinc~fun inc() : Unit
~udec~fun dec() : Unit
}
fun testUnitIncDec() {
var x = new UnitIncDec()
var x = UnitIncDec()
x`uinc`++
x`udec`--
}
+3 -3
View File
@@ -8,7 +8,7 @@ fun foo(~a~a : `std::Array`Array<`std::Int`Int>) : `java::java.util.List`List {
fun foo(o : `java::java.lang.Object`Object, l : `java::java.util`util.`java::java.util.List`List) : `java::java.util.List`List {}
~A~class A {
~A~class A() {
fun f(a : `java::java.util`util.`java::java.util.List`List) {}
fun f(a : `java::java.util.List`List) {}
@@ -31,7 +31,7 @@ class B : `java::java.lang.Object`Object {
}
fun barrr() : `std::Int`Int {
`foo`foo(new `A`A())
`foo`foo(`A`A())
}
}
@@ -40,7 +40,7 @@ class B : `java::java.lang.Object`Object {
}
fun <T> t(t : T) : T {
`c`c(new java.lang.Integer(1))
`c`c(java.lang.Integer(1))
System.out.`java::java.io.PrintStream.print(Object)`print(t)
System.out.`java::java.io.PrintStream.print(char[])`print(null : Array<Char>?)
System.out.`java::java.io.PrintStream.print(Object)`print(null : Object?)
+1 -1
View File
@@ -5,5 +5,5 @@ var xxxx = 1
}
fun foo() {
new `SimpleClass`SimpleClass(1).`!`xxxx
`SimpleClass`SimpleClass(1).`!`xxxx
}