Report warning about implicitly inferred nothing only for return position
^KT-31535 Fixed
This commit is contained in:
+3
-3
@@ -22223,9 +22223,9 @@ public class FirDiagnosticsSmokeTestGenerated extends AbstractFirDiagnosticsSmok
|
||||
runTest("compiler/testData/diagnostics/tests/typeParameters/implicitNothingAsTypeParameter.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("implicitNothingAsTypeParameterNI.kt")
|
||||
public void testImplicitNothingAsTypeParameterNI() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/typeParameters/implicitNothingAsTypeParameterNI.kt");
|
||||
@TestMetadata("implicitNothingOnDelegates.kt")
|
||||
public void testImplicitNothingOnDelegates() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/typeParameters/implicitNothingOnDelegates.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("misplacedConstraints.kt")
|
||||
|
||||
+14
-6
@@ -9,8 +9,11 @@ import com.intellij.psi.PsiElement
|
||||
import org.jetbrains.kotlin.builtins.isFunctionType
|
||||
import org.jetbrains.kotlin.diagnostics.Errors
|
||||
import org.jetbrains.kotlin.resolve.calls.model.ResolvedCall
|
||||
import org.jetbrains.kotlin.types.DeferredType
|
||||
import org.jetbrains.kotlin.types.TypeUtils
|
||||
import org.jetbrains.kotlin.types.expressions.ControlStructureTypingUtils
|
||||
import org.jetbrains.kotlin.types.typeUtil.isNothing
|
||||
import org.jetbrains.kotlin.types.typeUtil.isTypeParameter
|
||||
|
||||
object ImplicitNothingAsTypeParameterCallChecker : CallChecker {
|
||||
private val SPECIAL_FUNCTION_NAMES = ControlStructureTypingUtils.ResolveConstruct.values().map { it.specialFunctionName }.toSet()
|
||||
@@ -32,16 +35,21 @@ object ImplicitNothingAsTypeParameterCallChecker : CallChecker {
|
||||
* }
|
||||
*/
|
||||
override fun check(resolvedCall: ResolvedCall<*>, reportOn: PsiElement, context: CallCheckerContext) {
|
||||
if (resolvedCall.candidateDescriptor.name !in SPECIAL_FUNCTION_NAMES && resolvedCall.call.typeArguments.isEmpty()) {
|
||||
val resultingDescriptor = resolvedCall.resultingDescriptor
|
||||
val inferredReturnType = resultingDescriptor.returnType
|
||||
if (inferredReturnType is DeferredType)
|
||||
return
|
||||
if (resultingDescriptor.name !in SPECIAL_FUNCTION_NAMES && resolvedCall.call.typeArguments.isEmpty()) {
|
||||
val lambdasFromArgumentsReturnTypes =
|
||||
resolvedCall.candidateDescriptor.valueParameters.filter { it.type.isFunctionType }
|
||||
.map { it.returnType?.arguments?.last()?.type }.toSet()
|
||||
val unsubstitutedReturnType = resultingDescriptor.original.returnType
|
||||
val expectedType = context.resolutionContext.expectedType
|
||||
val hasImplicitNothing = inferredReturnType?.isNothing() == true &&
|
||||
unsubstitutedReturnType?.isTypeParameter() == true &&
|
||||
(TypeUtils.noExpectedType(expectedType) || !expectedType.isNothing())
|
||||
|
||||
val hasImplicitNothingExceptLambdaReturnTypes = resolvedCall.typeArguments.any { (unsubstitutedType, resultingType) ->
|
||||
resultingType.isNothing() && unsubstitutedType.defaultType !in lambdasFromArgumentsReturnTypes
|
||||
}
|
||||
|
||||
if (hasImplicitNothingExceptLambdaReturnTypes) {
|
||||
if (hasImplicitNothing && unsubstitutedReturnType !in lambdasFromArgumentsReturnTypes) {
|
||||
context.trace.report(Errors.IMPLICIT_NOTHING_AS_TYPE_PARAMETER.on(reportOn))
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -14,7 +14,7 @@ fun doSomething() {}
|
||||
|
||||
fun test2() {
|
||||
fun f(x: Any?) = x
|
||||
f(null?.<!IMPLICIT_NOTHING_AS_TYPE_PARAMETER, NI;IMPLICIT_NOTHING_AS_TYPE_PARAMETER!>let<!> { return })
|
||||
f(null?.let { return })
|
||||
|
||||
// false unreachable here
|
||||
doSomething()
|
||||
|
||||
+1
-1
@@ -52,7 +52,7 @@ fun testLoopLabelInReturn(xs: List<Int>) {
|
||||
|
||||
fun testValLabelInReturn() {
|
||||
<!REDUNDANT_LABEL_WARNING!>L@<!> val fn = { <!NOT_A_FUNCTION_LABEL!>return@L<!> }
|
||||
fn()
|
||||
<!IMPLICIT_NOTHING_AS_TYPE_PARAMETER!>fn<!>()
|
||||
}
|
||||
|
||||
fun testHighOrderFunctionCallLabelInReturn() {
|
||||
|
||||
+1
-1
@@ -52,7 +52,7 @@ fun testLoopLabelInReturn(xs: List<Int>) {
|
||||
|
||||
fun testValLabelInReturn() {
|
||||
<!REDUNDANT_LABEL_WARNING!>L@<!> val fn = { <!NOT_A_FUNCTION_LABEL_WARNING!>return@L<!> }
|
||||
fn()
|
||||
<!IMPLICIT_NOTHING_AS_TYPE_PARAMETER!>fn<!>()
|
||||
}
|
||||
|
||||
fun testHighOrderFunctionCallLabelInReturn() {
|
||||
|
||||
@@ -24,7 +24,7 @@ fun foo(x: MC<out Open>) {
|
||||
x.addAll(<!NI;TYPE_MISMATCH, OI;TYPE_MISMATCH_DUE_TO_TYPE_PROJECTIONS!>mc<Derived>()<!>)
|
||||
x.addAllMC(<!NI;TYPE_MISMATCH, OI;TYPE_MISMATCH_DUE_TO_TYPE_PROJECTIONS!>mc<Derived>()<!>)
|
||||
|
||||
x.addAll(<!IMPLICIT_NOTHING_AS_TYPE_PARAMETER, NI;IMPLICIT_NOTHING_AS_TYPE_PARAMETER!>c<!>())
|
||||
x.addAll(c())
|
||||
x.addAll(c<Nothing>())
|
||||
|
||||
x.<!OI;MEMBER_PROJECTED_OUT!>addAllInv<!>(<!NI;TYPE_MISMATCH!>mc<Open>()<!>)
|
||||
|
||||
+1
-1
@@ -17,7 +17,7 @@ fun test(a: A<out CharSequence>, z: Out<CharSequence>) {
|
||||
<!NI;TYPE_MISMATCH, NI;TYPE_MISMATCH, TYPE_MISMATCH!>""<!>
|
||||
}
|
||||
a.bar { <!NI;TYPE_MISMATCH, NI;TYPE_MISMATCH, NI;TYPE_MISMATCH, TYPE_MISMATCH!>Out<CharSequence>()<!> }
|
||||
a.bar { <!IMPLICIT_NOTHING_AS_TYPE_PARAMETER!>Out<!>() }
|
||||
a.bar { Out() }
|
||||
a.bar { <!NI;TYPE_MISMATCH, NI;TYPE_MISMATCH, TYPE_MISMATCH!>z.id()<!> }
|
||||
|
||||
a.foo {
|
||||
|
||||
+2
-2
@@ -14,9 +14,9 @@ class A<T> {
|
||||
|
||||
fun foo2(a: A<out CharSequence>, b: A<in CharSequence>) {
|
||||
a.<!OI;TYPE_INFERENCE_UPPER_BOUND_VIOLATED!>foo1<!>(<!NI;TYPE_MISMATCH!>Out<CharSequence>()<!>)
|
||||
a.foo1<<!UPPER_BOUND_VIOLATED!>Out<CharSequence><!>>(<!NI;TYPE_MISMATCH!><!NI;IMPLICIT_NOTHING_AS_TYPE_PARAMETER, NI;IMPLICIT_NOTHING_AS_TYPE_PARAMETER!>Out<!>()<!>)
|
||||
a.foo1<<!UPPER_BOUND_VIOLATED!>Out<CharSequence><!>>(<!NI;TYPE_MISMATCH!>Out()<!>)
|
||||
|
||||
a.foo1(<!IMPLICIT_NOTHING_AS_TYPE_PARAMETER, NI;IMPLICIT_NOTHING_AS_TYPE_PARAMETER!>Out<!>())
|
||||
a.foo1(Out())
|
||||
a.foo1(Out<Nothing>())
|
||||
|
||||
a.<!OI;TYPE_INFERENCE_INCORPORATION_ERROR!>foo2<!>(<!NI;TYPE_MISMATCH!><!OI;TYPE_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>Inv<!>()<!>)
|
||||
|
||||
+1
-1
@@ -7,6 +7,6 @@ fun foo1() {
|
||||
<!NI;NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER, OI;TYPE_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>fooT22<!>()
|
||||
}
|
||||
|
||||
val n : Nothing = null.<!IMPLICIT_NOTHING_AS_TYPE_PARAMETER!>sure<!>()
|
||||
val n : Nothing = null.sure()
|
||||
|
||||
fun <T : Any> T?.sure() : T = this!!
|
||||
|
||||
Vendored
+2
-2
@@ -9,8 +9,8 @@ inline fun <reified T> foo2(f: (T) -> Unit): Foo<T> = Foo()
|
||||
|
||||
fun test1() {
|
||||
val f1: Foo<out Int> = foo1 { it checkType { _<Int>() } }
|
||||
val f2: Foo<in Nothing> = <!IMPLICIT_NOTHING_AS_TYPE_PARAMETER!>foo1<!> { it <!UNREACHABLE_CODE!><!IMPLICIT_NOTHING_AS_TYPE_PARAMETER!>checkType<!> { _<Nothing>() }<!> }
|
||||
val f2: Foo<in Nothing> = foo1 { it <!UNREACHABLE_CODE!>checkType { _<Nothing>() }<!> }
|
||||
|
||||
val f3: Foo<out Int> = foo2 { it checkType { _<Int>() } }
|
||||
val f4: Foo<in Nothing> = <!IMPLICIT_NOTHING_AS_TYPE_PARAMETER, REIFIED_TYPE_FORBIDDEN_SUBSTITUTION!>foo2<!> { it <!UNREACHABLE_CODE!><!IMPLICIT_NOTHING_AS_TYPE_PARAMETER!>checkType<!> { _<Nothing>() }<!> }
|
||||
val f4: Foo<in Nothing> = <!REIFIED_TYPE_FORBIDDEN_SUBSTITUTION!>foo2<!> { it <!UNREACHABLE_CODE!>checkType { _<Nothing>() }<!> }
|
||||
}
|
||||
+1
-1
@@ -13,5 +13,5 @@ fun test(s: String): String {
|
||||
a checkType { _<String>() }
|
||||
|
||||
<!UNREACHABLE_CODE!>val b =<!> TestClass { return s }
|
||||
<!UNREACHABLE_CODE!>b <!IMPLICIT_NOTHING_AS_TYPE_PARAMETER!>checkType<!> { _<Nothing>() }<!>
|
||||
<!UNREACHABLE_CODE!>b checkType { _<Nothing>() }<!>
|
||||
}
|
||||
Vendored
+1
-1
@@ -11,5 +11,5 @@ fun test(s: String): String {
|
||||
a checkType { _<TestClass>() }
|
||||
|
||||
<!UNREACHABLE_CODE!>val b =<!> TestClass { return s }
|
||||
<!UNREACHABLE_CODE!>b <!IMPLICIT_NOTHING_AS_TYPE_PARAMETER!>checkType<!> { _<Nothing>() }<!>
|
||||
<!UNREACHABLE_CODE!>b checkType { _<Nothing>() }<!>
|
||||
}
|
||||
+1
-1
@@ -8,7 +8,7 @@ class TestClass {
|
||||
|
||||
fun <T> test(value: T, test: TestClass): T {
|
||||
<!UNREACHABLE_CODE!>val x =<!> test { return value }
|
||||
<!UNREACHABLE_CODE!>x <!IMPLICIT_NOTHING_AS_TYPE_PARAMETER!>checkType<!> { _<Nothing>() }<!>
|
||||
<!UNREACHABLE_CODE!>x checkType { _<Nothing>() }<!>
|
||||
|
||||
<!UNREACHABLE_CODE!>return value<!>
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ public class TestClass {
|
||||
fun run() {
|
||||
val testClass = TestClass()
|
||||
// inferred as `set<Nothing>()`, return type is Nothing!
|
||||
testClass.<!OI;IMPLICIT_NOTHING_AS_TYPE_PARAMETER!>set<!>("test", null)
|
||||
testClass.set("test", null)
|
||||
|
||||
// Should not be unreachable
|
||||
run()
|
||||
|
||||
@@ -22,5 +22,5 @@ public class Element {
|
||||
import p.*
|
||||
|
||||
fun test(v: Visitor<Nothing>, e: Element) {
|
||||
e.<!NI;IMPLICIT_NOTHING_AS_TYPE_PARAMETER!>accept<!>(v, null)
|
||||
e.accept(v, null)
|
||||
}
|
||||
|
||||
+1
-1
@@ -5,5 +5,5 @@ val <!IMPLICIT_NOTHING_PROPERTY_TYPE!>y<!> get() = null!!
|
||||
|
||||
fun foo() {
|
||||
<!DEBUG_INFO_CONSTANT!>x<!> checkType { _<Nothing?>() }
|
||||
y <!UNREACHABLE_CODE!><!IMPLICIT_NOTHING_AS_TYPE_PARAMETER!>checkType<!> { _<Nothing>() }<!>
|
||||
y <!UNREACHABLE_CODE!>checkType { _<Nothing>() }<!>
|
||||
}
|
||||
|
||||
+52
-5
@@ -1,4 +1,4 @@
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER -UNCHECKED_CAST
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER -UNUSED_VARIABLE -UNCHECKED_CAST
|
||||
// !WITH_NEW_INFERENCE
|
||||
// SKIP_TXT
|
||||
// Issue: KT-20849
|
||||
@@ -7,8 +7,8 @@ fun <T>test_1(x: T): T = null as T
|
||||
fun <T>test_2(x: () -> T): T = null as T
|
||||
|
||||
fun case_1() {
|
||||
null?.<!IMPLICIT_NOTHING_AS_TYPE_PARAMETER!>run<!> { return }
|
||||
null!!.<!UNREACHABLE_CODE!><!IMPLICIT_NOTHING_AS_TYPE_PARAMETER!>run<!> { throw Exception() }<!>
|
||||
null?.run { return }
|
||||
null!!.<!UNREACHABLE_CODE!>run { throw Exception() }<!>
|
||||
}
|
||||
|
||||
fun case_2() {
|
||||
@@ -39,6 +39,53 @@ class Context<T>
|
||||
|
||||
fun <T> Any.decodeIn(typeFrom: Context<in T>): T = something()
|
||||
|
||||
fun <T> Any?.decodeOut(typeFrom: Context<out T>): T {
|
||||
return this?.<!IMPLICIT_NOTHING_AS_TYPE_PARAMETER, NI;IMPLICIT_NOTHING_AS_TYPE_PARAMETER!>decodeIn<!>(typeFrom) ?: <!UNRESOLVED_REFERENCE!>error<!>("")
|
||||
fun <T> Any?.decodeOut1(typeFrom: Context<out T>): T {
|
||||
return <!NI;TYPE_MISMATCH!>this?.<!IMPLICIT_NOTHING_AS_TYPE_PARAMETER, NI;IMPLICIT_NOTHING_AS_TYPE_PARAMETER!>decodeIn<!>(typeFrom) ?: <!OI;TYPE_MISMATCH!>kotlin.Unit<!><!>
|
||||
}
|
||||
|
||||
fun <T> Any.decodeOut2(typeFrom: Context<out T>): T {
|
||||
<!UNREACHABLE_CODE!>val x: Nothing =<!> this.decodeIn(typeFrom)
|
||||
}
|
||||
|
||||
fun <T> Any.decodeOut3(typeFrom: Context<out T>): T {
|
||||
<!UNREACHABLE_CODE!>val x =<!> this.<!IMPLICIT_NOTHING_AS_TYPE_PARAMETER!>decodeIn<!>(typeFrom)
|
||||
}
|
||||
|
||||
fun <T> Any.decodeOut4(typeFrom: Context<out T>): T {
|
||||
<!UNREACHABLE_CODE!>val x: Any =<!> this.<!IMPLICIT_NOTHING_AS_TYPE_PARAMETER!>decodeIn<!>(typeFrom)
|
||||
}
|
||||
|
||||
class TrieNode<out E> {
|
||||
companion object {
|
||||
internal val EMPTY = TrieNode<Nothing>()
|
||||
}
|
||||
}
|
||||
class PersistentHashSet<out E>(root: TrieNode<E>) {
|
||||
companion object {
|
||||
internal val EMPTY = PersistentHashSet(TrieNode.EMPTY)
|
||||
}
|
||||
}
|
||||
|
||||
interface F<in T>
|
||||
fun <T> F<T>.join() = {}
|
||||
|
||||
fun main() {
|
||||
val f: Any = Any()
|
||||
(f as F<*>).join()
|
||||
}
|
||||
|
||||
fun bug(worker: Worker<Unit>) {
|
||||
stateless<Boolean, Nothing, Unit> {
|
||||
onWorkerOutput(worker)
|
||||
}
|
||||
}
|
||||
|
||||
fun <StateT, OutputT : Any, T> RenderContext<StateT, OutputT>.onWorkerOutput(worker: Worker<T>): Unit = Unit
|
||||
|
||||
fun <InputT, OutputT : Any, RenderingT> stateless(
|
||||
render: RenderContext<Nothing, OutputT>.(input: InputT) -> RenderingT
|
||||
) { }
|
||||
|
||||
interface Worker<out T>
|
||||
|
||||
interface RenderContext<StateT, in OutputT : Any>
|
||||
|
||||
-49
@@ -1,49 +0,0 @@
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER -UNCHECKED_CAST
|
||||
// !LANGUAGE: +NewInference
|
||||
// SKIP_TXT
|
||||
// Issue: KT-20849
|
||||
|
||||
fun <T>test_1(x: T.() -> T): T = null as T
|
||||
fun <T>test_2(x: (T) -> T): T = null as T
|
||||
fun <T>test_3(x: T.(T) -> T): T = null as T
|
||||
fun <T>test_4(x: T.(T) -> List<T>): T = null as T
|
||||
fun <T>test_5(): List<T> = 10 <!CAST_NEVER_SUCCEEDS!>as<!> List<T>
|
||||
fun <K, V>test_6(): Map<K, V> = 10 <!CAST_NEVER_SUCCEEDS!>as<!> Map<K, V>
|
||||
|
||||
fun case_1() {
|
||||
<!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>test_5<!>()
|
||||
<!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>test_6<!>()
|
||||
val <!UNUSED_VARIABLE!>x<!> = <!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>test_6<!>()
|
||||
}
|
||||
|
||||
fun case_2() {
|
||||
<!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>test_1<!> { null!! }
|
||||
}
|
||||
|
||||
fun case_3() {
|
||||
<!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>test_2<!> { null!! }
|
||||
}
|
||||
|
||||
fun case_4() {
|
||||
<!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>test_3<!> { null!! }
|
||||
}
|
||||
|
||||
fun case_5() {
|
||||
<!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>test_4<!> { null!! }
|
||||
}
|
||||
|
||||
fun case_6() {
|
||||
<!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>test_1<!> { throw <!DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE!>Exception<!>() }
|
||||
}
|
||||
|
||||
fun case_7() {
|
||||
<!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>test_2<!> { throw Exception() }
|
||||
}
|
||||
|
||||
fun case_8() {
|
||||
<!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>test_3<!> { throw <!DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE!>Exception<!>() }
|
||||
}
|
||||
|
||||
fun case_9() {
|
||||
<!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>test_4<!> { throw <!DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE!>Exception<!>() }
|
||||
}
|
||||
+23
@@ -0,0 +1,23 @@
|
||||
// !DIAGNOSTICS: -UNCHECKED_CAST
|
||||
// !WITH_NEW_INFERENCE
|
||||
// WITH_RUNTIME
|
||||
// WITH_REFLECT
|
||||
// SKIP_TXT
|
||||
|
||||
import kotlin.reflect.*
|
||||
|
||||
private object Scope {
|
||||
class Inv<T>
|
||||
|
||||
class Delegate<T>(private val p: Inv<in T>) {
|
||||
operator fun getValue(thisRef: Any?, property: KProperty<*>): T {
|
||||
return materialize()
|
||||
}
|
||||
}
|
||||
|
||||
fun <T> materialize(): T = Any() as T
|
||||
|
||||
fun test(i: Inv<out Number>) {
|
||||
val <!UNUSED_VARIABLE!>p<!>: Int by <!IMPLICIT_NOTHING_AS_TYPE_PARAMETER!>Scope.Delegate(i)<!>
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -13,4 +13,4 @@ fun <T> listOf(): List<T> = null!!
|
||||
// since it has 'out' type projection in 'in' position.
|
||||
val test1 = <!UNRESOLVED_REFERENCE!>BOutIn<!>(<!OI;TYPE_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>listOf<!>(), null!!)
|
||||
|
||||
val test2 = <!OI;EXPANDED_TYPE_CANNOT_BE_CONSTRUCTED!><!OI;IMPLICIT_NOTHING_AS_TYPE_PARAMETER!>BInIn<!>(<!OI;IMPLICIT_NOTHING_AS_TYPE_PARAMETER!>listOf<!>(), null!!)<!>
|
||||
val test2 = <!OI;EXPANDED_TYPE_CANNOT_BE_CONSTRUCTED!>BInIn(listOf(), null!!)<!>
|
||||
@@ -4,12 +4,12 @@ fun test(mc: MutableCollection<out CharSequence>) {
|
||||
mc.addAll(<!TYPE_MISMATCH_DUE_TO_TYPE_PROJECTIONS!>mc<!>)
|
||||
|
||||
mc.addAll(<!TYPE_MISMATCH_DUE_TO_TYPE_PROJECTIONS!>arrayListOf<CharSequence>()<!>)
|
||||
mc.addAll(<!IMPLICIT_NOTHING_AS_TYPE_PARAMETER, NI;IMPLICIT_NOTHING_AS_TYPE_PARAMETER!>arrayListOf<!>())
|
||||
mc.addAll(arrayListOf())
|
||||
|
||||
mc.addAll(<!TYPE_MISMATCH_DUE_TO_TYPE_PROJECTIONS!>listOf("")<!>)
|
||||
mc.addAll(<!TYPE_MISMATCH_DUE_TO_TYPE_PROJECTIONS!>listOf<String>("")<!>)
|
||||
mc.addAll(<!NI;TYPE_MISMATCH, TYPE_MISMATCH_DUE_TO_TYPE_PROJECTIONS!>listOf<CharSequence>("")<!>)
|
||||
|
||||
mc.addAll(<!IMPLICIT_NOTHING_AS_TYPE_PARAMETER, NI;IMPLICIT_NOTHING_AS_TYPE_PARAMETER!>emptyList<!>())
|
||||
mc.addAll(emptyList())
|
||||
mc.addAll(emptyList<Nothing>())
|
||||
}
|
||||
|
||||
+1
-1
@@ -3,7 +3,7 @@
|
||||
import kotlin.coroutines.experimental.*
|
||||
import kotlin.coroutines.experimental.intrinsics.*
|
||||
|
||||
suspend fun suspendLogAndThrow(exception: Throwable): Nothing = <!IMPLICIT_NOTHING_AS_TYPE_PARAMETER!>suspendCoroutineUninterceptedOrReturn<!> { c ->
|
||||
suspend fun suspendLogAndThrow(exception: Throwable): Nothing = suspendCoroutineUninterceptedOrReturn { c ->
|
||||
c.resumeWithException(exception)
|
||||
COROUTINE_SUSPENDED
|
||||
}
|
||||
|
||||
+2
-2
@@ -2,7 +2,7 @@
|
||||
import kotlin.coroutines.*
|
||||
import kotlin.coroutines.intrinsics.*
|
||||
|
||||
suspend fun suspendLogAndThrow(exception: Throwable): Nothing = <!IMPLICIT_NOTHING_AS_TYPE_PARAMETER!>suspendCoroutineUninterceptedOrReturn<!> { c ->
|
||||
c.<!IMPLICIT_NOTHING_AS_TYPE_PARAMETER!>resumeWithException<!>(exception)
|
||||
suspend fun suspendLogAndThrow(exception: Throwable): Nothing = suspendCoroutineUninterceptedOrReturn { c ->
|
||||
c.resumeWithException(exception)
|
||||
COROUTINE_SUSPENDED
|
||||
}
|
||||
|
||||
+1
-1
@@ -6,7 +6,7 @@ inline fun<reified T> foo(block: () -> T): String = block().toString()
|
||||
inline fun <reified T: Any> javaClass(): Class<T> = T::class.java
|
||||
|
||||
fun box() {
|
||||
val a = <!IMPLICIT_NOTHING_AS_TYPE_PARAMETER, REIFIED_TYPE_FORBIDDEN_SUBSTITUTION, UNSUPPORTED!>arrayOf<!>(null!!)
|
||||
val a = <!REIFIED_TYPE_FORBIDDEN_SUBSTITUTION, UNSUPPORTED!>arrayOf<!>(null!!)
|
||||
val b = <!UNSUPPORTED!>Array<!><<!REIFIED_TYPE_FORBIDDEN_SUBSTITUTION!>Nothing?<!>>(5) { null!! }
|
||||
val c = <!REIFIED_TYPE_FORBIDDEN_SUBSTITUTION!>foo<!>() { null!! }
|
||||
val d = foo<Any> { null!! }
|
||||
|
||||
+2
-2
@@ -228,11 +228,11 @@ fun case_7(value_1: String?) {
|
||||
}
|
||||
when {
|
||||
value_1.case_7_10() == null -> println(value_1)
|
||||
<!DEBUG_INFO_CONSTANT!>value_1<!>.<!IMPLICIT_NOTHING_AS_TYPE_PARAMETER!>case_7_10<!>() != null -> println(<!DEBUG_INFO_CONSTANT!>value_1<!>)
|
||||
<!DEBUG_INFO_CONSTANT!>value_1<!>.case_7_10() != null -> println(<!DEBUG_INFO_CONSTANT!>value_1<!>)
|
||||
}
|
||||
when {
|
||||
value_1.case_7_11() != null -> println(value_1)
|
||||
<!DEBUG_INFO_CONSTANT!>value_1<!>.<!IMPLICIT_NOTHING_AS_TYPE_PARAMETER!>case_7_11<!>() == null -> println(<!DEBUG_INFO_CONSTANT!>value_1<!>)
|
||||
<!DEBUG_INFO_CONSTANT!>value_1<!>.case_7_11() == null -> println(<!DEBUG_INFO_CONSTANT!>value_1<!>)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -89,7 +89,7 @@ fun case_3(value_1: Int?, value_2: Any?) {
|
||||
if (!value_1.case_3(value_1, value_2 is Number?)) {
|
||||
println(<!DEBUG_INFO_SMARTCAST!>value_2<!>?.toByte())
|
||||
println(<!DEBUG_INFO_SMARTCAST!>value_1<!>.inv())
|
||||
} else if (<!DEBUG_INFO_CONSTANT!>value_1<!>.<!IMPLICIT_NOTHING_AS_TYPE_PARAMETER!>case_3<!>(<!DEBUG_INFO_CONSTANT!>value_1<!>, value_2 is Number?)) {
|
||||
} else if (<!DEBUG_INFO_CONSTANT!>value_1<!>.case_3(<!DEBUG_INFO_CONSTANT!>value_1<!>, value_2 is Number?)) {
|
||||
println(<!DEBUG_INFO_CONSTANT!>value_1<!>)
|
||||
} else {
|
||||
<!UNREACHABLE_CODE!>println(<!><!DEBUG_INFO_SMARTCAST!>value_1<!><!UNREACHABLE_CODE!>.inv())<!>
|
||||
|
||||
@@ -74,7 +74,7 @@ fun case_4(x: Boolean?, y: Boolean?) {
|
||||
// TESTCASE NUMBER: 5
|
||||
fun case_5(x: Boolean?, y: Boolean?) {
|
||||
while (true) {
|
||||
y.<!UNREACHABLE_CODE!><!IMPLICIT_NOTHING_AS_TYPE_PARAMETER!>to<!>(<!>break<!UNREACHABLE_CODE!>)<!>
|
||||
y.<!UNREACHABLE_CODE!>to(<!>break<!UNREACHABLE_CODE!>)<!>
|
||||
<!UNREACHABLE_CODE!>x!!<!>
|
||||
}
|
||||
|
||||
|
||||
+3
-3
@@ -22305,9 +22305,9 @@ public class DiagnosticsTestGenerated extends AbstractDiagnosticsTest {
|
||||
runTest("compiler/testData/diagnostics/tests/typeParameters/implicitNothingAsTypeParameter.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("implicitNothingAsTypeParameterNI.kt")
|
||||
public void testImplicitNothingAsTypeParameterNI() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/typeParameters/implicitNothingAsTypeParameterNI.kt");
|
||||
@TestMetadata("implicitNothingOnDelegates.kt")
|
||||
public void testImplicitNothingOnDelegates() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/typeParameters/implicitNothingOnDelegates.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("misplacedConstraints.kt")
|
||||
|
||||
Generated
+3
-3
@@ -22225,9 +22225,9 @@ public class DiagnosticsUsingJavacTestGenerated extends AbstractDiagnosticsUsing
|
||||
runTest("compiler/testData/diagnostics/tests/typeParameters/implicitNothingAsTypeParameter.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("implicitNothingAsTypeParameterNI.kt")
|
||||
public void testImplicitNothingAsTypeParameterNI() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/typeParameters/implicitNothingAsTypeParameterNI.kt");
|
||||
@TestMetadata("implicitNothingOnDelegates.kt")
|
||||
public void testImplicitNothingOnDelegates() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/typeParameters/implicitNothingOnDelegates.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("misplacedConstraints.kt")
|
||||
|
||||
Reference in New Issue
Block a user