[FIR] Report UNRESOLVED_REFERENCE on the first unresolved qualifier

#KT-55471 Fixed
This commit is contained in:
Kirill Rakhman
2023-08-28 12:44:36 +02:00
committed by Space Team
parent 40fadac060
commit 10f7989af6
69 changed files with 177 additions and 456 deletions
@@ -27644,6 +27644,12 @@ public class DiagnosticCompilerTestFE10TestdataTestGenerated extends AbstractDia
runTest("compiler/testData/diagnostics/tests/resolve/localObject.kt");
}
@Test
@TestMetadata("nestedClassUnresolvedReference.kt")
public void testNestedClassUnresolvedReference() throws Exception {
runTest("compiler/testData/diagnostics/tests/resolve/nestedClassUnresolvedReference.kt");
}
@Test
@TestMetadata("newLineLambda.kt")
public void testNewLineLambda() throws Exception {
@@ -27644,6 +27644,12 @@ public class LLFirPreresolvedReversedDiagnosticCompilerFE10TestDataTestGenerated
runTest("compiler/testData/diagnostics/tests/resolve/localObject.kt");
}
@Test
@TestMetadata("nestedClassUnresolvedReference.kt")
public void testNestedClassUnresolvedReference() throws Exception {
runTest("compiler/testData/diagnostics/tests/resolve/nestedClassUnresolvedReference.kt");
}
@Test
@TestMetadata("newLineLambda.kt")
public void testNewLineLambda() throws Exception {
@@ -1,3 +1,3 @@
FILE: fakeRecursiveTypealias.kt
public final typealias My = <ERROR TYPE REF: Symbol not found for incorrect.directory.My>
public final typealias My = <ERROR TYPE REF: Symbol not found for incorrect>
public final typealias Your = <ERROR TYPE REF: Loop in supertype: /Your -> /Your>
@@ -1,5 +1,5 @@
import <!UNRESOLVED_IMPORT!>incorrect<!>.directory.Your
typealias My = <!UNRESOLVED_REFERENCE!>incorrect.directory.My<!>
typealias My = <!UNRESOLVED_REFERENCE!>incorrect<!>.directory.My
typealias Your = <!RECURSIVE_TYPEALIAS_EXPANSION!>Your<!>
@@ -58,6 +58,6 @@ class Test6 : E, <!EXPOSED_SUPER_CLASS, FINAL_SUPERTYPE, SUPERTYPE_NOT_INITIALIZ
}
class Test7 : <!UNRESOLVED_REFERENCE!>D.PublicButProtected<!> {
class Test7 : D.<!UNRESOLVED_REFERENCE!>PublicButProtected<!> {
}
@@ -27644,6 +27644,12 @@ public class FirLightTreeOldFrontendDiagnosticsTestGenerated extends AbstractFir
runTest("compiler/testData/diagnostics/tests/resolve/localObject.kt");
}
@Test
@TestMetadata("nestedClassUnresolvedReference.kt")
public void testNestedClassUnresolvedReference() throws Exception {
runTest("compiler/testData/diagnostics/tests/resolve/nestedClassUnresolvedReference.kt");
}
@Test
@TestMetadata("newLineLambda.kt")
public void testNewLineLambda() throws Exception {
@@ -27656,6 +27656,12 @@ public class FirPsiOldFrontendDiagnosticsTestGenerated extends AbstractFirPsiDia
runTest("compiler/testData/diagnostics/tests/resolve/localObject.kt");
}
@Test
@TestMetadata("nestedClassUnresolvedReference.kt")
public void testNestedClassUnresolvedReference() throws Exception {
runTest("compiler/testData/diagnostics/tests/resolve/nestedClassUnresolvedReference.kt");
}
@Test
@TestMetadata("newLineLambda.kt")
public void testNewLineLambda() throws Exception {
@@ -7,6 +7,7 @@ package org.jetbrains.kotlin.fir.analysis.diagnostics
import org.jetbrains.kotlin.KtFakeSourceElementKind
import org.jetbrains.kotlin.KtNodeTypes
import org.jetbrains.kotlin.KtRealSourceElementKind
import org.jetbrains.kotlin.KtSourceElement
import org.jetbrains.kotlin.descriptors.ClassKind
import org.jetbrains.kotlin.diagnostics.*
@@ -56,7 +57,18 @@ private fun ConeDiagnostic.toKtDiagnostic(
is ConeUnresolvedSymbolError -> FirErrors.UNRESOLVED_REFERENCE.createOn(source, this.classId.asString(), null)
is ConeUnresolvedNameError -> FirErrors.UNRESOLVED_REFERENCE.createOn(source, name.asString(), operatorToken)
is ConeUnresolvedTypeQualifierError -> FirErrors.UNRESOLVED_REFERENCE.createOn(source, this.qualifier, null)
is ConeUnresolvedTypeQualifierError -> {
if (source?.kind == KtRealSourceElementKind) {
// this.qualifiers will contain all resolved qualifiers from the left up to (including) the first unresolved qualifier.
// We want to report UNRESOLVED_REFERENCE exactly on the first unresolved qualifier with its name as argument.
// Examples: <!UNRESOLVED_REFERENCE!>Unresolved<!>, <!UNRESOLVED_REFERENCE!>Unresolved<!>.Foo,
// Resolved.<!UNRESOLVED_REFERENCE!>Unresolved<!>, Resolved.<!UNRESOLVED_REFERENCE!>Unresolved<!>.Foo
val lastQualifier = this.qualifiers.last()
FirErrors.UNRESOLVED_REFERENCE.createOn(lastQualifier.source, lastQualifier.name.asString(), null)
} else {
FirErrors.UNRESOLVED_REFERENCE.createOn(source, this.qualifier, null)
}
}
is ConeFunctionCallExpectedError -> FirErrors.FUNCTION_CALL_EXPECTED.createOn(source, this.name.asString(), this.hasValueParameters)
is ConeFunctionExpectedError -> FirErrors.FUNCTION_EXPECTED.createOn(source, this.expression, this.type)
is ConeNoConstructorError -> FirErrors.NO_CONSTRUCTOR.createOn(callOrAssignmentSource ?: source)
@@ -20,6 +20,7 @@ import org.jetbrains.kotlin.fir.recordTypeLookup
import org.jetbrains.kotlin.fir.render
import org.jetbrains.kotlin.fir.resolve.FirTypeResolutionResult
import org.jetbrains.kotlin.fir.resolve.SupertypeSupplier
import org.jetbrains.kotlin.fir.resolve.diagnostics.ConeUnresolvedTypeQualifierError
import org.jetbrains.kotlin.fir.resolve.diagnostics.ConeUnsupportedDefaultValueInFunctionType
import org.jetbrains.kotlin.fir.resolve.transformers.body.resolve.resultType
import org.jetbrains.kotlin.fir.resolve.typeResolver
@@ -145,26 +146,7 @@ class FirSpecificTypeResolverTransformer(
): FirResolvedTypeRef {
return when {
resolvedType is ConeErrorType -> {
buildErrorTypeRef {
val typeRefSourceKind = typeRef.source?.kind
val diagnosticSource = (resolvedType.diagnostic as? ConeUnexpectedTypeArgumentsError)?.source
source = if (diagnosticSource != null) {
if (typeRefSourceKind is KtFakeSourceElementKind) {
diagnosticSource.fakeElement(typeRefSourceKind)
} else {
diagnosticSource
}
} else {
typeRef.source
}
delegatedTypeRef = typeRef
type = resolvedType
partiallyResolvedTypeRef = tryCalculatingPartiallyResolvedTypeRef(typeRef, scopeClassDeclaration)
this.diagnostic = resolvedType.diagnostic
}
buildErrorType(typeRef, resolvedType, scopeClassDeclaration)
}
diagnostic != null -> {
buildErrorTypeRef {
@@ -186,6 +168,45 @@ class FirSpecificTypeResolverTransformer(
}
}
private fun buildErrorType(
typeRef: FirTypeRef,
resolvedType: ConeErrorType,
scopeClassDeclaration: ScopeClassDeclaration,
): FirErrorTypeRef {
return buildErrorTypeRef {
var diagnostic = resolvedType.diagnostic
val typeRefSourceKind = typeRef.source?.kind
val diagnosticSource = (diagnostic as? ConeUnexpectedTypeArgumentsError)?.source
source = if (diagnosticSource != null) {
if (typeRefSourceKind is KtFakeSourceElementKind) {
diagnosticSource.fakeElement(typeRefSourceKind)
} else {
diagnosticSource
}
} else {
typeRef.source
}
delegatedTypeRef = typeRef
type = resolvedType
val partiallyResolvedTypeRef = tryCalculatingPartiallyResolvedTypeRef(typeRef, scopeClassDeclaration)
this.partiallyResolvedTypeRef = partiallyResolvedTypeRef
if (diagnostic is ConeUnresolvedTypeQualifierError) {
val totalQualifierCount = diagnostic.qualifiers.size
val resolvedQualifierCount = (partiallyResolvedTypeRef?.delegatedTypeRef as? FirUserTypeRef)?.qualifier?.size ?: 0
val unresolvedQualifierCount = totalQualifierCount - resolvedQualifierCount
if (unresolvedQualifierCount > 1) {
diagnostic = ConeUnresolvedTypeQualifierError(diagnostic.qualifiers.dropLast(unresolvedQualifierCount - 1), false)
}
}
this.diagnostic = diagnostic
}
}
/**
* Tries to calculate a partially resolved type reference for a type reference which was resolved to an error type.
* It will attempt to resolve the type with a decreasing number of qualifiers until it succeeds, allowing
@@ -197,7 +218,7 @@ class FirSpecificTypeResolverTransformer(
* @param data The scope class declaration containing relevant information for resolving the reference.
* @return A partially resolved type reference if it was resolved, or `null` otherwise.
*/
private fun tryCalculatingPartiallyResolvedTypeRef(typeRef: FirTypeRef, data: ScopeClassDeclaration): FirTypeRef? {
private fun tryCalculatingPartiallyResolvedTypeRef(typeRef: FirTypeRef, data: ScopeClassDeclaration): FirResolvedTypeRef? {
if (typeRef !is FirUserTypeRef) return null
val qualifiers = typeRef.qualifier
if (qualifiers.size <= 1) {
@@ -9,7 +9,7 @@ package foo
fun f() {
class Local1 {
fun g() : <!UNRESOLVED_REFERENCE!>bar.X<!>? = null
fun g() : <!UNRESOLVED_REFERENCE!>bar<!>.X? = null
}
class Local2 {
fun g() : foo.bar.X? = null
@@ -6,8 +6,8 @@ package foobar.a
import java.*
val a : <!PLATFORM_CLASS_MAPPED_TO_KOTLIN!>java.util.List<Int><!>? = null
val a2 : <!UNRESOLVED_REFERENCE!>util.List<Int><!>? = null
val a3 : <!UNRESOLVED_REFERENCE!>LinkedList<Int><!>? = null
val a2 : <!UNRESOLVED_REFERENCE!>util<!>.List<Int>? = null
val a3 : <!UNRESOLVED_REFERENCE!>LinkedList<!><Int>? = null
// FILE: b.kt
package foobar
@@ -21,7 +21,7 @@ package foobar.a
import java.util.*
val b : List<Int>? = <!INITIALIZER_TYPE_MISMATCH!>a<!>
val b1 : <!UNRESOLVED_REFERENCE!>util.List<Int><!>? = a
val b1 : <!UNRESOLVED_REFERENCE!>util<!>.List<Int>? = a
// FILE: d.kt
package foobar
+2 -2
View File
@@ -15,10 +15,10 @@ import <!PLATFORM_CLASS_MAPPED_TO_KOTLIN!>java.lang.Comparable<!> as Com
val l : MutableList<in Int> = ArrayList<Int>()
fun test(l : <!PLATFORM_CLASS_MAPPED_TO_KOTLIN!>java.util.List<Int><!>) {
val <!UNUSED_VARIABLE!>x<!> : <!UNRESOLVED_REFERENCE!>java.List<!>
val <!UNUSED_VARIABLE!>x<!> : <!UNRESOLVED_REFERENCE!>java<!>.List
val <!UNUSED_VARIABLE!>y<!> : <!PLATFORM_CLASS_MAPPED_TO_KOTLIN!>java.util.List<Int><!>
val <!UNUSED_VARIABLE!>b<!> : <!PLATFORM_CLASS_MAPPED_TO_KOTLIN!>java.lang.Object<!>
val <!UNUSED_VARIABLE!>z<!> : <!UNRESOLVED_REFERENCE!>java.utils.List<Int><!>
val <!UNUSED_VARIABLE!>z<!> : <!UNRESOLVED_REFERENCE!>java<!>.utils.List<Int>
val <!UNUSED_VARIABLE!>f<!> : java.io.File? = null
@@ -1,5 +1,5 @@
@<!UNRESOLVED_REFERENCE!>Ann<!> class A
@<!UNRESOLVED_REFERENCE!>Ann<!> class B
@<!UNRESOLVED_REFERENCE!>Ann<!>(1) class C
@<!UNRESOLVED_REFERENCE!>kotlin.Ann<!>(1) class D
@<!UNRESOLVED_REFERENCE!>kotlin.annotation.Ann<!>(1) class E
@<!UNRESOLVED_REFERENCE!>kotlin<!>.Ann(1) class D
@<!UNRESOLVED_REFERENCE!>kotlin<!>.annotation.Ann(1) class E
@@ -1,10 +1,10 @@
class DTO {
val q: Int = 0
operator fun get(prop: <!UNRESOLVED_REFERENCE!>KProperty1<*, Int><!>): Int = 0
operator fun get(prop: <!UNRESOLVED_REFERENCE!>KProperty1<!><*, Int>): Int = 0
}
fun foo(intDTO: DTO?, p: <!UNRESOLVED_REFERENCE!>KProperty1<*, Int><!>) {
fun foo(intDTO: DTO?, p: <!UNRESOLVED_REFERENCE!>KProperty1<!><*, Int>) {
if (intDTO != null) {
intDTO[DTO::q]
intDTO.q
@@ -1 +0,0 @@
fun testing(a: Any) = a is <!UNRESOLVED_REFERENCE!>UnresolvedType<Int><!>
@@ -1 +1,2 @@
// FIR_IDENTICAL
fun testing(a: Any) = a is <!UNRESOLVED_REFERENCE!>UnresolvedType<!><Int>
@@ -22,7 +22,7 @@ object DefaultHttpClientWithFun : HttpClient by fClient() {
private fun fClient() = HttpClientImpl()
private fun <T> lazy(init: () -> T): <!UNRESOLVED_REFERENCE!>kotlin.Lazy<T><!> {
private fun <T> lazy(init: () -> T): <!UNRESOLVED_REFERENCE!>kotlin<!>.Lazy<T> {
init()
null!!
}
@@ -1,82 +0,0 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER
// SKIP_TXT
// Issues: KT-25105
class Message1
class Task<T>
object Message2
enum class Message3
data class Message4(val x: Int)
interface Manager<T> {}
object MessageManager1 : Manager<Message1> {
fun <T : <!FINAL_UPPER_BOUND!>Message1<!>> execute1(task: Task<T>) {}
fun <T : <!FINAL_UPPER_BOUND!>Int<!>> execute2(task: T) {}
fun <T : <!FINAL_UPPER_BOUND!>Message2<!>> execute3() {}
}
object MessageManager2 : Manager<Message3> {
fun <T : Message3> execute4() {}
}
object MessageManager3 : Manager<Message4> {
fun <T : <!FINAL_UPPER_BOUND!>Message4<!>> execute5() {}
}
class MessageManager4 : Manager<Message1> {
fun <T : <!FINAL_UPPER_BOUND!>Message1<!>> execute1(task: Task<T>) {}
fun <T : <!FINAL_UPPER_BOUND!>Int<!>> execute2(task: T) {}
fun <T : <!FINAL_UPPER_BOUND!>Message2<!>> execute3() {}
}
class MessageManager5 : Manager<Message3> {
fun <T : Message3> execute4() {}
}
class MessageManager6 : Manager<Message4> {
fun <T : <!FINAL_UPPER_BOUND!>Message4<!>> execute5() {}
}
interface MessageManager7 : Manager<Message4> {
fun <T : <!FINAL_UPPER_BOUND!>Message4<!>> execute5() {}
}
interface MessageManager8 : Manager<Message1> {
fun <T : <!FINAL_UPPER_BOUND!>Message1<!>> execute1(task: Task<T>) {}
fun <T : <!FINAL_UPPER_BOUND!>Int<!>> execute2(task: T) {}
fun <T : <!FINAL_UPPER_BOUND!>Message2<!>> execute3() {}
}
interface MessageManager9 : Manager<Message3> {
fun <T : Message3> execute4() {}
}
object MessageManager10 : <!UNRESOLVED_REFERENCE!>Message5<Int><!>() {
fun <T : <!FINAL_UPPER_BOUND!>Int<!>> execute() {}
}
class MessageManager11<A> : <!UNRESOLVED_REFERENCE!>Message5<<!UNRESOLVED_REFERENCE!>Message5<A><!>><!>() {
fun <T : <!UNRESOLVED_REFERENCE!>Message5<A><!>> execute() {}
}
data class MessageManager12(val x: Int) : <!UNRESOLVED_REFERENCE!>Message5<Message2><!>() {
fun <T : <!FINAL_UPPER_BOUND!>Message2<!>> execute() {}
}
sealed class MessageManager13<A> : <!UNRESOLVED_REFERENCE!>Message5<A><!>() {
fun <T : A> execute() {}
}
class MessageManager14 : Manager<Message2> {
val <T : <!FINAL_UPPER_BOUND!>Message2<!>> T.x get() = 10
var <T : <!FINAL_UPPER_BOUND!>Message2<!>> T.y
get() = 10
set(value) {}
}
object MessageManager15 : Manager<Int> {
val <T : <!FINAL_UPPER_BOUND!>Int<!>> T.x get() = 10
var <T : <!FINAL_UPPER_BOUND!>Int<!>> T.y
get() = 10
set(value) {}
}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
// !DIAGNOSTICS: -UNUSED_PARAMETER
// SKIP_TXT
// Issues: KT-25105
@@ -29,7 +29,7 @@ fun test() {
a<Foo.Bar<!WRONG_NUMBER_OF_TYPE_ARGUMENTS!><Int><!>.Baz>()
}
fun <T: Foo<<!UNRESOLVED_REFERENCE!>String.Bar<!>>> x() {}
fun <T: Foo<String.<!UNRESOLVED_REFERENCE!>Bar<!>>> x() {}
fun Foo<String>.<!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>Bar<!>.ext() {}
fun ex1(a: Foo<!WRONG_NUMBER_OF_TYPE_ARGUMENTS!><String><!>.Bar<String>): Foo<!WRONG_NUMBER_OF_TYPE_ARGUMENTS!><String><!>.Bar<String> {
@@ -1,22 +0,0 @@
// !LANGUAGE: +ProhibitVisibilityOfNestedClassifiersFromSupertypesOfCompanion
// !DIAGNOSTICS: -UNUSED_PARAMETER -UNUSED_VARIABLE
open class Outer<E> {
inner class Inner<F>
}
class Derived : Outer<String>() {
// Inner<Int> here means Outer<String>.Inner<Int>
fun foo(x: Inner<Int>) {}
}
class A {
companion object : Outer<String>()
// Does not work, could be Outer<String>.Inner<Int>
// TODO: Should work?
fun foo(x: <!UNRESOLVED_REFERENCE!>Inner<Int><!>) {
// Inner<Char>() call use companion as implicit receiver
val y: Outer<String>.Inner<Char> = Inner<Char>()
}
}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
// !LANGUAGE: +ProhibitVisibilityOfNestedClassifiersFromSupertypesOfCompanion
// !DIAGNOSTICS: -UNUSED_PARAMETER -UNUSED_VARIABLE
open class Outer<E> {
@@ -15,7 +15,7 @@ class A {
// Does not work, could be Outer<String>.Inner<Int>
// TODO: Should work?
fun foo(x: <!UNRESOLVED_REFERENCE!>Inner<Int><!>) {
fun foo(x: <!UNRESOLVED_REFERENCE!>Inner<!><Int>) {
// Inner<Char>() call use companion as implicit receiver
val y: Outer<String>.Inner<Char> = Inner<Char>()
}
@@ -7,14 +7,14 @@ open class Outer<X, Y> {
class Derived : Outer<String, Int>() {
fun foo(): Inner<Char> = null!!
fun baz(): <!UNRESOLVED_REFERENCE!>Alias<Char><!> = null!!
fun baz(): <!UNRESOLVED_REFERENCE!>Alias<!><Char> = null!!
}
class A : Outer<Double, Short>() {
class B : Outer<Float, Long>() {
fun bar(): Inner<String> = null!!
fun x(): <!UNRESOLVED_REFERENCE!>Alias<String><!> = null!!
fun x(): <!UNRESOLVED_REFERENCE!>Alias<!><String> = null!!
}
}
@@ -14,7 +14,7 @@ private fun <E> foobar() = {
class Derived : LocalOuter<Double, Short>() {
fun foo(): LocalInner<Long> = null!!
fun bar(): <!UNRESOLVED_REFERENCE!>LocalAlias<Char><!> = null!!
fun bar(): <!UNRESOLVED_REFERENCE!>LocalAlias<!><Char> = null!!
}
Derived()
@@ -31,7 +31,7 @@ private fun noParameters() = {
class Derived2 : LocalOuter2<Double, Short>() {
fun foo(): LocalInner2<Long> = null!!
fun bar(): <!UNRESOLVED_REFERENCE!>LocalAlias2<Char><!> = null!!
fun bar(): <!UNRESOLVED_REFERENCE!>LocalAlias2<!><Char> = null!!
}
Derived2()
@@ -16,7 +16,7 @@ class Outer<T> {
class Derived : LocalOuter<Double, Short>() {
fun foo(): LocalInner<Long> = null!!
fun bar(): <!UNRESOLVED_REFERENCE!>LocalAlias<Char><!> = null!!
fun bar(): <!UNRESOLVED_REFERENCE!>LocalAlias<!><Char> = null!!
}
Derived()
@@ -33,7 +33,7 @@ class Outer<T> {
class Derived2 : LocalOuter2<Double, Short>() {
fun foo(): LocalInner2<Long> = null!!
fun bar(): <!UNRESOLVED_REFERENCE!>LocalAlias2<Char><!> = null!!
fun bar(): <!UNRESOLVED_REFERENCE!>LocalAlias2<!><Char> = null!!
}
Derived2()
}
@@ -10,7 +10,7 @@ open class BaseDerived2<X> : BaseDerived1<String, X>()
class Derived : BaseDerived2<Int>() {
fun foo(): Inner<Char> = null!!
fun baz(): <!UNRESOLVED_REFERENCE!>Alias<Char><!> = null!!
fun baz(): <!UNRESOLVED_REFERENCE!>Alias<!><Char> = null!!
}
fun foo() {
@@ -38,7 +38,7 @@ fun ok4(): Outer.Obj.Nested2<A>.Inner5<B> = null!!
fun ok5(): test.Outer.Obj.Nested2<A>.Inner5<B> = null!!
// All arguments are resolved
fun errorTypeWithArguments(): <!UNRESOLVED_REFERENCE!>Q<A>.W<B, C, D>.R.M<!> = null!!
fun errorTypeWithArguments(): <!UNRESOLVED_REFERENCE!>Q<!><A>.W<B, C, D>.R.M = null!!
fun error1(): Outer<A>.Inner<B>.Inner3<!WRONG_NUMBER_OF_TYPE_ARGUMENTS!><C, D><!> = null!!
fun error2(): Outer<A>.Inner<!WRONG_NUMBER_OF_TYPE_ARGUMENTS!><B, C, D><!>.Inner2 = null!!
@@ -1,14 +0,0 @@
interface I0<T : <!UNRESOLVED_REFERENCE!>Unresolved0<String><!>>
interface I1<T> where T : <!UNRESOLVED_REFERENCE!>Unresolved1<String><!>
interface I2<<!MISPLACED_TYPE_PARAMETER_CONSTRAINTS!>T : <!UNRESOLVED_REFERENCE!>Unresolved2<String><!><!>> where T : <!UNRESOLVED_REFERENCE!>Unresolved3<String><!>
fun <E : <!UNRESOLVED_REFERENCE!>Unresolved4<String><!>> foo0() {}
fun <E> foo1() where E : <!UNRESOLVED_REFERENCE!>Unresolved5<String><!> {}
fun <<!MISPLACED_TYPE_PARAMETER_CONSTRAINTS!>E : <!UNRESOLVED_REFERENCE!>Unresolved6<String><!><!>> foo2() where E : <!UNRESOLVED_REFERENCE!>Unresolved7<String><!> {}
val <E : <!UNRESOLVED_REFERENCE!>Unresolved7<!>> E.p1: Int
get() = 1
val <E> E.p2: Int where E : <!UNRESOLVED_REFERENCE!>Unresolved8<!>
get() = 1
val <<!MISPLACED_TYPE_PARAMETER_CONSTRAINTS!>E : <!UNRESOLVED_REFERENCE!>Unresolved9<!><!>> E.p3: Int where E : <!UNRESOLVED_REFERENCE!>Unresolved10<!>
get() = 1
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
interface I0<T : <!UNRESOLVED_REFERENCE!>Unresolved0<!><String>>
interface I1<T> where T : <!UNRESOLVED_REFERENCE!>Unresolved1<!><String>
interface I2<<!MISPLACED_TYPE_PARAMETER_CONSTRAINTS!>T : <!UNRESOLVED_REFERENCE!>Unresolved2<!><String><!>> where T : <!UNRESOLVED_REFERENCE!>Unresolved3<!><String>
@@ -14,4 +14,4 @@ package c
import a.<!PACKAGE_CANNOT_BE_IMPORTED!>x<!>
import b.<!PACKAGE_CANNOT_BE_IMPORTED!>x<!>
class Y : <!UNRESOLVED_REFERENCE!>x.X<!>
class Y : <!UNRESOLVED_REFERENCE!>x<!>.X
@@ -1,7 +0,0 @@
abstract class MyClass {
abstract fun <P1> foo(): (P1) -> <!UNRESOLVED_REFERENCE!>Unknown<String><!>
private fun callTryConvertConstant() {
<!UNRESOLVED_REFERENCE!>println<!>(foo<String>())
}
}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
abstract class MyClass {
abstract fun <P1> foo(): (P1) -> <!UNRESOLVED_REFERENCE!>Unknown<!><String>
@@ -1,30 +0,0 @@
// !LANGUAGE: +PartiallySpecifiedTypeArguments
// !DIAGNOSTICS: -UNCHECKED_CAST
// WITH_STDLIB
fun <K, T> foo(x: (K) -> T): Pair<K, T> = (1 as K) to (1f as T)
@Repeatable
@Target(AnnotationTarget.TYPE)
annotation class Anno
@Repeatable
@Target(AnnotationTarget.TYPE)
annotation class Anno2
@Repeatable
@Target(AnnotationTarget.TYPE)
annotation class Anno3(val x: String)
fun box(): String {
val x = foo<@Anno Int, <!UNSUPPORTED("annotations on an underscored type argument")!>@Anno<!> _> { it.toFloat() }
val y: Pair<Int, Float> = foo<@[<!UNSUPPORTED!>Anno<!> <!UNSUPPORTED!>Anno2<!>] _, <!UNSUPPORTED!>@Anno<!> _> { it.toFloat() }
val z1: Pair<Int, Float> = foo<<!UNSUPPORTED!>@Anno<!> <!UNSUPPORTED!>@Anno2<!> /**/ _, @[/**/ <!UNSUPPORTED!>Anno<!> /**/ ] _> { it.toFloat() }
val z2: Pair<Int, Float> = foo<<!UNSUPPORTED!>@Anno3("")<!> /**/ _, @[/**/ <!UNSUPPORTED!>Anno<!> /**/ <!UNSUPPORTED!>Anno3("")<!> /**/] _,> { it.toFloat() }
val z31: Pair<<!UNRESOLVED_REFERENCE!>@Anno3("") _<!>, Float> = 1 to 1f
val z33: Pair<<!UNRESOLVED_REFERENCE!>@Anno3("") (_)<!>, Float> = 1 to 1f
val z35: Pair<<!UNRESOLVED_REFERENCE!>(@Anno3("") (_))<!>, Float> = 1 to 1f
return "OK"
}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
// !LANGUAGE: +PartiallySpecifiedTypeArguments
// !DIAGNOSTICS: -UNCHECKED_CAST
// WITH_STDLIB
@@ -1 +1 @@
<!MUST_BE_INITIALIZED!>val <<!TYPE_PARAMETER_OF_PROPERTY_NOT_USED_IN_RECEIVER!>T : <!UNRESOLVED_REFERENCE!>KClass<T>.something<!><!>> abc<!>
<!MUST_BE_INITIALIZED!>val <<!TYPE_PARAMETER_OF_PROPERTY_NOT_USED_IN_RECEIVER!>T : <!UNRESOLVED_REFERENCE!>KClass<!><T>.something<!>> abc<!>
@@ -6,7 +6,7 @@ fun <K, T> foo(x: (K) -> T): Pair<K, T> = (1 as K) to (1f as T)
class Foo<K>
class Bar0<K : <!UNRESOLVED_REFERENCE!>_<<!UNRESOLVED_REFERENCE!>_<!>><!>>
class Bar0<K : <!UNRESOLVED_REFERENCE!>_<!><<!UNRESOLVED_REFERENCE!>_<!>>>
class Bar1<K : Foo<<!UNRESOLVED_REFERENCE!>_<!>>>
class Bar2<K : <!UNRESOLVED_REFERENCE!>_<!>>
class Bar3<K> where K : <!UNRESOLVED_REFERENCE!>_<!>
@@ -16,7 +16,7 @@ typealias A1<<!UNDERSCORE_IS_RESERVED!>_<!>> = <!TYPEALIAS_SHOULD_EXPAND_TO_CLAS
typealias A2<T> = Foo<<!UNRESOLVED_REFERENCE!>_<!>>
typealias A3<T> = (<!UNRESOLVED_REFERENCE!>_<!>) -> T
typealias A4<T> = (T) -> () -> <!UNRESOLVED_REFERENCE!>_<!>
typealias A5<T> = (T) -> (<!UNRESOLVED_REFERENCE!>((_))<!>) -> T
typealias A5<T> = (T) -> (((<!UNRESOLVED_REFERENCE!>_<!>))) -> T
fun foo1(x: <!UNDERSCORE_USAGE_WITHOUT_BACKTICKS, UNRESOLVED_REFERENCE!>_<!>) {}
fun foo2(x: Foo<<!UNDERSCORE_USAGE_WITHOUT_BACKTICKS, UNRESOLVED_REFERENCE!>_<!>>) {}
@@ -33,14 +33,14 @@ fun <`_`> bar(): Foo<_> = TODO()
fun test() {
val x1 = foo<Int, (<!UNRESOLVED_REFERENCE!>_<!>) -> Unit> { { it } }
val x2 = foo<Int, (Int) -> <!UNRESOLVED_REFERENCE!>_<!>> { { it } }
val x3 = foo<Int, (<!UNRESOLVED_REFERENCE!>(_)<!>) -> <!UNRESOLVED_REFERENCE!>_<!>> { { it } }
val x3 = foo<Int, ((<!UNRESOLVED_REFERENCE!>_<!>)) -> <!UNRESOLVED_REFERENCE!>_<!>> { { it } }
val x4 = <!FUNCTION_CALL_EXPECTED!>foo<!><!UNRESOLVED_REFERENCE!><<!>Int<!SYNTAX!>, _ -> Float><!> { { <!UNRESOLVED_REFERENCE!>it<!> } }
val x5 = foo<Int, Foo<(<!UNRESOLVED_REFERENCE!>_<!>) -> Float>> { <!ARGUMENT_TYPE_MISMATCH!>{ it }<!> }
val x6 = foo<Int, Foo<(<!UNRESOLVED_REFERENCE!>_<!>) -> <!UNRESOLVED_REFERENCE!>_<!>>> { <!ARGUMENT_TYPE_MISMATCH!>{ it }<!> }
val x7 = foo<Int, Foo<(Int) -> <!UNRESOLVED_REFERENCE!>_<!>>> { <!ARGUMENT_TYPE_MISMATCH!>{ it }<!> }
val z32: Pair<<!UNRESOLVED_REFERENCE!>_<!>, Float> = 1 to 1f
val z34: Pair<<!UNRESOLVED_REFERENCE!>((_))<!>, Float> = 1 to 1f
val z34: Pair<((<!UNRESOLVED_REFERENCE!>_<!>)), Float> = 1 to 1f
val x8: (Float) -> Int = { x: <!UNDERSCORE_USAGE_WITHOUT_BACKTICKS, UNRESOLVED_REFERENCE!>_<!> -> 10 }
val x9: (Foo<Float>) -> Int = { x: Foo<<!UNDERSCORE_USAGE_WITHOUT_BACKTICKS, UNRESOLVED_REFERENCE!>_<!>> -> 10 }
@@ -58,7 +58,7 @@ fun test() {
val x13: Foo<@<!UNDERSCORE_USAGE_WITHOUT_BACKTICKS, UNRESOLVED_REFERENCE!>_<!>() Int>? = null
val x14: Foo<@Anno(<!UNDERSCORE_USAGE_WITHOUT_BACKTICKS, UNRESOLVED_REFERENCE!>_<!>) Int>? = null
val x15: <!UNRESOLVED_REFERENCE!>_<<!UNRESOLVED_REFERENCE!>_<!>><!>? = null
val x15: <!UNRESOLVED_REFERENCE!>_<!><<!UNRESOLVED_REFERENCE!>_<!>>? = null
}
@Target(AnnotationTarget.TYPE)
@@ -1,64 +0,0 @@
// !DIAGNOSTICS: -UNUSED_VARIABLE
// FILE: A.java
public class A {
static class NC {}
class IC {}
static interface NI {}
}
// FILE: I.java
public interface I {
class NC {}
interface NI {}
}
// FILE: B.java
public class B extends A {
}
// FILE: C.java
public class C implements I {
}
// FILE: D.java
public class D extends A implements I {
}
// FILE: K.kt
class K : D()
// FILE: test.kt
fun test() {
val ac: A.NC = A.NC()
val aic: A.IC = A().IC()
val ai: A.NI? = null
val ic: I.NC = I.NC()
val ii: I.NI? = null
val bc: <!UNRESOLVED_REFERENCE!>B.NC<!> = B.<!UNRESOLVED_REFERENCE!>NC<!>()
val bic: <!UNRESOLVED_REFERENCE!>B.IC<!> = B().IC()
val bi: <!UNRESOLVED_REFERENCE!>B.NI<!>? = null
val cc: <!UNRESOLVED_REFERENCE!>C.NC<!> = C.<!UNRESOLVED_REFERENCE!>NC<!>()
val ci: <!UNRESOLVED_REFERENCE!>C.NI<!>? = null
val dc: <!UNRESOLVED_REFERENCE!>D.NC<!> = D.<!UNRESOLVED_REFERENCE!>NC<!>()
val dic: <!UNRESOLVED_REFERENCE!>D.IC<!> = D().IC()
val di: <!UNRESOLVED_REFERENCE!>D.NI<!>? = null
val kc: <!UNRESOLVED_REFERENCE!>K.NC<!> = K.<!UNRESOLVED_REFERENCE!>NC<!>()
val kic: <!UNRESOLVED_REFERENCE!>K.IC<!> = K().IC()
val ki: <!UNRESOLVED_REFERENCE!>K.NI<!>? = null
}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
// !DIAGNOSTICS: -UNUSED_VARIABLE
// FILE: A.java
@@ -1,44 +0,0 @@
// !DIAGNOSTICS: -UNUSED_VARIABLE
open class A {
class NC {}
inner class IC {}
interface NI {}
}
interface I {
class NC {}
interface NI {}
}
class B : A() {
}
class C : I {
}
class D : A(), I {
}
fun test() {
val ac: A.NC = A.NC()
val aic: A.IC = A().IC()
val ai: A.NI? = null
val ic: I.NC = I.NC()
val ii: I.NI? = null
val bc: <!UNRESOLVED_REFERENCE!>B.NC<!> = B.<!UNRESOLVED_REFERENCE!>NC<!>()
val bic: <!UNRESOLVED_REFERENCE!>B.IC<!> = B().IC()
val bi: <!UNRESOLVED_REFERENCE!>B.NI<!>? = null
val cc: <!UNRESOLVED_REFERENCE!>C.NC<!> = C.<!UNRESOLVED_REFERENCE!>NC<!>()
val ci: <!UNRESOLVED_REFERENCE!>C.NI<!>? = null
val dc: <!UNRESOLVED_REFERENCE!>D.NC<!> = D.<!UNRESOLVED_REFERENCE!>NC<!>()
val dic: <!UNRESOLVED_REFERENCE!>D.IC<!> = D().IC()
val di: <!UNRESOLVED_REFERENCE!>D.NI<!>? = null
}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
// !DIAGNOSTICS: -UNUSED_VARIABLE
open class A {
@@ -1,10 +0,0 @@
class Foo {
companion object {
val bar = 1
fun test(a: <!UNRESOLVED_REFERENCE!>Foo.`object`<!>) {
}
}
}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
class Foo {
companion object {
val bar = 1
@@ -14,18 +14,18 @@ fun test1(a: A.B.<!SYNTAX!><!>): A.B.<!SYNTAX!><!> {
val aa: A.B. <!SYNTAX!>=<!><!SYNTAX!><!> null!!
}
fun test2(a: <!UNRESOLVED_REFERENCE!>A.e.C<!>): <!UNRESOLVED_REFERENCE!>A.e.C<!> {
val aa: <!UNRESOLVED_REFERENCE!>A.e.C<!> = null!!
fun test2(a: A.<!UNRESOLVED_REFERENCE!>e<!>.C): A.<!UNRESOLVED_REFERENCE!>e<!>.C {
val aa: A.<!UNRESOLVED_REFERENCE!>e<!>.C = null!!
}
fun test3(a: <!UNRESOLVED_REFERENCE!>a.A.C<!>): <!UNRESOLVED_REFERENCE!>a.A.C<!> {
val aa: <!UNRESOLVED_REFERENCE!>a.A.C<!> = null!!
fun test3(a: <!UNRESOLVED_REFERENCE!>a<!>.A.C): <!UNRESOLVED_REFERENCE!>a<!>.A.C {
val aa: <!UNRESOLVED_REFERENCE!>a<!>.A.C = null!!
}
fun test4(a: <!UNRESOLVED_REFERENCE!>A.B.ee<!>): <!UNRESOLVED_REFERENCE!>A.B.ee<!> {
val aa: <!UNRESOLVED_REFERENCE!>A.B.ee<!> = null!!
fun test4(a: A.B.<!UNRESOLVED_REFERENCE!>ee<!>): A.B.<!UNRESOLVED_REFERENCE!>ee<!> {
val aa: A.B.<!UNRESOLVED_REFERENCE!>ee<!> = null!!
}
fun test5(a: <!UNRESOLVED_REFERENCE!>A.ee<!>): <!UNRESOLVED_REFERENCE!>A.ee<!> {
val aa: <!UNRESOLVED_REFERENCE!>A.ee<!> = null!!
fun test5(a: A.<!UNRESOLVED_REFERENCE!>ee<!>): A.<!UNRESOLVED_REFERENCE!>ee<!> {
val aa: A.<!UNRESOLVED_REFERENCE!>ee<!> = null!!
}
@@ -0,0 +1,24 @@
// FIR_IDENTICAL
// DIAGNOSTICS: -DEBUG_INFO_MISSING_UNRESOLVED
fun ch(
x1: <!UNRESOLVED_REFERENCE("Foo")!>Foo<!>.Bar,
x2: <!UNRESOLVED_REFERENCE("Foo")!>Foo<!>.Bar.Baz,
x3: Outer.<!UNRESOLVED_REFERENCE("Foo")!>Foo<!>,
x4: Outer.<!UNRESOLVED_REFERENCE("Foo")!>Foo<!>.Bar,
x5: Outer.Nested.<!UNRESOLVED_REFERENCE("Foo")!>Foo<!>,
x6: Outer.Nested.<!UNRESOLVED_REFERENCE("Foo")!>Foo<!>.Bar,
x7: Outer.Nested.Nested2.<!UNRESOLVED_REFERENCE("Foo")!>Foo<!>,
x8: Outer.Nested.Nested2.<!UNRESOLVED_REFERENCE("Foo")!>Foo<!>.Bar,
x9: Outer.Inner.<!UNRESOLVED_REFERENCE("Foo")!>Foo<!>,
x10: Outer.O.<!UNRESOLVED_REFERENCE("Foo")!>Foo<!>,
) {}
class Outer {
class Nested {
class Nested2
}
inner class Inner
object O
}
@@ -1,15 +0,0 @@
// !LANGUAGE: +ProhibitSmartcastsOnLocalDelegatedProperty
class AlternatingDelegate {
var counter: Int = 0
operator fun getValue(thisRef: Any?, property: <!UNRESOLVED_REFERENCE!>KProperty<*><!>): Any? =
if (counter++ % 2 == 0) 42 else ""
}
fun failsWithClassCastException() {
val sometimesNotInt: Any? by AlternatingDelegate()
if (sometimesNotInt is Int) {
<!SMARTCAST_IMPOSSIBLE!>sometimesNotInt<!>.inc()
}
}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
// !LANGUAGE: +ProhibitSmartcastsOnLocalDelegatedProperty
class AlternatingDelegate {
@@ -2,7 +2,7 @@
class AlternatingDelegate {
var counter: Int = 0
operator fun getValue(thisRef: Any?, property: <!UNRESOLVED_REFERENCE!>KProperty<*><!>): Any? =
operator fun getValue(thisRef: Any?, property: <!UNRESOLVED_REFERENCE!>KProperty<!><*>): Any? =
if (counter++ % 2 == 0) 42 else ""
}
@@ -1,8 +0,0 @@
// !DIAGNOSTICS: -CONFLICTING_JVM_DECLARATIONS -UNUSED_PARAMETER
fun <T> f1(l: <!UNRESOLVED_REFERENCE!>List1<T><!>): T {throw Exception()} // ERROR type here
fun <T> f1(l: <!UNRESOLVED_REFERENCE!>List2<T><!>): T {throw Exception()} // ERROR type here
fun <T> f1(c: Collection<T>): T{throw Exception()}
fun <T> test(l: List<T>) {
<!OVERLOAD_RESOLUTION_AMBIGUITY!>f1<!>(l)
}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
// !DIAGNOSTICS: -CONFLICTING_JVM_DECLARATIONS -UNUSED_PARAMETER
fun <T> f1(l: <!UNRESOLVED_REFERENCE!>List1<!><T>): T {throw Exception()} // ERROR type here
fun <T> f1(l: <!UNRESOLVED_REFERENCE!>List2<!><T>): T {throw Exception()} // ERROR type here
@@ -1,2 +0,0 @@
// ISSUE: KT-56212
fun <F> <!UNRESOLVED_REFERENCE!>F.X<!>.f(): Boolean = false
@@ -1,2 +1,3 @@
// FIR_IDENTICAL
// ISSUE: KT-56212
fun <F> F.<!UNRESOLVED_REFERENCE!>X<!>.f(): Boolean = false
@@ -1,2 +0,0 @@
// ISSUE: KT-56212
fun <F> foo(): <!UNRESOLVED_REFERENCE!>F.X<!> = TODO()
@@ -1,2 +1,3 @@
// FIR_IDENTICAL
// ISSUE: KT-56212
fun <F> foo(): F.<!UNRESOLVED_REFERENCE!>X<!> = TODO()
@@ -6,8 +6,8 @@ open class Base {
class Derived : Base()
fun test(x: <!UNRESOLVED_REFERENCE!>Derived.Nested<!>) = x
fun test(x: Derived.<!UNRESOLVED_REFERENCE!>Nested<!>) = x
fun Base.testWithImplicitReceiver(x: <!UNRESOLVED_REFERENCE!>Nested<!>) {
val y: <!UNRESOLVED_REFERENCE!>Nested<!> = x
}
}
@@ -1,46 +0,0 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER
// FILE: JTest.java
public class JTest {
public static String foo() { return ""; }
public static class Nested {}
}
// FILE: JDerived.java
public class JDerived extends JTest {
}
// FILE: test.kt
class KTest {
class Nested
inner class Inner
}
interface ITest {
class Nested
}
typealias JT = JTest
typealias JD = JDerived
typealias KT = KTest
typealias IT = ITest
// Referencing Java class static members via type alias should be ok
val testFoo: String = JT.foo()
val seeAlsoFoo: String = JTest.foo()
// Referencing base Java class static members via type alias for derived Java class should be ok
val testDerivedFoo: String = JD.foo()
val seeAlsoDerivedFoo: String = JDerived.foo()
// Referencing nested classes via type alias should be prohibited
// (in type position and in expression position)
val testNested1: <!UNRESOLVED_REFERENCE!>JT.Nested<!> = JT.<!UNRESOLVED_REFERENCE!>Nested<!>()
val testNested2: <!UNRESOLVED_REFERENCE!>KT.Nested<!> = KT.<!UNRESOLVED_REFERENCE!>Nested<!>()
val testNested3: <!UNRESOLVED_REFERENCE!>IT.Nested<!> = IT.<!UNRESOLVED_REFERENCE!>Nested<!>()
val testInner1: <!UNRESOLVED_REFERENCE!>JT.Inner<!> = JT.<!UNRESOLVED_REFERENCE!>Inner<!>()
val testInner2: <!UNRESOLVED_REFERENCE!>KT.Inner<!> = KT.<!UNRESOLVED_REFERENCE!>Inner<!>()
fun testNestedAsTypeArgument1(x: List<<!UNRESOLVED_REFERENCE!>JT.Nested<!>>) {}
fun testNestedAsTypeArgument2(x: List<<!UNRESOLVED_REFERENCE!>KT.Nested<!>>) {}
fun testNestedAsTypeArgument3(x: List<<!UNRESOLVED_REFERENCE!>IT.Nested<!>>) {}
fun testInnerAsTypeArgument1(x: List<<!UNRESOLVED_REFERENCE!>JT.Inner<!>>) {}
fun testInnerAsTypeArgument2(x: List<<!UNRESOLVED_REFERENCE!>KT.Inner<!>>) {}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
// !DIAGNOSTICS: -UNUSED_PARAMETER
// FILE: JTest.java
public class JTest {
@@ -3,5 +3,5 @@
fun outer() {
typealias Test1 = <!UNRESOLVED_REFERENCE!>Test1<!>
typealias Test2 = List<<!UNRESOLVED_REFERENCE!>Test2<!>>
typealias Test3<T> = List<<!UNRESOLVED_REFERENCE!>Test3<T><!>>
typealias Test3<T> = List<<!UNRESOLVED_REFERENCE!>Test3<!><T>>
}
@@ -38,13 +38,13 @@ enum class EnumSample {
fun foo(
a0: test.ClassSample.Nested,
a1: <!UNRESOLVED_REFERENCE!>test.ClassAlias.Nested<!>,
a1: test.ClassAlias.<!UNRESOLVED_REFERENCE!>Nested<!>,
b0: test.ObjectSample.Nested,
b1: <!UNRESOLVED_REFERENCE!>test.ObjectAlias.Nested<!>,
b1: test.ObjectAlias.<!UNRESOLVED_REFERENCE!>Nested<!>,
c0: test.EnumSample.Nested,
c1: <!UNRESOLVED_REFERENCE!>test.EnumAlias.Nested<!>
c1: test.EnumAlias.<!UNRESOLVED_REFERENCE!>Nested<!>
) {
test.ClassSample::Nested
test.ClassAlias::Nested
@@ -1,21 +0,0 @@
// https://ea.jetbrains.com/browser/ea_reports/1337846
//interface ComputablePoint<NumberType : Number>
//
//interface ComputableSegment<NumberType: Number, PointType>
//
//interface ComputableLineSegment<NumberType: Number, PointType> : ComputableSegment<NumberType, PointType>
//interface Path<NumberType, PointType, SegmentType>
typealias EachSegmentComparator<SegmentType> = (currentSegment: SegmentType, otherSegment: SegmentType, relationship: Int) -> Boolean
interface ComputablePath<NumberType, PointType, out SegmentType>
: <!UNRESOLVED_REFERENCE!>Path<NumberType, PointType, SegmentType><!>
where
NumberType: Number,
PointType: <!UNRESOLVED_REFERENCE!>ComputablePoint<NumberType><!>,
SegmentType: <!UNRESOLVED_REFERENCE!>ComputableLineSegment<NumberType, PointType><!>
{
fun anyTwoSegments(comparator: EachSegmentComparator<<!UNRESOLVED_REFERENCE!>ComputableSegment<NumberType, PointType><!>>): Boolean
}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
// https://ea.jetbrains.com/browser/ea_reports/1337846
//interface ComputablePoint<NumberType : Number>
@@ -2,7 +2,7 @@
interface Inv
class Impl : Inv
class Scope<InterfaceT, ImplementationT : InterfaceT>(private val implClass: <!UNRESOLVED_REFERENCE!>j.Class<ImplementationT><!>) {
class Scope<InterfaceT, ImplementationT : InterfaceT>(private val implClass: <!UNRESOLVED_REFERENCE!>j<!>.Class<ImplementationT>) {
fun foo(c: Collection<InterfaceT>) {
val hm = c.asSequence()
.filter(implClass::<!UNRESOLVED_REFERENCE!>isInstance<!>)
@@ -1,7 +0,0 @@
// FILE: 1.kt
fun test(c: <!UNRESOLVED_REFERENCE!>Continuation<Unit><!>) {}
// FILE: 2.kt
import kotlin.coroutines.*
fun test2(c: Continuation<Unit>) {}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
// FILE: 1.kt
fun test(c: <!UNRESOLVED_REFERENCE!>Continuation<!><Unit>) {}
@@ -1,8 +0,0 @@
// !LANGUAGE: +Coroutines
// !DIAGNOSTICS: -USELESS_IS_CHECK
// SKIP_TXT
fun test() {
suspend {} is <!UNRESOLVED_REFERENCE!>SuspendFunction0<*><!>
suspend {} is kotlin.coroutines.SuspendFunction0<*>
}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
// !LANGUAGE: +Coroutines
// !DIAGNOSTICS: -USELESS_IS_CHECK
// SKIP_TXT
@@ -1,4 +1,4 @@
// SKIP_JAVAC
typealias Test1 = <!UNRESOLVED_REFERENCE!>SuspendFunction0<Unit><!>
typealias Test2 = <!UNRESOLVED_REFERENCE!>kotlin.SuspendFunction0<Unit><!>
typealias Test1 = <!UNRESOLVED_REFERENCE!>SuspendFunction0<!><Unit>
typealias Test2 = <!UNRESOLVED_REFERENCE!>kotlin<!>.SuspendFunction0<Unit>
typealias Test3 = kotlin.coroutines.SuspendFunction0<Unit>
@@ -29300,6 +29300,12 @@ public class DiagnosticTestGenerated extends AbstractDiagnosticTest {
runTest("compiler/testData/diagnostics/tests/resolve/localObject.kt");
}
@Test
@TestMetadata("nestedClassUnresolvedReference.kt")
public void testNestedClassUnresolvedReference() throws Exception {
runTest("compiler/testData/diagnostics/tests/resolve/nestedClassUnresolvedReference.kt");
}
@Test
@TestMetadata("newLineLambda.kt")
public void testNewLineLambda() throws Exception {
@@ -188,7 +188,7 @@ fun case_12(x: TypealiasNullableStringIndirect, y: TypealiasNullableStringIndire
else "-1"
// TESTCASE NUMBER: 13
fun case_13(x: <!UNRESOLVED_REFERENCE!>otherpackage.Case13<!>?) =
fun case_13(x: <!UNRESOLVED_REFERENCE!>otherpackage<!>.Case13?) =
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Boolean")!>if (<!DEPRECATED_IDENTITY_EQUALS!>(x == null !is Boolean) !== true<!>) {
throw Exception()
} else {
@@ -198,7 +198,7 @@ fun case_13(x: <!UNRESOLVED_REFERENCE!>otherpackage.Case13<!>?) =
// TESTCASE NUMBER: 14
class Case14 {
val x: <!UNRESOLVED_REFERENCE!>otherpackage.Case14<!>?
val x: <!UNRESOLVED_REFERENCE!>otherpackage<!>.Case14?
init {
x = <!UNRESOLVED_REFERENCE!>otherpackage<!>.Case14()
}