Create From Usage: Create class by constructor call
This commit is contained in:
+8
@@ -0,0 +1,8 @@
|
||||
// "Create annotation 'bar'" "true"
|
||||
// ERROR: Unresolved reference: foo
|
||||
|
||||
[foo(1, "2", bar("3", 4))] fun test() {
|
||||
|
||||
}
|
||||
|
||||
annotation class bar(val s: String, val i: Int)
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
// "Create class 'Foo'" "true"
|
||||
|
||||
fun run<T>(f: () -> T) = f()
|
||||
|
||||
fun test() {
|
||||
run { Foo() }
|
||||
}
|
||||
|
||||
class Foo {
|
||||
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
// "Create class 'Foo'" "true"
|
||||
|
||||
fun test() {
|
||||
fun nestedTest() = Foo(2, "2")
|
||||
}
|
||||
|
||||
class Foo(i: Int, s: String) {
|
||||
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
// "Create class 'Foo'" "true"
|
||||
|
||||
class A {
|
||||
class B {
|
||||
fun test() = Foo(2, "2")
|
||||
}
|
||||
}
|
||||
|
||||
class Foo(i: Int, s: String) {
|
||||
|
||||
}
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
// "Create class 'Foo'" "true"
|
||||
// ERROR: <html>Class 'Foo' must be declared abstract or implement abstract member<br/><b>public</b> <b>abstract</b> <b>fun</b> get(thisRef: A<T>, desc: kotlin.PropertyMetadata): B <i>defined in</i> kotlin.properties.ReadOnlyProperty</html>
|
||||
|
||||
import kotlin.properties.ReadOnlyProperty
|
||||
|
||||
open class B
|
||||
|
||||
class A<T>(val t: T) {
|
||||
val x: B by Foo(t, "")
|
||||
}
|
||||
|
||||
class Foo<T>(t: T, s: String) : ReadOnlyProperty<A<T>, B> {
|
||||
|
||||
}
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
// "Create class 'Foo'" "true"
|
||||
// DISABLE-ERRORS
|
||||
|
||||
import kotlin.properties.ReadWriteProperty
|
||||
|
||||
open class B
|
||||
|
||||
class A<T>(val t: T) {
|
||||
var x: B by Foo(t, "")
|
||||
}
|
||||
|
||||
class Foo<T>(t: T, s: String) : ReadWriteProperty<A<T>, B> {
|
||||
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
// "Create class 'Foo'" "true"
|
||||
|
||||
fun test() = Foo(2, "2")
|
||||
|
||||
class Foo(i: Int, s: String) {
|
||||
|
||||
}
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
// "Create class 'Foo'" "true"
|
||||
|
||||
class A<T>(val n: T) {
|
||||
|
||||
class Foo(i: Int) {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
fun test() {
|
||||
val a = A.Foo(2)
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
// "Create class 'Foo'" "true"
|
||||
|
||||
class A(n: Int)
|
||||
|
||||
fun test() = Foo(abc = 1, ghi = A(2), def = "s")
|
||||
|
||||
class Foo(abc: Int, ghi: A, def: String) {
|
||||
|
||||
}
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
// "Create class 'Foo'" "true"
|
||||
// ERROR: <html>Type inference failed: <table><tr><td width="10%"></td><td align="right" colspan="2" style="white-space:nowrap;font-weight:bold;"><b>constructor</b> Foo<U></td><td style="white-space:nowrap;font-weight:bold;">(</td><td align="right" style="white-space:nowrap;font-weight:bold;">u: U</td><td style="white-space:nowrap;font-weight:bold;">)</td><td style="white-space:nowrap;font-weight:bold;"></td></tr><tr><td colspan="7" style="white-space:nowrap;">cannot be applied to</td></tr><tr><td width="10%"></td><td style="white-space:nowrap;"></td><td style="white-space:nowrap;"></td><td style="white-space:nowrap;"><b>(</b></td><td align="right" style="white-space:nowrap;"><font color=red><b>U</b></font></td><td style="white-space:nowrap;"><b>)</b></td></tr></table></html>
|
||||
// ERROR: <html>Type mismatch.<table><tr><td>Required:</td><td>U</td></tr><tr><td>Found:</td><td>U</td></tr></table></html>
|
||||
|
||||
class A<T>(val n: T) {
|
||||
|
||||
inner class Foo<U>(u: U) {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
fun test<U>(u: U) {
|
||||
val a = A(u).Foo(u)
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
// "Create class 'Foo'" "true"
|
||||
|
||||
fun test() {
|
||||
val a = Foo(2, "2") { (p: Int) -> p + 1 }
|
||||
}
|
||||
|
||||
class Foo(i: Int, s: String, function: Function1<Int, Int>) {
|
||||
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
// "Create class 'Foo'" "true"
|
||||
|
||||
fun test() {
|
||||
val a = Foo { (p: Int) -> p + 1 }
|
||||
}
|
||||
|
||||
class Foo(function: Function1<Int, Int>) {
|
||||
|
||||
}
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
// "Create class 'Foo'" "true"
|
||||
|
||||
object A {
|
||||
|
||||
class Foo(i: Int) {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
fun test() {
|
||||
val a = A.Foo(2)
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
// "Create class 'Foo'" "true"
|
||||
|
||||
package Foo
|
||||
|
||||
fun test() = Foo(2, "2")
|
||||
|
||||
class Foo(i: Int, s: String) {
|
||||
|
||||
}
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
// "Create class 'Foo'" "true"
|
||||
|
||||
class A<T>(val n: T) {
|
||||
|
||||
inner class Foo(i: Int) {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
fun test() {
|
||||
val a = A(1).Foo(2)
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
// "Create class 'Foo'" "true"
|
||||
|
||||
open class A
|
||||
|
||||
fun test(): A = Foo(2, "2")
|
||||
|
||||
class Foo(i: Int, s: String) : A() {
|
||||
|
||||
}
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
// "Create class 'Foo'" "true"
|
||||
// ERROR: No value passed for parameter n
|
||||
|
||||
open class A(n: Int)
|
||||
|
||||
fun test(): A = Foo(2, "2")
|
||||
|
||||
class Foo(i: Int, s: String) : A() {
|
||||
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
// "Create class 'Foo'" "true"
|
||||
|
||||
trait A
|
||||
|
||||
fun test(): A = Foo(2, "2")
|
||||
|
||||
class Foo(i: Int, s: String) : A {
|
||||
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
// "Create class 'Foo'" "true"
|
||||
|
||||
class A<T>(val n: T) {
|
||||
inner class Foo(i: Int, s: String) {
|
||||
|
||||
}
|
||||
|
||||
fun test() = this.Foo(2, "2")
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
// "Create class 'Foo'" "true"
|
||||
|
||||
class A<T>(val n: T) {
|
||||
|
||||
inner class Foo(i: Int, s: String) {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
fun <U> A<U>.test() = this.Foo(2, "2")
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
// "Create class 'Foo'" "true"
|
||||
|
||||
class A<T>(val n: T) {
|
||||
inner class B<U>(val m: U) {
|
||||
inner class Foo(i: Int, s: String) {
|
||||
|
||||
}
|
||||
|
||||
fun test() = this.Foo(2, "2")
|
||||
}
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
// "Create class 'Foo'" "true"
|
||||
|
||||
class A<T>(val n: T) {
|
||||
inner class Foo(i: Int, s: String) {
|
||||
|
||||
}
|
||||
|
||||
inner class B<U>(val m: U) {
|
||||
fun test() = this@A.Foo(2, "2")
|
||||
}
|
||||
}
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
// "Create annotation 'bar'" "true"
|
||||
// ERROR: Unresolved reference: foo
|
||||
|
||||
[foo(1, "2", bar("3", 4))] fun test() {
|
||||
|
||||
}
|
||||
|
||||
annotation class bar(val s: String, val i: Int)
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
// "Create annotation 'bar'" "true"
|
||||
// ERROR: Unresolved reference: foo
|
||||
|
||||
[foo(1, "2", bar("3"))] fun test() {
|
||||
|
||||
}
|
||||
|
||||
annotation class bar(val value: String)
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
// "Create annotation 'bar'" "true"
|
||||
// ERROR: Unresolved reference: foo
|
||||
|
||||
[foo(1, "2", bar(fooBar = "3"))] fun test() {
|
||||
|
||||
}
|
||||
|
||||
annotation class bar(val fooBar: String)
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
// "Create class 'Foo'" "true"
|
||||
|
||||
fun test() {
|
||||
Foo(2, "2")
|
||||
}
|
||||
|
||||
class Foo(i: Int, s: String) {
|
||||
|
||||
}
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
// "Create annotation 'bar'" "true"
|
||||
// ERROR: Unresolved reference: foo
|
||||
|
||||
[foo(1, "2", <caret>bar("3", 4))] fun test() {
|
||||
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
// "Create class 'Foo'" "true"
|
||||
|
||||
fun run<T>(f: () -> T) = f()
|
||||
|
||||
fun test() {
|
||||
run { <caret>Foo() }
|
||||
}
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
// "Create class 'Foo'" "true"
|
||||
|
||||
fun test() {
|
||||
fun nestedTest() = <caret>Foo(2, "2")
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
// "Create class 'Foo'" "true"
|
||||
|
||||
class A {
|
||||
class B {
|
||||
fun test() = <caret>Foo(2, "2")
|
||||
}
|
||||
}
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
// "Create class 'Foo'" "true"
|
||||
// ERROR: <html>Class 'Foo' must be declared abstract or implement abstract member<br/><b>public</b> <b>abstract</b> <b>fun</b> get(thisRef: A<T>, desc: kotlin.PropertyMetadata): B <i>defined in</i> kotlin.properties.ReadOnlyProperty</html>
|
||||
|
||||
open class B
|
||||
|
||||
class A<T>(val t: T) {
|
||||
val x: B by <caret>Foo(t, "")
|
||||
}
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
// "Create class 'Foo'" "true"
|
||||
// DISABLE-ERRORS
|
||||
|
||||
open class B
|
||||
|
||||
class A<T>(val t: T) {
|
||||
var x: B by <caret>Foo(t, "")
|
||||
}
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
// "Create class 'Foo'" "true"
|
||||
|
||||
fun test() = <caret>Foo(2, "2")
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
// "Create class 'Foo'" "true"
|
||||
|
||||
class A<T>(val n: T) {
|
||||
|
||||
}
|
||||
|
||||
fun test() {
|
||||
val a = A.<caret>Foo(2)
|
||||
}
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
// "Create class 'Foo'" "true"
|
||||
|
||||
class A(n: Int)
|
||||
|
||||
fun test() = <caret>Foo(abc = 1, ghi = A(2), def = "s")
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
// "Create class 'Foo'" "false"
|
||||
// ACTION: Create function 'Foo'
|
||||
// ACTION: Add parameter to constructor 'Foo'
|
||||
// ACTION: Split property declaration
|
||||
// ERROR: Too many arguments for public constructor Foo(a: kotlin.Int) defined in Foo
|
||||
|
||||
class Foo(a: Int)
|
||||
|
||||
fun test() {
|
||||
val a = Foo(2, <caret>"2")
|
||||
}
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
// "Create class 'Foo'" "false"
|
||||
// ACTION: Create function 'Foo'
|
||||
// ACTION: Convert to block body
|
||||
// ERROR: Unresolved reference: Foo
|
||||
|
||||
final class A
|
||||
|
||||
fun test(): A = <caret>Foo(2, "2")
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
// "Create class 'Foo'" "true"
|
||||
// ERROR: <html>Type inference failed: <table><tr><td width="10%"></td><td align="right" colspan="2" style="white-space:nowrap;font-weight:bold;"><b>constructor</b> Foo<U></td><td style="white-space:nowrap;font-weight:bold;">(</td><td align="right" style="white-space:nowrap;font-weight:bold;">u: U</td><td style="white-space:nowrap;font-weight:bold;">)</td><td style="white-space:nowrap;font-weight:bold;"></td></tr><tr><td colspan="7" style="white-space:nowrap;">cannot be applied to</td></tr><tr><td width="10%"></td><td style="white-space:nowrap;"></td><td style="white-space:nowrap;"></td><td style="white-space:nowrap;"><b>(</b></td><td align="right" style="white-space:nowrap;"><font color=red><b>U</b></font></td><td style="white-space:nowrap;"><b>)</b></td></tr></table></html>
|
||||
// ERROR: <html>Type mismatch.<table><tr><td>Required:</td><td>U</td></tr><tr><td>Found:</td><td>U</td></tr></table></html>
|
||||
|
||||
class A<T>(val n: T) {
|
||||
|
||||
}
|
||||
|
||||
fun test<U>(u: U) {
|
||||
val a = A(u).<caret>Foo(u)
|
||||
}
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
// "Create class 'Foo'" "true"
|
||||
|
||||
fun test() {
|
||||
val a = <caret>Foo(2, "2") { (p: Int) -> p + 1 }
|
||||
}
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
// "Create class 'Foo'" "true"
|
||||
|
||||
fun test() {
|
||||
val a = <caret>Foo { (p: Int) -> p + 1 }
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
// "Create class 'Foo'" "false"
|
||||
// ACTION: Create function 'Foo'
|
||||
// ACTION: Replace with infix function call
|
||||
// ACTION: Split property declaration
|
||||
// ERROR: Unresolved reference: Foo
|
||||
|
||||
fun test() {
|
||||
val a = 2.<caret>Foo(1)
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
// "Create class 'Foo'" "false"
|
||||
// ACTION: Create function 'Foo'
|
||||
// ACTION: Remove parameter 's'
|
||||
// ACTION: Split property declaration
|
||||
// ERROR: No value passed for parameter s
|
||||
|
||||
class Foo(i: Int, s: String)
|
||||
|
||||
fun test() {
|
||||
val a = Foo(2<caret>)
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
// "Create class 'Foo'" "true"
|
||||
|
||||
object A {
|
||||
|
||||
}
|
||||
|
||||
fun test() {
|
||||
val a = A.<caret>Foo(2)
|
||||
}
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
// "Create class 'Foo'" "true"
|
||||
|
||||
package Foo
|
||||
|
||||
fun test() = <caret>Foo(2, "2")
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
// "Create class 'Foo'" "true"
|
||||
|
||||
class A<T>(val n: T) {
|
||||
|
||||
}
|
||||
|
||||
fun test() {
|
||||
val a = A(1).<caret>Foo(2)
|
||||
}
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
// "Create class 'Foo'" "true"
|
||||
|
||||
open class A
|
||||
|
||||
fun test(): A = <caret>Foo(2, "2")
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
// "Create class 'Foo'" "true"
|
||||
// ERROR: No value passed for parameter n
|
||||
|
||||
open class A(n: Int)
|
||||
|
||||
fun test(): A = <caret>Foo(2, "2")
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
// "Create class 'Foo'" "true"
|
||||
|
||||
trait A
|
||||
|
||||
fun test(): A = <caret>Foo(2, "2")
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
// "Create class 'Foo'" "true"
|
||||
|
||||
class A<T>(val n: T) {
|
||||
fun test() = this.<caret>Foo(2, "2")
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
// "Create class 'Foo'" "true"
|
||||
|
||||
class A<T>(val n: T) {
|
||||
|
||||
}
|
||||
|
||||
fun <U> A<U>.test() = this.<caret>Foo(2, "2")
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
// "Create class 'Foo'" "true"
|
||||
|
||||
class A<T>(val n: T) {
|
||||
inner class B<U>(val m: U) {
|
||||
fun test() = this.<caret>Foo(2, "2")
|
||||
}
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
// "Create class 'Foo'" "true"
|
||||
|
||||
class A<T>(val n: T) {
|
||||
inner class B<U>(val m: U) {
|
||||
fun test() = this@A.<caret>Foo(2, "2")
|
||||
}
|
||||
}
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
// "Create annotation 'bar'" "true"
|
||||
// ERROR: Unresolved reference: foo
|
||||
|
||||
[foo(1, "2", <caret>bar<String, Int>("3", 4))] fun test() {
|
||||
|
||||
}
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
// "Create annotation 'bar'" "true"
|
||||
// ERROR: Unresolved reference: foo
|
||||
|
||||
[foo(1, "2", <caret>bar("3"))] fun test() {
|
||||
|
||||
}
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
// "Create annotation 'bar'" "true"
|
||||
// ERROR: Unresolved reference: foo
|
||||
|
||||
[foo(1, "2", <caret>bar(fooBar = "3"))] fun test() {
|
||||
|
||||
}
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
// "Create class 'Foo'" "true"
|
||||
|
||||
fun test() {
|
||||
<caret>Foo(2, "2")
|
||||
}
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
// "Create class 'Foo'" "false"
|
||||
// ACTION: Create function 'Foo'
|
||||
// ACTION: Convert to expression body
|
||||
// ERROR: Unresolved reference: Foo
|
||||
|
||||
fun test(): Int {
|
||||
return A().<caret>Foo(1, "2")
|
||||
}
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
class A {
|
||||
|
||||
}
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
// "Create class 'Foo'" "true"
|
||||
|
||||
class B<T>(val t: T) {
|
||||
|
||||
class Foo<U, V>(u: U, v: V) {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class A<T>(val b: B<T>) {
|
||||
fun test() = B.Foo<Int, String>(2, "2")
|
||||
}
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
// "Create class 'Foo'" "true"
|
||||
// ERROR: <html>Type mismatch.<table><tr><td>Required:</td><td>V</td></tr><tr><td>Found:</td><td>kotlin.String</td></tr></table></html>
|
||||
// ERROR: An integer literal does not conform to the expected type U
|
||||
|
||||
class B<T>(val t: T) {
|
||||
|
||||
inner class Foo<U, V>(u: U, v: V) {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class A<T>(val b: B<T>) {
|
||||
fun test() = b.Foo<Int, String>(2, "2")
|
||||
}
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
// "Create class 'Foo'" "true"
|
||||
// ERROR: <html>Type mismatch.<table><tr><td>Required:</td><td>U</td></tr><tr><td>Found:</td><td>kotlin.String</td></tr></table></html>
|
||||
|
||||
class B<T>(val t: T) {
|
||||
|
||||
inner class Foo<U>(i: Int, u: U) {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class A<T>(val b: B<T>) {
|
||||
fun test() = b.Foo<String>(2, "2")
|
||||
}
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
// "Create class 'Foo'" "true"
|
||||
// ERROR: <html>Type mismatch.<table><tr><td>Required:</td><td>W</td></tr><tr><td>Found:</td><td>kotlin.String</td></tr></table></html>
|
||||
// ERROR: An integer literal does not conform to the expected type V
|
||||
|
||||
class B<T>(val t: T) {
|
||||
|
||||
inner class Foo<U, V, W>(v: V, w: W) {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class A<T>(val b: B<T>) {
|
||||
fun test() = b.Foo<T, Int, String>(2, "2")
|
||||
}
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
// "Create class 'Foo'" "true"
|
||||
|
||||
class B<T>(val t: T) {
|
||||
|
||||
class Foo<U>(i: Int, u: U) {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class A<T>(val b: B<T>) {
|
||||
fun test() = B.Foo<String>(2, "2")
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
// "Create class 'Foo'" "true"
|
||||
|
||||
fun test() = Foo<String, Int>(2, "2")
|
||||
|
||||
class Foo<T, U>(u: U, t: T) {
|
||||
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
// "Create class 'Foo'" "true"
|
||||
|
||||
fun test() = Foo<String, Int, Boolean>(2, "2")
|
||||
|
||||
class Foo<T, U, V>(u: U, t: T) {
|
||||
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
// "Create class 'Foo'" "true"
|
||||
|
||||
fun test() = Foo<String, Int>(2, "2")
|
||||
|
||||
class Foo<T, U>(u: U, t: T) {
|
||||
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
// "Create class 'Foo'" "true"
|
||||
|
||||
fun test() = Foo<Int>(2, "2")
|
||||
|
||||
class Foo<T>(t: T, s: String) {
|
||||
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
// "Create class 'Foo'" "true"
|
||||
|
||||
open class A {
|
||||
|
||||
}
|
||||
|
||||
fun test(a: A): A = Foo<A, Int>(a, 1)
|
||||
|
||||
class Foo<T, U>(a: T, u: U) : A() {
|
||||
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
// "Create class 'Foo'" "true"
|
||||
|
||||
class B<T>(val t: T) {
|
||||
|
||||
}
|
||||
|
||||
class A<T>(val b: B<T>) {
|
||||
fun test() = B.<caret>Foo<Int, String>(2, "2")
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
// "Create class 'Foo'" "true"
|
||||
// ERROR: <html>Type mismatch.<table><tr><td>Required:</td><td>V</td></tr><tr><td>Found:</td><td>kotlin.String</td></tr></table></html>
|
||||
// ERROR: An integer literal does not conform to the expected type U
|
||||
|
||||
class B<T>(val t: T) {
|
||||
|
||||
}
|
||||
|
||||
class A<T>(val b: B<T>) {
|
||||
fun test() = b.<caret>Foo<Int, String>(2, "2")
|
||||
}
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
// "Create class 'Foo'" "true"
|
||||
// ERROR: <html>Type mismatch.<table><tr><td>Required:</td><td>U</td></tr><tr><td>Found:</td><td>kotlin.String</td></tr></table></html>
|
||||
|
||||
class B<T>(val t: T) {
|
||||
|
||||
}
|
||||
|
||||
class A<T>(val b: B<T>) {
|
||||
fun test() = b.<caret>Foo<String>(2, "2")
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
// "Create class 'Foo'" "true"
|
||||
// ERROR: <html>Type mismatch.<table><tr><td>Required:</td><td>W</td></tr><tr><td>Found:</td><td>kotlin.String</td></tr></table></html>
|
||||
// ERROR: An integer literal does not conform to the expected type V
|
||||
|
||||
class B<T>(val t: T) {
|
||||
|
||||
}
|
||||
|
||||
class A<T>(val b: B<T>) {
|
||||
fun test() = b.<caret>Foo<T, Int, String>(2, "2")
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
// "Create class 'Foo'" "true"
|
||||
|
||||
class B<T>(val t: T) {
|
||||
|
||||
}
|
||||
|
||||
class A<T>(val b: B<T>) {
|
||||
fun test() = B.<caret>Foo<String>(2, "2")
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
// "Create class 'Foo'" "false"
|
||||
// ACTION: Create function 'Foo'
|
||||
// ERROR: Unresolved reference: Foo
|
||||
|
||||
class A<T>(val items: List<T>) {
|
||||
fun test() = items.<caret>Foo<Int, String>(2, "2")
|
||||
}
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
// "Create class 'Foo'" "true"
|
||||
|
||||
fun test() = <caret>Foo<String, Int>(2, "2")
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
// "Create class 'Foo'" "true"
|
||||
|
||||
fun test() = <caret>Foo<String, Int, Boolean>(2, "2")
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
// "Create class 'Foo'" "true"
|
||||
|
||||
fun test() = <caret>Foo<kotlin.String, Int>(2, "2")
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
// "Create class 'Foo'" "true"
|
||||
|
||||
fun test() = <caret>Foo<Int>(2, "2")
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
// "Create class 'Foo'" "true"
|
||||
|
||||
open class A {
|
||||
|
||||
}
|
||||
|
||||
fun test(a: A): A = <caret>Foo<A, Int>(a, 1)
|
||||
Reference in New Issue
Block a user