Create from usage: Added tests.
This commit is contained in:
@@ -0,0 +1,10 @@
|
||||
// "Create class object from usage" "true"
|
||||
// ERROR: Expression 'T' of type '<class-object-for-T>' cannot be invoked as a function
|
||||
trait T {
|
||||
class object {
|
||||
}
|
||||
|
||||
}
|
||||
fun foo() {
|
||||
val x = T()
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
// "Create class object from usage" "true"
|
||||
// ERROR: Expression 'T' of type '<class-object-for-T>' cannot be invoked as a function
|
||||
trait T
|
||||
{
|
||||
class object {
|
||||
}
|
||||
}
|
||||
fun foo() {
|
||||
val x = T()
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
// "Create class object from usage" "true"
|
||||
// ERROR: Expression 'T' of type '<class-object-for-T>' cannot be invoked as a function
|
||||
trait T {
|
||||
|
||||
}
|
||||
fun foo() {
|
||||
val x = T<caret>()
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
// "Create class object from usage" "true"
|
||||
// ERROR: Expression 'T' of type '<class-object-for-T>' cannot be invoked as a function
|
||||
trait T
|
||||
fun foo() {
|
||||
val x = T<caret>()
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
// "Create method 'component3' from usage" "true"
|
||||
class Foo<T> {
|
||||
fun component1(): Int { return 0 }
|
||||
fun component2(): Int { return 0 }
|
||||
fun component3(): Any {
|
||||
throw Exception("not implemented") //To change body of created methods use File | Settings | File Templates.
|
||||
}
|
||||
}
|
||||
fun foo() {
|
||||
val (a, b, c) = Foo<Int>()
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
// "Create method 'component3' from usage" "true"
|
||||
class Foo<T> {
|
||||
fun component1(): Int { return 0 }
|
||||
fun component2(): Int { return 0 }
|
||||
fun component3(): String {
|
||||
throw Exception("not implemented") //To change body of created methods use File | Settings | File Templates.
|
||||
}
|
||||
}
|
||||
fun foo() {
|
||||
val (a, b, c: String) = Foo<Int>()
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
// "Create method 'component3' from usage" "true"
|
||||
class Foo<T> {
|
||||
fun component1(): Int { return 0 }
|
||||
fun component2(): Int { return 0 }
|
||||
}
|
||||
fun foo() {
|
||||
val (a, b, c) = Foo<caret><Int>()
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
// "Create method 'component3' from usage" "true"
|
||||
class Foo<T> {
|
||||
fun component1(): Int { return 0 }
|
||||
fun component2(): Int { return 0 }
|
||||
}
|
||||
fun foo() {
|
||||
val (a, b, c: String) = Foo<caret><Int>()
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
// "Create method 'get' from usage" "true"
|
||||
class Foo<T> {
|
||||
fun x (y: Foo<Iterable<T>>) {
|
||||
val z: Iterable<T> = y[""]
|
||||
}
|
||||
fun get(s: String): T {
|
||||
throw Exception("not implemented") //To change body of created methods use File | Settings | File Templates.
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
// "Create method 'get' from usage" "true"
|
||||
class Foo<T> {
|
||||
fun <T> x (y: Foo<List<T>>, w: java.util.ArrayList<T>) {
|
||||
val z: Iterable<T> = y["", w]
|
||||
}
|
||||
fun get(s: String, w: T): T {
|
||||
throw Exception("not implemented") //To change body of created methods use File | Settings | File Templates.
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
// "Create method 'get' from usage" "true"
|
||||
class Foo<T> {
|
||||
fun get(s: String, w: T): T {
|
||||
throw Exception("not implemented") //To change body of created methods use File | Settings | File Templates.
|
||||
}
|
||||
}
|
||||
fun <T> x (y: Foo<List<T>>, w: java.util.ArrayList<T>) {
|
||||
val z: Iterable<T> = y["", w]
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
// "Create method 'get' from usage" "true"
|
||||
class Foo<T> {
|
||||
fun get(s: String, w: T): Any {
|
||||
throw Exception("not implemented") //To change body of created methods use File | Settings | File Templates.
|
||||
}
|
||||
}
|
||||
fun <T> x (y: Foo<List<T>>, w: java.util.ArrayList<T>) {
|
||||
val z = y["", w]
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
// "Create method 'get' from usage" "true"
|
||||
import java.util.ArrayList
|
||||
|
||||
class Foo<T> {
|
||||
fun bar(arg: String) { }
|
||||
fun <T, V> x (y: Foo<List<T>>, w: ArrayList<V>) {
|
||||
val z = y["", w]
|
||||
bar(z)
|
||||
}
|
||||
fun <V> get(s: String, w: ArrayList<V>): String {
|
||||
throw Exception("not implemented") //To change body of created methods use File | Settings | File Templates.
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
// "Create method 'get' from usage" "true"
|
||||
fun x (y: Any) {
|
||||
val z: Any = y[""]
|
||||
}
|
||||
fun Any.get(s: String): Any {
|
||||
throw Exception("not implemented") //To change body of created methods use File | Settings | File Templates.
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
// "Create method 'get' from usage" "true"
|
||||
class Foo<T> {
|
||||
fun <S> x (y: Foo<Iterable<S>>) {
|
||||
val z: Iterable<S> = y[""]
|
||||
}
|
||||
fun get(s: String): T {
|
||||
throw Exception("not implemented") //To change body of created methods use File | Settings | File Templates.
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
// "Create method 'get' from usage" "true"
|
||||
class Foo<T, S: Iterable<T>> {
|
||||
fun <U> x (y: Foo<U, Iterable<U>>) {
|
||||
val z: U = y[""]
|
||||
}
|
||||
fun get(s: String): T {
|
||||
throw Exception("not implemented") //To change body of created methods use File | Settings | File Templates.
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
// "Create method 'get' from usage" "true"
|
||||
class Foo<T> {
|
||||
fun <T, V> x (y: Foo<Iterable<T>>, w: Iterable<V>) {
|
||||
val z: Iterable<T> = y["", w]
|
||||
}
|
||||
fun <V> get(s: String, w: Iterable<V>): T {
|
||||
throw Exception("not implemented") //To change body of created methods use File | Settings | File Templates.
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
// "Create method 'get' from usage" "true"
|
||||
import java.util.ArrayList
|
||||
|
||||
class Foo<T> {
|
||||
fun <T, V> x (y: java.util.ArrayList<T>, w: java.util.ArrayList<V>) {
|
||||
val z: java.util.ArrayList<T>? = if (y["", w]) null else null
|
||||
}
|
||||
}
|
||||
fun <E, V> ArrayList<E>.get(s: String, w: ArrayList<V>): Boolean {
|
||||
throw Exception("not implemented") //To change body of created methods use File | Settings | File Templates.
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
// "Create method 'get' from usage" "true"
|
||||
import java.util.ArrayList
|
||||
|
||||
class Foo<T> {
|
||||
fun <T, V> x (y: Foo<List<T>>, w: ArrayList<V>) {
|
||||
val z: Iterable<T> = y["", w]
|
||||
}
|
||||
fun <V> get(s: String, w: ArrayList<V>): T {
|
||||
throw Exception("not implemented") //To change body of created methods use File | Settings | File Templates.
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
// "Create method 'get' from usage" "true"
|
||||
import java.util.ArrayList
|
||||
|
||||
class Foo<T> {
|
||||
fun x (y: Foo<List<T>>, w: ArrayList<T>) {
|
||||
val z: Iterable<T> = y["", w]
|
||||
}
|
||||
fun get(s: String, w: T): T {
|
||||
throw Exception("not implemented") //To change body of created methods use File | Settings | File Templates.
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
// "Create method 'get' from usage" "true"
|
||||
import java.util.ArrayList
|
||||
|
||||
class Foo<S> {
|
||||
fun <T> x (y: Foo<List<T>>, w: ArrayList<T>) {
|
||||
val z: Iterable<T> = y["", w]
|
||||
}
|
||||
fun get(s: String, w: S): S {
|
||||
throw Exception("not implemented") //To change body of created methods use File | Settings | File Templates.
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
// "Create method 'get' from usage" "true"
|
||||
class Foo<T> {
|
||||
fun x (y: Foo<Iterable<T>>) {
|
||||
val z: Iterable<T> = y<caret>[""]
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
// "Create method 'get' from usage" "true"
|
||||
class Foo<T> {
|
||||
fun <T> x (y: Foo<List<T>>, w: java.util.ArrayList<T>) {
|
||||
val z: Iterable<T> = y<caret>["", w]
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
// "Create method 'get' from usage" "true"
|
||||
class Foo<T>
|
||||
fun <T> x (y: Foo<List<T>>, w: java.util.ArrayList<T>) {
|
||||
val z: Iterable<T> = y<caret>["", w]
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
// "Create method 'get' from usage" "true"
|
||||
class Foo<T>
|
||||
fun <T> x (y: Foo<List<T>>, w: java.util.ArrayList<T>) {
|
||||
val z = y<caret>["", w]
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
// "Create method 'get' from usage" "true"
|
||||
import java.util.ArrayList
|
||||
|
||||
class Foo<T> {
|
||||
fun bar(arg: String) { }
|
||||
fun <T, V> x (y: Foo<List<T>>, w: ArrayList<V>) {
|
||||
val z = y<caret>["", w]
|
||||
bar(z)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
// "Create method 'get' from usage" "true"
|
||||
fun x (y: Any) {
|
||||
val z: Any = y<caret>[""]
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
// "Create method 'get' from usage" "true"
|
||||
class Foo<T> {
|
||||
fun <S> x (y: Foo<Iterable<S>>) {
|
||||
val z: Iterable<S> = y<caret>[""]
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
// "Create method 'get' from usage" "true"
|
||||
class Foo<T, S: Iterable<T>> {
|
||||
fun <U> x (y: Foo<U, Iterable<U>>) {
|
||||
val z: U = y<caret>[""]
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
// "Create method 'get' from usage" "true"
|
||||
class Foo<T> {
|
||||
fun <T, V> x (y: Foo<Iterable<T>>, w: Iterable<V>) {
|
||||
val z: Iterable<T> = y<caret>["", w]
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
// "Create method 'get' from usage" "true"
|
||||
class Foo<T> {
|
||||
fun <T, V> x (y: java.util.ArrayList<T>, w: java.util.ArrayList<V>) {
|
||||
val z: java.util.ArrayList<T>? = if (y<caret>["", w]) null else null
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
// "Create method 'get' from usage" "true"
|
||||
import java.util.ArrayList
|
||||
|
||||
class Foo<T> {
|
||||
fun <T, V> x (y: Foo<List<T>>, w: ArrayList<V>) {
|
||||
val z: Iterable<T> = y<caret>["", w]
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
// "Create method 'get' from usage" "true"
|
||||
import java.util.ArrayList
|
||||
|
||||
class Foo<T> {
|
||||
fun x (y: Foo<List<T>>, w: ArrayList<T>) {
|
||||
val z: Iterable<T> = y<caret>["", w]
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
// "Create method 'get' from usage" "true"
|
||||
import java.util.ArrayList
|
||||
|
||||
class Foo<S> {
|
||||
fun <T> x (y: Foo<List<T>>, w: ArrayList<T>) {
|
||||
val z: Iterable<T> = y<caret>["", w]
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
// "Create method 'hasNext' from usage" "true"
|
||||
class FooIterator<T> {
|
||||
fun next(): Int {
|
||||
throw Exception("not implemented")
|
||||
}
|
||||
fun hasNext(): Boolean {
|
||||
throw Exception("not implemented") //To change body of created methods use File | Settings | File Templates.
|
||||
}
|
||||
}
|
||||
class Foo<T> {
|
||||
fun iterator(): FooIterator<String> {
|
||||
throw Exception("not implemented")
|
||||
}
|
||||
}
|
||||
fun foo() {
|
||||
for (i: Int in Foo<Int>()) { }
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
// "Create method 'hasNext' from usage" "true"
|
||||
class FooIterator<T> {
|
||||
fun next(): T {
|
||||
throw Exception("not implemented")
|
||||
}
|
||||
fun hasNext(): Boolean {
|
||||
throw Exception("not implemented") //To change body of created methods use File | Settings | File Templates.
|
||||
}
|
||||
}
|
||||
class Foo<T> {
|
||||
fun iterator(): FooIterator<T> {
|
||||
throw Exception("not implemented")
|
||||
}
|
||||
}
|
||||
fun foo() {
|
||||
for (i in Foo<Int>()) { }
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
// "Create method 'hasNext' from usage" "true"
|
||||
class FooIterator<T> {
|
||||
fun next(): Int {
|
||||
throw Exception("not implemented")
|
||||
}
|
||||
}
|
||||
class Foo<T> {
|
||||
fun iterator(): FooIterator<String> {
|
||||
throw Exception("not implemented")
|
||||
}
|
||||
}
|
||||
fun foo() {
|
||||
for (i: Int in Foo<caret><Int>()) { }
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
// "Create method 'hasNext' from usage" "true"
|
||||
class FooIterator<T> {
|
||||
fun next(): T {
|
||||
throw Exception("not implemented")
|
||||
}
|
||||
}
|
||||
class Foo<T> {
|
||||
fun iterator(): FooIterator<T> {
|
||||
throw Exception("not implemented")
|
||||
}
|
||||
}
|
||||
fun foo() {
|
||||
for (i in Foo<caret><Int>()) { }
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
// "Create method 'iterator' from usage" "true"
|
||||
class Foo<T> {
|
||||
fun iterator(): Iterator<T> {
|
||||
throw Exception("not implemented") //To change body of created methods use File | Settings | File Templates.
|
||||
}
|
||||
}
|
||||
fun foo() {
|
||||
for (i: Int in Foo<Int>()) { }
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
// "Create method 'iterator' from usage" "true"
|
||||
class Foo<T> {
|
||||
fun iterator(): Iterator<String> {
|
||||
throw Exception("not implemented") //To change body of created methods use File | Settings | File Templates.
|
||||
}
|
||||
}
|
||||
fun foo() {
|
||||
for (i in Foo<Int>()) {
|
||||
bar(i)
|
||||
}
|
||||
}
|
||||
fun bar(i: String) { }
|
||||
@@ -0,0 +1,5 @@
|
||||
// "Create method 'iterator' from usage" "true"
|
||||
class Foo<T>
|
||||
fun foo() {
|
||||
for (i: Int in Foo<caret><Int>()) { }
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
// "Create method 'iterator' from usage" "true"
|
||||
class Foo<T>
|
||||
fun foo() {
|
||||
for (i in Foo<caret><Int>()) {
|
||||
bar(i)
|
||||
}
|
||||
}
|
||||
fun bar(i: String) { }
|
||||
@@ -0,0 +1,15 @@
|
||||
// "Create method 'next' from usage" "true"
|
||||
class FooIterator<T> {
|
||||
fun hasNext(): Boolean { return false }
|
||||
fun next(): Int {
|
||||
throw Exception("not implemented") //To change body of created methods use File | Settings | File Templates.
|
||||
}
|
||||
}
|
||||
class Foo<T> {
|
||||
fun iterator(): FooIterator<String> {
|
||||
throw Exception("not implemented")
|
||||
}
|
||||
}
|
||||
fun foo() {
|
||||
for (i: Int in Foo<Int>()) { }
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
// "Create method 'next' from usage" "true"
|
||||
class FooIterator<T> {
|
||||
fun hasNext(): Boolean { return false }
|
||||
fun next(): T {
|
||||
throw Exception("not implemented") //To change body of created methods use File | Settings | File Templates.
|
||||
}
|
||||
}
|
||||
class Foo<T> {
|
||||
fun iterator(): FooIterator<T> {
|
||||
throw Exception("not implemented")
|
||||
}
|
||||
}
|
||||
fun foo() {
|
||||
for (i: Int in Foo<Int>()) { }
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
// "Create method 'next' from usage" "true"
|
||||
class FooIterator<T> {
|
||||
fun hasNext(): Boolean { return false }
|
||||
}
|
||||
class Foo<T> {
|
||||
fun iterator(): FooIterator<String> {
|
||||
throw Exception("not implemented")
|
||||
}
|
||||
}
|
||||
fun foo() {
|
||||
for (i: Int in Foo<caret><Int>()) { }
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
// "Create method 'next' from usage" "true"
|
||||
class FooIterator<T> {
|
||||
fun hasNext(): Boolean { return false }
|
||||
}
|
||||
class Foo<T> {
|
||||
fun iterator(): FooIterator<T> {
|
||||
throw Exception("not implemented")
|
||||
}
|
||||
}
|
||||
fun foo() {
|
||||
for (i: Int in Foo<caret><Int>()) { }
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
// "Create method 'set' from usage" "true"
|
||||
class Foo<T> {
|
||||
fun <T> x (y: Foo<List<T>>, w: java.util.ArrayList<T>) {
|
||||
y["", w] = w
|
||||
}
|
||||
fun set(s: String, w: T, value: T) {
|
||||
throw Exception("not implemented") //To change body of created methods use File | Settings | File Templates.
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
// "Create method 'set' from usage" "true"
|
||||
import java.util.ArrayList
|
||||
|
||||
class Foo<T> {
|
||||
fun <T> x (y: Any, w: java.util.ArrayList<T>) {
|
||||
y["", w] = w
|
||||
}
|
||||
}
|
||||
fun <T> Any.set(s: String, w: ArrayList<T>, value: ArrayList<T>) {
|
||||
throw Exception("not implemented") //To change body of created methods use File | Settings | File Templates.
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
// "Create method 'set' from usage" "true"
|
||||
class Foo<T> {
|
||||
fun <T> x (y: Foo<List<T>>, w: java.util.ArrayList<T>) {
|
||||
y<caret>["", w] = w
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
// "Create method 'set' from usage" "true"
|
||||
class Foo<T> {
|
||||
fun <T> x (y: Any, w: java.util.ArrayList<T>) {
|
||||
y<caret>["", w] = w
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user