supported some generics constrcutors and methods for KT-540
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
package demo;
|
||||
|
||||
class Collection<E> {
|
||||
Collection(E e) {
|
||||
System.out.println(e);
|
||||
}
|
||||
}
|
||||
|
||||
class Test {
|
||||
void main() {
|
||||
Collection raw1 = new Collection(1);
|
||||
Collection raw2 = new Collection<Integer>(1);
|
||||
Collection raw3 = new Collection<String>("1");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
namespace demo {
|
||||
open class Collection<E>(e : E?) {
|
||||
{
|
||||
System.out?.println(e)
|
||||
}
|
||||
}
|
||||
open class Test() {
|
||||
open fun main() : Unit {
|
||||
var raw1 : Collection<*>? = Collection(1)
|
||||
var raw2 : Collection<*>? = Collection<Int?>(1)
|
||||
var raw3 : Collection<*>? = Collection<String?>("1")
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package demo;
|
||||
|
||||
class TestT {
|
||||
<T> void getT() { }
|
||||
}
|
||||
|
||||
class U {
|
||||
void main() {
|
||||
TestT t = new TestT();
|
||||
t.<String>getT();
|
||||
t.<Integer>getT();
|
||||
t.getT();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
namespace demo {
|
||||
open class TestT() {
|
||||
open fun getT<T>() : Unit {
|
||||
}
|
||||
}
|
||||
open class U() {
|
||||
open fun main() : Unit {
|
||||
var t : TestT? = TestT()
|
||||
t?.getT<String?>()
|
||||
t?.getT<Int?>()
|
||||
t?.getT()
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user