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
@@ -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) {