Extraction Engine: Suggest both bounds for nullability-flexible types without nullability annotations. Do not omit return type if inferred one is flexible
#KT-6837 Fixed
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
// WITH_RUNTIME
|
||||
// SUGGESTED_RETURN_TYPES: kotlin.Boolean?, kotlin.Boolean
|
||||
// PARAM_DESCRIPTOR: value-parameter val it: kotlin.Map.Entry<(Boolean..Boolean?), (Boolean..Boolean?)> defined in test.<anonymous>
|
||||
// PARAM_TYPES: kotlin.Map.Entry<(Boolean..Boolean?), (Boolean..Boolean?)>
|
||||
fun test() {
|
||||
|
||||
+2
-1
@@ -1,8 +1,9 @@
|
||||
// WITH_RUNTIME
|
||||
// SUGGESTED_RETURN_TYPES: kotlin.Boolean?, kotlin.Boolean
|
||||
// PARAM_DESCRIPTOR: value-parameter val it: kotlin.Map.Entry<(Boolean..Boolean?), (Boolean..Boolean?)> defined in test.<anonymous>
|
||||
// PARAM_TYPES: kotlin.Map.Entry<(Boolean..Boolean?), (Boolean..Boolean?)>
|
||||
fun test() {
|
||||
J.getMap().filter { b(it) }
|
||||
}
|
||||
|
||||
private fun b(it: Map.Entry<Boolean, Boolean>) = it.getKey()
|
||||
private fun b(it: Map.Entry<Boolean, Boolean>): Boolean? = it.getKey()
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class J {
|
||||
@NotNull
|
||||
static String notNull() {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
// WITH_RUNTIME
|
||||
// SUGGESTED_NAMES: s, getS
|
||||
fun test() {
|
||||
val s = <selection>J.notNull()</selection>
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
// WITH_RUNTIME
|
||||
// SUGGESTED_NAMES: s, getS
|
||||
fun test() {
|
||||
val s = s()
|
||||
}
|
||||
|
||||
private fun s(): String = J.notNull()
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
public class J {
|
||||
@Nullable
|
||||
static String nullable() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
// SUGGESTED_NAMES: s, getS
|
||||
fun test() {
|
||||
val s = <selection>J.nullable()</selection>
|
||||
}
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
// SUGGESTED_NAMES: s, getS
|
||||
fun test() {
|
||||
val s = s()
|
||||
}
|
||||
|
||||
private fun s(): String? = J.nullable()
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
public class J {
|
||||
static String unknown() {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
// SUGGESTED_NAMES: s, getS
|
||||
// SUGGESTED_RETURN_TYPES: kotlin.String?, kotlin.String
|
||||
fun test() {
|
||||
val s = <selection>J.unknown()</selection>
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
// SUGGESTED_NAMES: s, getS
|
||||
// SUGGESTED_RETURN_TYPES: kotlin.String?, kotlin.String
|
||||
fun test() {
|
||||
val s = s()
|
||||
}
|
||||
|
||||
private fun s(): String? = J.unknown()
|
||||
+1
-1
@@ -15,4 +15,4 @@ class Foo<T> {
|
||||
}
|
||||
}
|
||||
|
||||
private fun <T> Foo<T>.t(l: String) = map[l]
|
||||
private fun <T> Foo<T>.t(l: String): T = map[l]
|
||||
+1
-1
@@ -11,5 +11,5 @@ class Foo<T> {
|
||||
return t(l)
|
||||
}
|
||||
|
||||
private fun t(l: String) = map[l]
|
||||
private fun t(l: String): T = map[l]
|
||||
}
|
||||
Reference in New Issue
Block a user