[FIR] Report PROPERTY_WITH_NO_TYPE_NO_INITIALIZER for all properties
Currently, PROPERTY_WITH_NO_TYPE_NO_INITIALIZER is reported for local variables, but not reported for member or top-level properties. Add a check to the common `checkPropertyInitializer` for when a property type cannot be determined from the getter. This also corrects a K1 versus K2 inconsistency, where K2 would allow blocks from getters to determine property type instead of only allowing expression bodies. ^KT-59935 Fixed ^KT-60117 Fixed ^KT-60123 Fixed
This commit is contained in:
+2
-2
@@ -1,6 +1,6 @@
|
||||
FILE: propertyGetterWithoutType.kt
|
||||
public final val prop: <ERROR TYPE REF: empty body>
|
||||
public get(): <ERROR TYPE REF: empty body> {
|
||||
public final val prop: <ERROR TYPE REF: Cannot infer variable type without initializer / getter / delegate>
|
||||
public get(): <ERROR TYPE REF: Cannot infer variable type without initializer / getter / delegate> {
|
||||
local final fun smth(s: R|kotlin/String|): R|kotlin/Int| {
|
||||
^smth Int(1)
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// ISSUE: KT-59649
|
||||
val prop
|
||||
<!PROPERTY_WITH_NO_TYPE_NO_INITIALIZER!>val prop<!>
|
||||
get() {
|
||||
fun smth(s: String) = 1
|
||||
return smth("awd")
|
||||
|
||||
Reference in New Issue
Block a user