J2K: not initialized field of non-primitive type should have null initializer

#KT-11544 Fixed
This commit is contained in:
Natalia Ukhorskaya
2016-03-23 13:54:13 +03:00
parent 8616c9588d
commit 4bc4f0bce7
16 changed files with 73 additions and 24 deletions
+1 -2
View File
@@ -1,5 +1,4 @@
// ERROR: Unresolved reference: Foo
// ERROR: Property must be initialized or be abstract
internal class C {
var f: Foo
var f: Foo? = null
}
+22
View File
@@ -0,0 +1,22 @@
public class Init {
public String field1;
public String field2;
public int field3;
public int field4;
public Init() {
field1 = "str";
field3 = 1;
String prop1;
prop1 = "aaa";
String prop2;
int prop3;
prop3 = 1;
int prop4;
}
}
+22
View File
@@ -0,0 +1,22 @@
class Init {
var field1: String
var field2: String? = null
var field3: Int = 0
var field4: Int = 0
init {
field1 = "str"
field3 = 1
val prop1: String
prop1 = "aaa"
val prop2: String
val prop3: Int
prop3 = 1
val prop4: Int
}
}
+1 -2
View File
@@ -1,5 +1,4 @@
// ERROR: Unresolved reference: Foo
// ERROR: Property must be initialized or be abstract
internal class C {
protected var f: Foo
protected var f: Foo? = null
}
+1 -2
View File
@@ -1,5 +1,4 @@
// ERROR: Unresolved reference: Foo
// ERROR: Property must be initialized or be abstract
internal class C {
var f: Foo
var f: Foo? = null
}
+1 -2
View File
@@ -1,5 +1,4 @@
// ERROR: Unresolved reference: Foo
// ERROR: Property must be initialized or be abstract
internal class C {
var f: Foo
var f: Foo? = null
}