diff --git a/analysis/analysis-api-fir/src/org/jetbrains/kotlin/analysis/api/fir/diagnostics/KtFirDataClassConverters.kt b/analysis/analysis-api-fir/src/org/jetbrains/kotlin/analysis/api/fir/diagnostics/KtFirDataClassConverters.kt index bf664b878cb..ea5b70219c7 100644 --- a/analysis/analysis-api-fir/src/org/jetbrains/kotlin/analysis/api/fir/diagnostics/KtFirDataClassConverters.kt +++ b/analysis/analysis-api-fir/src/org/jetbrains/kotlin/analysis/api/fir/diagnostics/KtFirDataClassConverters.kt @@ -1599,7 +1599,7 @@ internal val KT_DIAGNOSTIC_CONVERTER = KtDiagnosticConverterBuilder.buildConvert add(FirErrors.WRONG_NUMBER_OF_TYPE_ARGUMENTS) { firDiagnostic -> WrongNumberOfTypeArgumentsImpl( firDiagnostic.a, - firSymbolBuilder.classifierBuilder.buildClassLikeSymbol(firDiagnostic.b.fir), + firSymbolBuilder.classifierBuilder.buildClassLikeSymbol(firDiagnostic.b.fir as FirClass), firDiagnostic as KtPsiDiagnostic, token, ) @@ -1614,7 +1614,7 @@ internal val KT_DIAGNOSTIC_CONVERTER = KtDiagnosticConverterBuilder.buildConvert } add(FirErrors.OUTER_CLASS_ARGUMENTS_REQUIRED) { firDiagnostic -> OuterClassArgumentsRequiredImpl( - firSymbolBuilder.classifierBuilder.buildClassLikeSymbol(firDiagnostic.a.fir), + firSymbolBuilder.classifierBuilder.buildClassLikeSymbol(firDiagnostic.a.fir as FirClass), firDiagnostic as KtPsiDiagnostic, token, ) @@ -2771,7 +2771,7 @@ internal val KT_DIAGNOSTIC_CONVERTER = KtDiagnosticConverterBuilder.buildConvert firDiagnostic.b, firDiagnostic.c.mapKeys { (incompatible, _) -> incompatible - }.mapValues { (_, collection) -> + }.mapValues { (_, collection) -> collection.map { firBasedSymbol -> firSymbolBuilder.buildSymbol(firBasedSymbol.fir) } @@ -2785,7 +2785,7 @@ internal val KT_DIAGNOSTIC_CONVERTER = KtDiagnosticConverterBuilder.buildConvert firSymbolBuilder.buildSymbol(firDiagnostic.a.fir), firDiagnostic.b.mapKeys { (incompatible, _) -> incompatible - }.mapValues { (_, collection) -> + }.mapValues { (_, collection) -> collection.map { firBasedSymbol -> firSymbolBuilder.buildSymbol(firBasedSymbol.fir) } @@ -2820,7 +2820,7 @@ internal val KT_DIAGNOSTIC_CONVERTER = KtDiagnosticConverterBuilder.buildConvert firDiagnostic.b.map { pair -> firSymbolBuilder.buildSymbol(pair.first.fir) to pair.second.mapKeys { (incompatible, _) -> incompatible - }.mapValues { (_, collection) -> + }.mapValues { (_, collection) -> collection.map { firBasedSymbol -> firSymbolBuilder.buildSymbol(firBasedSymbol.fir) } @@ -3100,13 +3100,13 @@ internal val KT_DIAGNOSTIC_CONVERTER = KtDiagnosticConverterBuilder.buildConvert add(FirErrors.CANNOT_CHECK_FOR_ERASED) { firDiagnostic -> CannotCheckForErasedImpl( firSymbolBuilder.typeBuilder.buildKtType(firDiagnostic.a), - firDiagnostic as FirPsiDiagnostic, + firDiagnostic as KtPsiDiagnostic, token, ) } add(FirErrors.CAST_NEVER_SUCCEEDS) { firDiagnostic -> CastNeverSucceedsImpl( - firDiagnostic as FirPsiDiagnostic, + firDiagnostic as KtPsiDiagnostic, token, ) } @@ -3116,6 +3116,14 @@ internal val KT_DIAGNOSTIC_CONVERTER = KtDiagnosticConverterBuilder.buildConvert token, ) } + add(FirErrors.UNCHECKED_CAST) { firDiagnostic -> + UncheckedCastImpl( + firSymbolBuilder.typeBuilder.buildKtType(firDiagnostic.a), + firSymbolBuilder.typeBuilder.buildKtType(firDiagnostic.b), + firDiagnostic as KtPsiDiagnostic, + token, + ) + } add(FirErrors.USELESS_IS_CHECK) { firDiagnostic -> UselessIsCheckImpl( firDiagnostic.a, diff --git a/analysis/analysis-api-fir/src/org/jetbrains/kotlin/analysis/api/fir/diagnostics/KtFirDiagnostics.kt b/analysis/analysis-api-fir/src/org/jetbrains/kotlin/analysis/api/fir/diagnostics/KtFirDiagnostics.kt index 1a988dc801f..454e0402ecf 100644 --- a/analysis/analysis-api-fir/src/org/jetbrains/kotlin/analysis/api/fir/diagnostics/KtFirDiagnostics.kt +++ b/analysis/analysis-api-fir/src/org/jetbrains/kotlin/analysis/api/fir/diagnostics/KtFirDiagnostics.kt @@ -2181,6 +2181,12 @@ sealed class KtFirDiagnostic : KtDiagnosticWithPsi { override val diagnosticClass get() = UselessCast::class } + abstract class UncheckedCast : KtFirDiagnostic() { + override val diagnosticClass get() = UncheckedCast::class + abstract val originalType: KtType + abstract val targetType: KtType + } + abstract class UselessIsCheck : KtFirDiagnostic() { override val diagnosticClass get() = UselessIsCheck::class abstract val compileTimeCheckResult: Boolean diff --git a/analysis/analysis-api-fir/src/org/jetbrains/kotlin/analysis/api/fir/diagnostics/KtFirDiagnosticsImpl.kt b/analysis/analysis-api-fir/src/org/jetbrains/kotlin/analysis/api/fir/diagnostics/KtFirDiagnosticsImpl.kt index 532568a6064..2ce590e3229 100644 --- a/analysis/analysis-api-fir/src/org/jetbrains/kotlin/analysis/api/fir/diagnostics/KtFirDiagnosticsImpl.kt +++ b/analysis/analysis-api-fir/src/org/jetbrains/kotlin/analysis/api/fir/diagnostics/KtFirDiagnosticsImpl.kt @@ -2612,24 +2612,27 @@ internal class UselessElvisRightIsNullImpl( internal class CannotCheckForErasedImpl( override val type: KtType, - firDiagnostic: FirPsiDiagnostic, + override val firDiagnostic: KtPsiDiagnostic, override val token: ValidityToken, -) : KtFirDiagnostic.CannotCheckForErased(), KtAbstractFirDiagnostic { - override val firDiagnostic: FirPsiDiagnostic by weakRef(firDiagnostic) -} +) : KtFirDiagnostic.CannotCheckForErased(), KtAbstractFirDiagnostic internal class CastNeverSucceedsImpl( - firDiagnostic: FirPsiDiagnostic, + override val firDiagnostic: KtPsiDiagnostic, override val token: ValidityToken, -) : KtFirDiagnostic.CastNeverSucceeds(), KtAbstractFirDiagnostic { - override val firDiagnostic: FirPsiDiagnostic by weakRef(firDiagnostic) -} +) : KtFirDiagnostic.CastNeverSucceeds(), KtAbstractFirDiagnostic internal class UselessCastImpl( override val firDiagnostic: KtPsiDiagnostic, override val token: ValidityToken, ) : KtFirDiagnostic.UselessCast(), KtAbstractFirDiagnostic +internal class UncheckedCastImpl( + override val originalType: KtType, + override val targetType: KtType, + override val firDiagnostic: KtPsiDiagnostic, + override val token: ValidityToken, +) : KtFirDiagnostic.UncheckedCast(), KtAbstractFirDiagnostic + internal class UselessIsCheckImpl( override val compileTimeCheckResult: Boolean, override val firDiagnostic: KtPsiDiagnostic, diff --git a/compiler/fir/analysis-tests/testData/resolve/lambdaInLhsOfTypeOperatorCall.kt b/compiler/fir/analysis-tests/testData/resolve/lambdaInLhsOfTypeOperatorCall.kt index 91134a71484..f39f37d3e0b 100644 --- a/compiler/fir/analysis-tests/testData/resolve/lambdaInLhsOfTypeOperatorCall.kt +++ b/compiler/fir/analysis-tests/testData/resolve/lambdaInLhsOfTypeOperatorCall.kt @@ -5,11 +5,11 @@ fun foo(b: B) {} fun test_1(b: B) { foo(b.myMap { it.k.length // implicits - } as B) + } as B) } fun test_2(s: String) { - val func = { s.length } as B + val func = { s.length } as B } class B(val k: K, val v: V) diff --git a/compiler/fir/analysis-tests/testData/resolve/types/castToBareType.kt b/compiler/fir/analysis-tests/testData/resolve/types/castToBareType.kt index e601551638f..dc4a47403f1 100644 --- a/compiler/fir/analysis-tests/testData/resolve/types/castToBareType.kt +++ b/compiler/fir/analysis-tests/testData/resolve/types/castToBareType.kt @@ -12,6 +12,6 @@ interface AbstractFirBasedSymbol where E : FirSymbolOwner, E : FirDeclarat fun foo(firAdaptee: FirFunction<*>) {} fun test(symbol: AbstractFirBasedSymbol<*>) { - val firAdaptee = symbol.fir as FirFunction + val firAdaptee = symbol.fir as FirFunction // TODO: KT-48832 foo(firAdaptee) } diff --git a/compiler/fir/analysis-tests/testData/resolveWithStdlib/intellij/UastPatterns.kt b/compiler/fir/analysis-tests/testData/resolveWithStdlib/intellij/UastPatterns.kt index 01b777f97d3..79da5c64103 100644 --- a/compiler/fir/analysis-tests/testData/resolveWithStdlib/intellij/UastPatterns.kt +++ b/compiler/fir/analysis-tests/testData/resolveWithStdlib/intellij/UastPatterns.kt @@ -30,9 +30,9 @@ fun uExpression(): UExpressionPattern.Capture = expressionCapture(U fun expressionCapture(clazz: Class): UExpressionPattern.Capture = UExpressionPattern.Capture(clazz) open class UElementPattern>(clazz: Class) : ObjectPattern(clazz) { - fun filter(filter: (T) -> Boolean): Self = this as Self + fun filter(filter: (T) -> Boolean): Self = this as Self } open class UExpressionPattern>(clazz: Class) : UElementPattern(clazz) { open class Capture(clazz: Class) : UExpressionPattern>(clazz) -} \ No newline at end of file +} diff --git a/compiler/fir/analysis-tests/testData/resolveWithStdlib/listPlusAssign.kt b/compiler/fir/analysis-tests/testData/resolveWithStdlib/listPlusAssign.kt index 72552d2d321..7302d4f99e8 100644 --- a/compiler/fir/analysis-tests/testData/resolveWithStdlib/listPlusAssign.kt +++ b/compiler/fir/analysis-tests/testData/resolveWithStdlib/listPlusAssign.kt @@ -6,7 +6,7 @@ fun List.modify() { } fun Any.modify() { - (this as List) += 42 + (this as List) += 42 } operator fun Set.plusAssign(x: T) {} @@ -17,5 +17,5 @@ fun Set.modify() { } fun Any.modifySet() { - (this as Set) += 42 + (this as Set) += 42 } diff --git a/compiler/fir/checkers/checkers-component-generator/src/org/jetbrains/kotlin/fir/checkers/generator/diagnostics/FirDiagnosticsList.kt b/compiler/fir/checkers/checkers-component-generator/src/org/jetbrains/kotlin/fir/checkers/generator/diagnostics/FirDiagnosticsList.kt index 692c616c84f..2044be338ca 100644 --- a/compiler/fir/checkers/checkers-component-generator/src/org/jetbrains/kotlin/fir/checkers/generator/diagnostics/FirDiagnosticsList.kt +++ b/compiler/fir/checkers/checkers-component-generator/src/org/jetbrains/kotlin/fir/checkers/generator/diagnostics/FirDiagnosticsList.kt @@ -1107,6 +1107,10 @@ object DIAGNOSTICS_LIST : DiagnosticList("FirErrors") { } val CAST_NEVER_SUCCEEDS by warning(PositioningStrategy.OPERATOR) val USELESS_CAST by warning(PositioningStrategy.AS_TYPE) + val UNCHECKED_CAST by warning(PositioningStrategy.AS_TYPE) { + parameter("originalType") + parameter("targetType") + } val USELESS_IS_CHECK by warning { parameter("compileTimeCheckResult") } diff --git a/compiler/fir/checkers/gen/org/jetbrains/kotlin/fir/analysis/diagnostics/FirErrors.kt b/compiler/fir/checkers/gen/org/jetbrains/kotlin/fir/analysis/diagnostics/FirErrors.kt index c2a7d541bf1..30812978f73 100644 --- a/compiler/fir/checkers/gen/org/jetbrains/kotlin/fir/analysis/diagnostics/FirErrors.kt +++ b/compiler/fir/checkers/gen/org/jetbrains/kotlin/fir/analysis/diagnostics/FirErrors.kt @@ -593,6 +593,7 @@ object FirErrors { val CANNOT_CHECK_FOR_ERASED by error1() val CAST_NEVER_SUCCEEDS by warning0(SourceElementPositioningStrategies.OPERATOR) val USELESS_CAST by warning0(SourceElementPositioningStrategies.AS_TYPE) + val UNCHECKED_CAST by warning2(SourceElementPositioningStrategies.AS_TYPE) val USELESS_IS_CHECK by warning1() val IS_ENUM_ENTRY by error0() val ENUM_ENTRY_AS_TYPE by error0(SourceElementPositioningStrategies.SELECTOR_BY_QUALIFIED) diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jsr305/typeArguments.fir.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jsr305/typeArguments.fir.kt index 3e4462f4cba..a968dca2880 100644 --- a/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jsr305/typeArguments.fir.kt +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jsr305/typeArguments.fir.kt @@ -77,11 +77,11 @@ import test.L fun main(a: test.A, l: L, Int?>, l1: L, Int>) { a.foo(l) - a.foo(l as L, Int>) - a.foo(l as L, Int?>) + a.foo(l as L, Int>) + a.foo(l as L, Int?>) a.bar(l1) - a.bar(l1 as L, Int?>) + a.bar(l1 as L, Int?>) a.baz1().t().containsKey("") a.baz1().t().containsKey(null) @@ -90,7 +90,7 @@ fun main(a: test.A, l: L, Int?>, l1: L, Int>) a.baz1().s().hashCode() a.baz1().setT(l.t()) - a.baz1().setT(l.t() as L, Int>) + a.baz1().setT(l.t() as L, Int>) a.baz1().setT(null) a.baz2().t().containsKey("") diff --git a/compiler/testData/diagnostics/tests/EnumEntryAsType.fir.kt b/compiler/testData/diagnostics/tests/EnumEntryAsType.fir.kt index af2e47a62bb..edfdff53079 100644 --- a/compiler/testData/diagnostics/tests/EnumEntryAsType.fir.kt +++ b/compiler/testData/diagnostics/tests/EnumEntryAsType.fir.kt @@ -43,7 +43,7 @@ typealias ArrayOfEnumEntry = ArrayRED> typealias ArrayOfEnumEntryAlias = Array -fun bar(a: Any): T = a as T +fun bar(a: Any): T = a as T fun foo() { fooRED>() diff --git a/compiler/testData/diagnostics/tests/callableReference/propertyOfNestedGenericClass.fir.kt b/compiler/testData/diagnostics/tests/callableReference/propertyOfNestedGenericClass.fir.kt index 7d7c8a4353d..9cab21f9d51 100644 --- a/compiler/testData/diagnostics/tests/callableReference/propertyOfNestedGenericClass.fir.kt +++ b/compiler/testData/diagnostics/tests/callableReference/propertyOfNestedGenericClass.fir.kt @@ -26,7 +26,7 @@ fun test() { c - val d = id(Scope.Nested<*>::keyT as Scope.Nested) + val d = id(Scope.Nested<*>::keyT as Scope.Nested) d @@ -40,4 +40,4 @@ fun justResolve() { val b = Scope.Nested::keyT val c = Scope.Nested<*>::keyT val d = Scope.Nested::keyT -} \ No newline at end of file +} diff --git a/compiler/testData/diagnostics/tests/cast/AsArray.fir.kt b/compiler/testData/diagnostics/tests/cast/AsArray.fir.kt deleted file mode 100644 index 4905c48dc29..00000000000 --- a/compiler/testData/diagnostics/tests/cast/AsArray.fir.kt +++ /dev/null @@ -1 +0,0 @@ -fun f(x: Any) = x as Array \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/cast/AsArray.kt b/compiler/testData/diagnostics/tests/cast/AsArray.kt index 8cf8539a071..3e0d936261e 100644 --- a/compiler/testData/diagnostics/tests/cast/AsArray.kt +++ b/compiler/testData/diagnostics/tests/cast/AsArray.kt @@ -1 +1,2 @@ +// FIR_IDENTICAL fun f(x: Any) = x as Array \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/cast/AsErasedError.fir.kt b/compiler/testData/diagnostics/tests/cast/AsErasedError.fir.kt deleted file mode 100644 index b587d66e767..00000000000 --- a/compiler/testData/diagnostics/tests/cast/AsErasedError.fir.kt +++ /dev/null @@ -1,2 +0,0 @@ - -fun ff(c: MutableCollection) = c as MutableList diff --git a/compiler/testData/diagnostics/tests/cast/AsErasedError.kt b/compiler/testData/diagnostics/tests/cast/AsErasedError.kt index c262c2e91a1..a1962412bb6 100644 --- a/compiler/testData/diagnostics/tests/cast/AsErasedError.kt +++ b/compiler/testData/diagnostics/tests/cast/AsErasedError.kt @@ -1,2 +1,3 @@ +// FIR_IDENTICAL fun ff(c: MutableCollection) = c as MutableList diff --git a/compiler/testData/diagnostics/tests/cast/AsErasedWarning.fir.kt b/compiler/testData/diagnostics/tests/cast/AsErasedWarning.fir.kt deleted file mode 100644 index 09fadc462c3..00000000000 --- a/compiler/testData/diagnostics/tests/cast/AsErasedWarning.fir.kt +++ /dev/null @@ -1,2 +0,0 @@ - -fun ff(a: Any) = a as MutableList diff --git a/compiler/testData/diagnostics/tests/cast/AsErasedWarning.kt b/compiler/testData/diagnostics/tests/cast/AsErasedWarning.kt index 89112802eb4..272eea26078 100644 --- a/compiler/testData/diagnostics/tests/cast/AsErasedWarning.kt +++ b/compiler/testData/diagnostics/tests/cast/AsErasedWarning.kt @@ -1,2 +1,3 @@ +// FIR_IDENTICAL fun ff(a: Any) = a as MutableList diff --git a/compiler/testData/diagnostics/tests/cast/AsWithOtherParameter.fir.kt b/compiler/testData/diagnostics/tests/cast/AsWithOtherParameter.fir.kt deleted file mode 100644 index 2b412a0f643..00000000000 --- a/compiler/testData/diagnostics/tests/cast/AsWithOtherParameter.fir.kt +++ /dev/null @@ -1,34 +0,0 @@ -// See also: KT-6611 (cast can never succeed: Class -> Class) - -class Class(val name: String, val instance: T) - -fun test(clazz: Class) { - println((clazz as Class).name) -} - -fun use() { - test(Class("String", "")) -} - -fun checkArrays(): Array { - val someArray = arrayOfNulls(5) - someArray as Array - return someArray as Array -} - -class Wrapper(val x: T) - -fun checkArrays2(): Array> { - val someArray = arrayOf(Wrapper(1), Wrapper(2)) - return someArray as Array> -} - -fun checkArrays3() { - val someArray = arrayOfNulls(1) - someArray as Array - val intArray = arrayOfNulls(1) - intArray as Array -} - -fun println(s: String) = s - diff --git a/compiler/testData/diagnostics/tests/cast/AsWithOtherParameter.kt b/compiler/testData/diagnostics/tests/cast/AsWithOtherParameter.kt index 4803ddb150a..290ec1e9f59 100644 --- a/compiler/testData/diagnostics/tests/cast/AsWithOtherParameter.kt +++ b/compiler/testData/diagnostics/tests/cast/AsWithOtherParameter.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // See also: KT-6611 (cast can never succeed: Class -> Class) class Class(val name: String, val instance: T) diff --git a/compiler/testData/diagnostics/tests/cast/IsErasedUpcastToNonReified.fir.kt b/compiler/testData/diagnostics/tests/cast/IsErasedUpcastToNonReified.fir.kt index 8efa6897a5b..fafd8aea8c4 100644 --- a/compiler/testData/diagnostics/tests/cast/IsErasedUpcastToNonReified.fir.kt +++ b/compiler/testData/diagnostics/tests/cast/IsErasedUpcastToNonReified.fir.kt @@ -10,9 +10,9 @@ fun test(x: T?, y: S, z: T) { z is T z is T? - null as T + null as T null as T? - null as S + null as S } inline fun test(x: T?) { diff --git a/compiler/testData/diagnostics/tests/delegatedProperty/inference/differentDelegatedExpressions.fir.kt b/compiler/testData/diagnostics/tests/delegatedProperty/inference/differentDelegatedExpressions.fir.kt index 1e9ff79986a..5cc2ad92818 100644 --- a/compiler/testData/diagnostics/tests/delegatedProperty/inference/differentDelegatedExpressions.fir.kt +++ b/compiler/testData/diagnostics/tests/delegatedProperty/inference/differentDelegatedExpressions.fir.kt @@ -25,7 +25,7 @@ class MyProperty { operator fun getValue(thisRef: R, desc: KProperty<*>): T { println("get $thisRef ${desc.name}") - return null as T + return null as T } operator fun setValue(thisRef: R, desc: KProperty<*>, value: T) { diff --git a/compiler/testData/diagnostics/tests/generics/capturedParameters/uncheckedCast.fir.kt b/compiler/testData/diagnostics/tests/generics/capturedParameters/uncheckedCast.fir.kt index a14746666b3..1c0cb0eec96 100644 --- a/compiler/testData/diagnostics/tests/generics/capturedParameters/uncheckedCast.fir.kt +++ b/compiler/testData/diagnostics/tests/generics/capturedParameters/uncheckedCast.fir.kt @@ -22,7 +22,7 @@ fun foo(x: Any, y: Any) : Any { return y } - y as Outer<*>.Inner + y as Outer<*>.Inner return C() } diff --git a/compiler/testData/diagnostics/tests/inference/capturedTypes/kt46727.fir.kt b/compiler/testData/diagnostics/tests/inference/capturedTypes/kt46727.fir.kt index 57b06f2180e..1b76a39b15c 100644 --- a/compiler/testData/diagnostics/tests/inference/capturedTypes/kt46727.fir.kt +++ b/compiler/testData/diagnostics/tests/inference/capturedTypes/kt46727.fir.kt @@ -39,7 +39,7 @@ fun main1() { // --- from Kotlin --- // public class Bar { - var value: T = null as T + var value: T = null as T } fun takeStarBar(x: Bar<*>) { @@ -115,4 +115,4 @@ fun main6() { bar.value = 1 takeStarBar3(bar) println(bar.value) // CCE: String cannot be cast to Number -} \ No newline at end of file +} diff --git a/compiler/testData/diagnostics/tests/inference/capturedTypes/kt46727Warnings.fir.kt b/compiler/testData/diagnostics/tests/inference/capturedTypes/kt46727Warnings.fir.kt index 37d88a85620..e44da5de3e0 100644 --- a/compiler/testData/diagnostics/tests/inference/capturedTypes/kt46727Warnings.fir.kt +++ b/compiler/testData/diagnostics/tests/inference/capturedTypes/kt46727Warnings.fir.kt @@ -39,7 +39,7 @@ fun main1() { // --- from Kotlin --- // public class Bar { - var value: T = null as T + var value: T = null as T } fun takeStarBar(x: Bar<*>) { diff --git a/compiler/testData/diagnostics/tests/inference/expectedTypeAdditionalTest.fir.kt b/compiler/testData/diagnostics/tests/inference/expectedTypeAdditionalTest.fir.kt index d31630c19a8..15705615815 100644 --- a/compiler/testData/diagnostics/tests/inference/expectedTypeAdditionalTest.fir.kt +++ b/compiler/testData/diagnostics/tests/inference/expectedTypeAdditionalTest.fir.kt @@ -2,7 +2,7 @@ fun foo() = 1 -fun foo() = foo() as T +fun foo() = foo() as T fun foo2(): T = TODO() diff --git a/compiler/testData/diagnostics/tests/inference/recursiveTypes/selfTypes/disabledInferenceOnSelfTypes/writerAppenderExampleRecursive.fir.kt b/compiler/testData/diagnostics/tests/inference/recursiveTypes/selfTypes/disabledInferenceOnSelfTypes/writerAppenderExampleRecursive.fir.kt index e0e9c69196d..7b6226c5aa6 100644 --- a/compiler/testData/diagnostics/tests/inference/recursiveTypes/selfTypes/disabledInferenceOnSelfTypes/writerAppenderExampleRecursive.fir.kt +++ b/compiler/testData/diagnostics/tests/inference/recursiveTypes/selfTypes/disabledInferenceOnSelfTypes/writerAppenderExampleRecursive.fir.kt @@ -12,7 +12,7 @@ object WriterAppender { class Builder1> { fun asBuilder(): B { - return this as B + return this as B } } @@ -23,4 +23,4 @@ object WriterAppender { fun intersectTwoSelfTypes(): B where B : Builder1, B: Builder2 { return Builder1().asBuilder() } -} \ No newline at end of file +} diff --git a/compiler/testData/diagnostics/tests/inference/recursiveTypes/selfTypes/enabledInferenceOnSelfTypes/writerAppenderExampleRecursive.fir.kt b/compiler/testData/diagnostics/tests/inference/recursiveTypes/selfTypes/enabledInferenceOnSelfTypes/writerAppenderExampleRecursive.fir.kt index d8712fbcf23..905bc4e767f 100644 --- a/compiler/testData/diagnostics/tests/inference/recursiveTypes/selfTypes/enabledInferenceOnSelfTypes/writerAppenderExampleRecursive.fir.kt +++ b/compiler/testData/diagnostics/tests/inference/recursiveTypes/selfTypes/enabledInferenceOnSelfTypes/writerAppenderExampleRecursive.fir.kt @@ -37,7 +37,7 @@ object WriterAppender { class Builder1> { fun asBuilder(): B { - return this as B + return this as B } } @@ -48,4 +48,4 @@ object WriterAppender { fun intersectTwoSelfTypes(): B where B : Builder1, B: Builder2 { return Builder1().asBuilder() } -} \ No newline at end of file +} diff --git a/compiler/testData/diagnostics/tests/inference/regressions/kt35844.fir.kt b/compiler/testData/diagnostics/tests/inference/regressions/kt35844.fir.kt index 0c7f66ecae5..280e4597ae1 100644 --- a/compiler/testData/diagnostics/tests/inference/regressions/kt35844.fir.kt +++ b/compiler/testData/diagnostics/tests/inference/regressions/kt35844.fir.kt @@ -11,7 +11,7 @@ class B { fun foo(c: A): Y = TODO() fun main(a: A) { - a as A> + a as A> foo(a).b() } @@ -21,7 +21,7 @@ class AOut fun foo(c: AOut): Y = TODO() fun mainOut(a: AOut) { - a as AOut> + a as AOut> foo(a).b() } diff --git a/compiler/testData/diagnostics/tests/inference/regressions/kt38691.fir.kt b/compiler/testData/diagnostics/tests/inference/regressions/kt38691.fir.kt deleted file mode 100644 index b7043dfd76d..00000000000 --- a/compiler/testData/diagnostics/tests/inference/regressions/kt38691.fir.kt +++ /dev/null @@ -1,14 +0,0 @@ -// !LANGUAGE: +NewInference -// !DIAGNOSTICS: -UNUSED_PARAMETER -UNUSED_VARIABLE - -class Inv -fun materializeInv() = Inv() -fun foo(x: Inv, y: X) = materializeInv() -fun foo(x: Inv, y: () -> X) = materializeInv() - -fun main(fn: () -> R) { - fun bar(): R = null as R - val x1 = foo(materializeInv()) { fn() } // OVERLOAD_RESOLUTION_AMBIGUITY only in NI - val x2 = foo(materializeInv(), fn) // OK - val x3 = foo(materializeInv(), ::bar) // OK -} diff --git a/compiler/testData/diagnostics/tests/inference/regressions/kt38691.kt b/compiler/testData/diagnostics/tests/inference/regressions/kt38691.kt index 07db5b4e2fb..a17f01189d5 100644 --- a/compiler/testData/diagnostics/tests/inference/regressions/kt38691.kt +++ b/compiler/testData/diagnostics/tests/inference/regressions/kt38691.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // !LANGUAGE: +NewInference // !DIAGNOSTICS: -UNUSED_PARAMETER -UNUSED_VARIABLE diff --git a/compiler/testData/diagnostics/tests/inference/upperBounds/kt2856.fir.kt b/compiler/testData/diagnostics/tests/inference/upperBounds/kt2856.fir.kt deleted file mode 100644 index 6688ff60d29..00000000000 --- a/compiler/testData/diagnostics/tests/inference/upperBounds/kt2856.fir.kt +++ /dev/null @@ -1,20 +0,0 @@ -//KT-2856 Fix the getOrElse signature to be able to return any supertype of V -package d - -import java.util.HashMap - -public inline fun Map.getOrElse1(key: K, defaultValue: ()-> V1) : V1 { - if (this.containsKey(key)) { - return this.get(key) as V - } else { - return defaultValue() - } -} - -fun main() { - val map = HashMap() - println(map.getOrElse1(2, { null })) // Error -} - -//from standard library -fun println(message : Any?) {} \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/inference/upperBounds/kt2856.kt b/compiler/testData/diagnostics/tests/inference/upperBounds/kt2856.kt index 571c0e479ab..dd5f1091b5d 100644 --- a/compiler/testData/diagnostics/tests/inference/upperBounds/kt2856.kt +++ b/compiler/testData/diagnostics/tests/inference/upperBounds/kt2856.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL //KT-2856 Fix the getOrElse signature to be able to return any supertype of V package d diff --git a/compiler/testData/diagnostics/tests/library/Collections.fir.kt b/compiler/testData/diagnostics/tests/library/Collections.fir.kt index 21371848ae4..96200e091ec 100644 --- a/compiler/testData/diagnostics/tests/library/Collections.fir.kt +++ b/compiler/testData/diagnostics/tests/library/Collections.fir.kt @@ -26,7 +26,7 @@ fun testMutableCollection(c: MutableCollection, t: T) { val mutableIterator: MutableIterator = c.iterator() c.add(t) - c.remove(1 as T) + c.remove(1 as T) c.addAll(c) c.removeAll(c) c.retainAll(c) @@ -84,7 +84,7 @@ fun testMutableSet(s: MutableSet, t: T) { val mutableIterator: MutableIterator = s.iterator() s.add(t) - s.remove(1 as T) + s.remove(1 as T) s.addAll(s) s.removeAll(s) s.retainAll(s) diff --git a/compiler/testData/diagnostics/tests/nullableTypes/uselessElvis.fir.kt b/compiler/testData/diagnostics/tests/nullableTypes/uselessElvis.fir.kt deleted file mode 100644 index b6b5d49b625..00000000000 --- a/compiler/testData/diagnostics/tests/nullableTypes/uselessElvis.fir.kt +++ /dev/null @@ -1,48 +0,0 @@ -// !DIAGNOSTICS: -UNUSED_PARAMETER, -SENSELESS_COMPARISON, -DEBUG_INFO_SMARTCAST - -fun test1(t: Any?): Any { - return t as T ?: "" -} - -fun test2(t: Any?): Any { - return t as T ?: "" -} - -fun test3(t: Any?): Any { - if (t != null) { - return t ?: "" - } - - return 1 -} - -fun takeNotNull(s: String) {} -fun notNull(): T = TODO() -fun nullable(): T? = null -fun dependOn(x: T) = x - -fun test() { - takeNotNull(notNull() ?: "") - takeNotNull(nullable() ?: "") - - val x: String? = null - takeNotNull(dependOn(x) ?: "") - takeNotNull(dependOn(dependOn(x)) ?: "") - takeNotNull(dependOn(dependOn(x as String)) ?: "") - - if (x != null) { - takeNotNull(dependOn(x) ?: "") - takeNotNull(dependOn(dependOn(x)) ?: "") - takeNotNull(dependOn(dependOn(x) as? String) ?: "") - } - - takeNotNull(bar()!!) -} - -inline fun reifiedNull(): T? = null - -fun testFrom13648() { - takeNotNull(reifiedNull() ?: "") -} - -fun bar() = unresolved diff --git a/compiler/testData/diagnostics/tests/nullableTypes/uselessElvis.kt b/compiler/testData/diagnostics/tests/nullableTypes/uselessElvis.kt index 2f57ac79a41..4cf20593407 100644 --- a/compiler/testData/diagnostics/tests/nullableTypes/uselessElvis.kt +++ b/compiler/testData/diagnostics/tests/nullableTypes/uselessElvis.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // !DIAGNOSTICS: -UNUSED_PARAMETER, -SENSELESS_COMPARISON, -DEBUG_INFO_SMARTCAST fun test1(t: Any?): Any { diff --git a/compiler/testData/diagnostics/tests/platformTypes/genericVarianceViolation/simple.fir.kt b/compiler/testData/diagnostics/tests/platformTypes/genericVarianceViolation/simple.fir.kt deleted file mode 100644 index f8f49d2993f..00000000000 --- a/compiler/testData/diagnostics/tests/platformTypes/genericVarianceViolation/simple.fir.kt +++ /dev/null @@ -1,67 +0,0 @@ -// !DIAGNOSTICS: -UNUSED_VARIABLE -// FILE: A.java - -import java.util.*; - -public class A { - void foo(List x) {} - void foo(Iterable x) {} - void foo(Iterator x) {} - void foo(Set x) {} - void foo(Map x) {} - void foo(Map.Entry x) {} - - void foo1(List> x) {} -} - -// FILE: main.kt - -fun main( - a: A, - ml: MutableList, l: List, - ms: MutableSet, s: Set, - mm: MutableMap, m: Map, - mme: MutableMap.MutableEntry, me: Map.Entry, - mll: MutableList>, ll: List> -) { - // Lists - a.foo(ml) - a.foo(l) - a.foo(ml as MutableList) - a.foo(l as List) - - // Iterables - val mit: MutableIterable = ml - val it: Iterable = ml - a.foo(mit) - a.foo(it) - - // Iterators - a.foo(ml.iterator()) - a.foo(l.iterator()) - - // Sets - a.foo(ms) - a.foo(s) - a.foo(ms as MutableSet) - a.foo(s as Set) - - // Maps - a.foo(mm) - a.foo(m) - a.foo(mm as MutableMap) - a.foo(m as Map) - - // Map entries - a.foo(mme) - a.foo(me) - a.foo(mme as MutableMap.MutableEntry) - a.foo(me as Map.Entry) - - // Lists of lists - a.foo1(mll) - a.foo1(ll) - a.foo1(mll as MutableList>) - a.foo1(ll as List>) - -} diff --git a/compiler/testData/diagnostics/tests/platformTypes/genericVarianceViolation/simple.kt b/compiler/testData/diagnostics/tests/platformTypes/genericVarianceViolation/simple.kt index b180f8cead2..5c0ae57bc48 100644 --- a/compiler/testData/diagnostics/tests/platformTypes/genericVarianceViolation/simple.kt +++ b/compiler/testData/diagnostics/tests/platformTypes/genericVarianceViolation/simple.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // !DIAGNOSTICS: -UNUSED_VARIABLE // FILE: A.java diff --git a/compiler/testData/diagnostics/tests/platformTypes/genericVarianceViolation/smartCast.fir.kt b/compiler/testData/diagnostics/tests/platformTypes/genericVarianceViolation/smartCast.fir.kt index 20d6abb457d..3b217869729 100644 --- a/compiler/testData/diagnostics/tests/platformTypes/genericVarianceViolation/smartCast.fir.kt +++ b/compiler/testData/diagnostics/tests/platformTypes/genericVarianceViolation/smartCast.fir.kt @@ -11,6 +11,6 @@ public class A { fun main(a: A, ml: Any) { if (ml is MutableList) { a.foo(ml) - a.foo(ml as List) + a.foo(ml as List) } } diff --git a/compiler/testData/diagnostics/tests/regressions/kt307.fir.kt b/compiler/testData/diagnostics/tests/regressions/kt307.fir.kt deleted file mode 100644 index d7cc6d0f0b1..00000000000 --- a/compiler/testData/diagnostics/tests/regressions/kt307.fir.kt +++ /dev/null @@ -1,11 +0,0 @@ -// KT-307 Unresolved reference - -open class AL { - fun get(i : Int) : Any? = i -} - -interface ALE : AL { - fun getOrNull(index: Int, value: T) : T { - return get(index) as? T ?: value - } -} \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/regressions/kt307.kt b/compiler/testData/diagnostics/tests/regressions/kt307.kt index ebc11869511..f702aa22f0d 100644 --- a/compiler/testData/diagnostics/tests/regressions/kt307.kt +++ b/compiler/testData/diagnostics/tests/regressions/kt307.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // KT-307 Unresolved reference open class AL { diff --git a/compiler/testData/diagnostics/tests/regressions/kt498.fir.kt b/compiler/testData/diagnostics/tests/regressions/kt498.fir.kt index 057b3aaf57e..29c44271977 100644 --- a/compiler/testData/diagnostics/tests/regressions/kt498.fir.kt +++ b/compiler/testData/diagnostics/tests/regressions/kt498.fir.kt @@ -4,5 +4,5 @@ class IdUnavailableException() : Exception() {} fun T.getJavaClass() : Class { - return ((this as Object).getClass()) as Class // Some error here, because of Exception() used above. ?!!! -} \ No newline at end of file + return ((this as Object).getClass()) as Class // Some error here, because of Exception() used above. ?!!! +} diff --git a/compiler/testData/diagnostics/tests/regressions/kt716.fir.kt b/compiler/testData/diagnostics/tests/regressions/kt716.fir.kt index 1464afccfb6..7c87483714c 100644 --- a/compiler/testData/diagnostics/tests/regressions/kt716.fir.kt +++ b/compiler/testData/diagnostics/tests/regressions/kt716.fir.kt @@ -6,7 +6,7 @@ fun typeinfo() : TypeInfo = null as TypeInfo fun TypeInfo.getJavaClass() : java.lang.Class { val t : java.lang.Object = this as java.lang.Object - return t.getClass() as java.lang.Class // inferred type is Object but Serializable was expected + return t.getClass() as java.lang.Class // inferred type is Object but Serializable was expected } fun getJavaClass() = typeinfo().getJavaClass() diff --git a/compiler/testData/diagnostics/tests/samConversions/samConversionToGeneric.fir.kt b/compiler/testData/diagnostics/tests/samConversions/samConversionToGeneric.fir.kt index 54f85636763..1456634ff6a 100644 --- a/compiler/testData/diagnostics/tests/samConversions/samConversionToGeneric.fir.kt +++ b/compiler/testData/diagnostics/tests/samConversions/samConversionToGeneric.fir.kt @@ -9,12 +9,12 @@ fun test2() = J { x: String -> x } fun test3() = H.bar { x: String -> x } fun test4(a: Any) { - a as J + a as J H.bar(a) } fun test5(a: Any) { - a as (String) -> String + a as (String) -> String H.bar(a) } @@ -23,7 +23,7 @@ fun test6(a: (T) -> T) { } fun test7(a: Any) { - a as (T) -> T + a as (T) -> T H.bar(a) } @@ -55,4 +55,4 @@ public interface J2X extends J2 { public class H { public static void bar(J j) {} public static void bar2x(J2X j2x) {} -} \ No newline at end of file +} diff --git a/compiler/testData/diagnostics/tests/samConversions/samConversionsWithSmartCasts.fir.kt b/compiler/testData/diagnostics/tests/samConversions/samConversionsWithSmartCasts.fir.kt index 329a29f52dd..2e608d4c41e 100644 --- a/compiler/testData/diagnostics/tests/samConversions/samConversionsWithSmartCasts.fir.kt +++ b/compiler/testData/diagnostics/tests/samConversions/samConversionsWithSmartCasts.fir.kt @@ -37,18 +37,18 @@ fun test5(a: Any) { fun test5x(a: Any) { if (a is Runnable) { - a as () -> Unit + a as () -> Unit J().run1(a) } } fun test6(a: Any) { - a as () -> Unit + a as () -> Unit J().run1(a) } fun test7(a: (Int) -> Int) { - a as () -> Unit + a as () -> Unit J().run1(a) } @@ -69,4 +69,4 @@ public class J { public void run2(Runnable r1, Runnable r2) {} public static T id(T x) { return x; } -} \ No newline at end of file +} diff --git a/compiler/testData/diagnostics/tests/smartCasts/kt10444.fir.kt b/compiler/testData/diagnostics/tests/smartCasts/kt10444.fir.kt index 4845fcb6bf3..b96614a413b 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/kt10444.fir.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/kt10444.fir.kt @@ -3,12 +3,12 @@ class Qwe(val a: T?) { fun test1(obj: Any) { - obj as Qwe + obj as Qwe check(obj.a) } fun test1(obj: Qwe<*>) { - obj as Qwe + obj as Qwe check(obj.a) } diff --git a/compiler/testData/diagnostics/tests/smartCasts/kt3224.fir.kt b/compiler/testData/diagnostics/tests/smartCasts/kt3224.fir.kt deleted file mode 100644 index 1bd312dc7b6..00000000000 --- a/compiler/testData/diagnostics/tests/smartCasts/kt3224.fir.kt +++ /dev/null @@ -1,8 +0,0 @@ -// Works already in M11 - -fun test(c : Class<*>) { - val sc = c as Class - // No ambiguous overload - c.getAnnotations(); - sc.getAnnotations(); -} diff --git a/compiler/testData/diagnostics/tests/smartCasts/kt3224.kt b/compiler/testData/diagnostics/tests/smartCasts/kt3224.kt index 4d563a84c1d..0f2c84a82db 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/kt3224.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/kt3224.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // Works already in M11 fun test(c : Class<*>) { diff --git a/compiler/testData/diagnostics/tests/substitutions/kt4887.fir.kt b/compiler/testData/diagnostics/tests/substitutions/kt4887.fir.kt deleted file mode 100644 index 777fa655cc6..00000000000 --- a/compiler/testData/diagnostics/tests/substitutions/kt4887.fir.kt +++ /dev/null @@ -1,8 +0,0 @@ -package h - -public class MyClass(param: MyClass) { - fun test() { - val result: MyClass? = null - MyClass(result as MyClass) - } -} \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/substitutions/kt4887.kt b/compiler/testData/diagnostics/tests/substitutions/kt4887.kt index 68186eb01d4..f55d9770cd2 100644 --- a/compiler/testData/diagnostics/tests/substitutions/kt4887.kt +++ b/compiler/testData/diagnostics/tests/substitutions/kt4887.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL package h public class MyClass(param: MyClass) { diff --git a/compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/kt15516.fir.kt b/compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/kt15516.fir.kt deleted file mode 100644 index c0705a2b7e2..00000000000 --- a/compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/kt15516.fir.kt +++ /dev/null @@ -1,18 +0,0 @@ -// SKIP_TXT -class StateMachine internal constructor() { - fun getInputStub(): Q = null as Q -} - -fun stateMachine(block: suspend StateMachine.() -> Unit): StateMachine { - return StateMachine() -} - -class Problem(){ - fun getInputStub(): F = null as F - - fun createStateMachine(): StateMachine = stateMachine { - val letter = getInputStub() - if (letter is Any) - println("yes") - } -} diff --git a/compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/kt15516.kt b/compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/kt15516.kt index de07074bac2..5c842153b48 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/kt15516.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/kt15516.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // SKIP_TXT class StateMachine internal constructor() { fun getInputStub(): Q = null as Q diff --git a/compiler/testData/diagnostics/testsWithStdLib/coroutines/lambdaExpectedType.fir.kt b/compiler/testData/diagnostics/testsWithStdLib/coroutines/lambdaExpectedType.fir.kt index f8371b2cb46..c27b035b234 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/coroutines/lambdaExpectedType.fir.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/coroutines/lambdaExpectedType.fir.kt @@ -21,7 +21,7 @@ fun foo() { val x = { 1 } builder(x) - builder({1} as (suspend () -> Int)) + builder({1} as (suspend () -> Int)) var i: Int = 1 i = genericBuilder({ 1 }) diff --git a/compiler/testData/diagnostics/testsWithStdLib/coroutines/usageOfResultTypeInReturnType.fir.kt b/compiler/testData/diagnostics/testsWithStdLib/coroutines/usageOfResultTypeInReturnType.fir.kt deleted file mode 100644 index 0053f27fce0..00000000000 --- a/compiler/testData/diagnostics/testsWithStdLib/coroutines/usageOfResultTypeInReturnType.fir.kt +++ /dev/null @@ -1,124 +0,0 @@ -// !DIAGNOSTICS: -UNUSED_PARAMETER, -UNUSED_EXPRESSION, -UNUSED_VARIABLE -// !LANGUAGE: +InlineClasses -AllowResultInReturnType, -JvmInlineValueClasses - -typealias ResultAlias = Result - -inline class InlineResult(private val r: Result) - -fun params( - r1: Result, - r2: Result?, - r3: ResultAlias, - r4: List>, - r5: InlineResult, - vararg r6: Result -) {} - -class CtorParams(r1: Result) - -fun returnTypePublic(): Result = TODO() -internal fun returnTypeInternal(): Result = TODO() -private fun returnTypePrivate(): Result = TODO() -fun returnTypeNullable(): Result? = TODO() -fun returnTypeAlias(): ResultAlias = TODO() -fun returnInferred(r1: Result, r2: ResultAlias, b: Boolean) = if (b) r1 else r2 - -fun returnTypeInline(): InlineResult = TODO() -fun returnContainer(): List> = TODO() - -val topLevelP: Result = TODO() -val topLevelPInferred = topLevelP -internal val topLevelPInternal: Result = TODO() - -private val topLevelPPrivate: Result = TODO() -private val topLevelPPrivateInferred = topLevelP - -private val topLevelPPrivateCustomGetter: Result - get() = TODO() - -val asFunctional: () -> Result = TODO() - -open class PublicCls( - val r1: Result, - val r2: Result?, - val r3: ResultAlias, - val r4: ResultAlias?, - - val r5: InlineResult, - - internal val r6: Result, - - private val r7: Result, - val r8: List> -) { - val p1: Result = TODO() - var p2: Result = TODO() - val p3: ResultAlias? = TODO() - - val p4 = p1 - - internal val p5: Result = TODO() - - private var p6: Result = TODO() - - internal val p7 = p1 - protected val p8 = p1 - - fun returnInCls(): Result = TODO() - protected fun returnInClsProtected(): Result = TODO() - private fun returnInClsPrivate(): Result = TODO() -} - -internal open class InternalCls( - val r1: Result, - val r2: ResultAlias?, - - val r3: List> -) { - companion object { - val cr1: Result = TODO() - - private val cr2: Result = TODO() - } - - val p1 = r1 - val p2: Result = TODO() - - protected val p3 = p1 - - fun returnInInternal(): Result = TODO() - protected fun returnInClsProtected(): Result = TODO() -} - -private class PrivateCls( - val r1: Result, - val r2: ResultAlias?, - val r3: List> -) { - companion object { - val cr1: Result = TODO() - private val cr2: Result = TODO() - } - - val p1 = r1 - val p2: Result = TODO() - - fun returnInPrivate(): Result = TODO() -} - -fun local(r: Result) { - val l1: Result? = null - val l2 = r - - fun localFun(): Result = TODO() - - class F { - val p1: Result = r - val p2 = r - } -} - -fun resultInGenericFun(r: Result): T = r as T - -val asFunPublic: () -> Result = TODO() -private val asFun: () -> Result? = TODO() diff --git a/compiler/testData/diagnostics/testsWithStdLib/coroutines/usageOfResultTypeInReturnType.kt b/compiler/testData/diagnostics/testsWithStdLib/coroutines/usageOfResultTypeInReturnType.kt index 861359bed30..7027238b511 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/coroutines/usageOfResultTypeInReturnType.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/coroutines/usageOfResultTypeInReturnType.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // !DIAGNOSTICS: -UNUSED_PARAMETER, -UNUSED_EXPRESSION, -UNUSED_VARIABLE // !LANGUAGE: +InlineClasses -AllowResultInReturnType, -JvmInlineValueClasses diff --git a/compiler/testData/diagnostics/testsWithStdLib/coroutines/usageOfResultTypeInReturnType_1_4.fir.kt b/compiler/testData/diagnostics/testsWithStdLib/coroutines/usageOfResultTypeInReturnType_1_4.fir.kt deleted file mode 100644 index dc180b8a96b..00000000000 --- a/compiler/testData/diagnostics/testsWithStdLib/coroutines/usageOfResultTypeInReturnType_1_4.fir.kt +++ /dev/null @@ -1,124 +0,0 @@ -// !DIAGNOSTICS: -UNUSED_PARAMETER, -UNUSED_EXPRESSION, -UNUSED_VARIABLE -// !LANGUAGE: +InlineClasses +AllowResultInReturnType, -JvmInlineValueClasses - -typealias ResultAlias = Result - -inline class InlineResult(private val r: Result) - -fun params( - r1: Result, - r2: Result?, - r3: ResultAlias, - r4: List>, - r5: InlineResult, - vararg r6: Result -) {} - -class CtorParams(r1: Result) - -fun returnTypePublic(): Result = TODO() -internal fun returnTypeInternal(): Result = TODO() -private fun returnTypePrivate(): Result = TODO() -fun returnTypeNullable(): Result? = TODO() -fun returnTypeAlias(): ResultAlias = TODO() -fun returnInferred(r1: Result, r2: ResultAlias, b: Boolean) = if (b) r1 else r2 - -fun returnTypeInline(): InlineResult = TODO() -fun returnContainer(): List> = TODO() - -val topLevelP: Result = TODO() -val topLevelPInferred = topLevelP -internal val topLevelPInternal: Result = TODO() - -private val topLevelPPrivate: Result = TODO() -private val topLevelPPrivateInferred = topLevelP - -private val topLevelPPrivateCustomGetter: Result - get() = TODO() - -val asFunctional: () -> Result = TODO() - -open class PublicCls( - val r1: Result, - val r2: Result?, - val r3: ResultAlias, - val r4: ResultAlias?, - - val r5: InlineResult, - - internal val r6: Result, - - private val r7: Result, - val r8: List> -) { - val p1: Result = TODO() - var p2: Result = TODO() - val p3: ResultAlias? = TODO() - - val p4 = p1 - - internal val p5: Result = TODO() - - private var p6: Result = TODO() - - internal val p7 = p1 - protected val p8 = p1 - - fun returnInCls(): Result = TODO() - protected fun returnInClsProtected(): Result = TODO() - private fun returnInClsPrivate(): Result = TODO() -} - -internal open class InternalCls( - val r1: Result, - val r2: ResultAlias?, - - val r3: List> -) { - companion object { - val cr1: Result = TODO() - - private val cr2: Result = TODO() - } - - val p1 = r1 - val p2: Result = TODO() - - protected val p3 = p1 - - fun returnInInternal(): Result = TODO() - protected fun returnInClsProtected(): Result = TODO() -} - -private class PrivateCls( - val r1: Result, - val r2: ResultAlias?, - val r3: List> -) { - companion object { - val cr1: Result = TODO() - private val cr2: Result = TODO() - } - - val p1 = r1 - val p2: Result = TODO() - - fun returnInPrivate(): Result = TODO() -} - -fun local(r: Result) { - val l1: Result? = null - val l2 = r - - fun localFun(): Result = TODO() - - class F { - val p1: Result = r - val p2 = r - } -} - -fun resultInGenericFun(r: Result): T = r as T - -val asFunPublic: () -> Result = TODO() -private val asFun: () -> Result? = TODO() diff --git a/compiler/testData/diagnostics/testsWithStdLib/coroutines/usageOfResultTypeInReturnType_1_4.kt b/compiler/testData/diagnostics/testsWithStdLib/coroutines/usageOfResultTypeInReturnType_1_4.kt index b319f429f45..b9a60ab03b1 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/coroutines/usageOfResultTypeInReturnType_1_4.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/coroutines/usageOfResultTypeInReturnType_1_4.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // !DIAGNOSTICS: -UNUSED_PARAMETER, -UNUSED_EXPRESSION, -UNUSED_VARIABLE // !LANGUAGE: +InlineClasses +AllowResultInReturnType, -JvmInlineValueClasses diff --git a/compiler/testData/diagnostics/testsWithStdLib/functionLiterals/pseudocodeMemoryOverhead.fir.kt b/compiler/testData/diagnostics/testsWithStdLib/functionLiterals/pseudocodeMemoryOverhead.fir.kt deleted file mode 100644 index 8222242a840..00000000000 --- a/compiler/testData/diagnostics/testsWithStdLib/functionLiterals/pseudocodeMemoryOverhead.fir.kt +++ /dev/null @@ -1,371 +0,0 @@ -import java.util.HashMap - -private fun unaryOperation( - a: CompileTimeType, - functionName: String, - operation: Function1, - checker: Function1 -) = UnaryOperationKey(a, functionName) to Pair(operation, checker) as Pair, Function1> - -private fun binaryOperation( - a: CompileTimeType, - b: CompileTimeType, - functionName: String, - operation: Function2, - checker: Function2 -) = BinaryOperationKey(a, b, functionName) to Pair(operation, checker) as Pair, Function2> - -private data class UnaryOperationKey(val f: CompileTimeType, val functionName: String) -//HashMap, Pair, Function2>> -private data class BinaryOperationKey(val f: CompileTimeType, val g: CompileTimeType, val functionName: String) - -private class CompileTimeType - -private val BYTE = CompileTimeType() -private val CHAR = CompileTimeType() -private val BOOLEAN = CompileTimeType() -private val DOUBLE = CompileTimeType() -private val FLOAT = CompileTimeType() -private val INT = CompileTimeType() -private val LONG = CompileTimeType() -private val SHORT = CompileTimeType() -private val STRING = CompileTimeType() -private val ANY = CompileTimeType() - - -private val emptyBinaryFun: Function2 = { a, b -> BigInteger("0") } -private val emptyUnaryFun: Function1 = { a -> 1.toLong() } - -private val unaryOperations: HashMap, Pair, Function1>> - = hashMapOf, Pair, Function1>>( - unaryOperation(BOOLEAN, "not!", { a -> a.not() }, emptyUnaryFun), - unaryOperation(BYTE, "toInt", { a -> a.toInt() }, emptyUnaryFun), - unaryOperation(BYTE, "minus", { a -> a.unaryMinus() }, { a -> a.unaryMinus() }), - unaryOperation(BYTE, "minus", { a -> a.unaryMinus() }, { a -> a.unaryMinus() }), - unaryOperation(BYTE, "toChar", { a -> a.toChar() }, emptyUnaryFun), - unaryOperation(BYTE, "toLong", { a -> a.toLong() }, emptyUnaryFun), - unaryOperation(BYTE, "plus", { a -> a.unaryPlus() }, emptyUnaryFun), - unaryOperation(BYTE, "toFloat", { a -> a.toFloat() }, emptyUnaryFun), - unaryOperation(BYTE, "toDouble", { a -> a.toDouble() }, emptyUnaryFun), - unaryOperation(BYTE, "toShort", { a -> a.toShort() }, emptyUnaryFun), - unaryOperation(BYTE, "toByte", { a -> a.toByte() }, emptyUnaryFun), - unaryOperation(CHAR, "toInt", { a -> a.toInt() }, emptyUnaryFun), - unaryOperation(CHAR, "toChar", { a -> a.toChar() }, emptyUnaryFun), - unaryOperation(CHAR, "toLong", { a -> a.toLong() }, emptyUnaryFun), - unaryOperation(CHAR, "toFloat", { a -> a.toFloat() }, emptyUnaryFun), - unaryOperation(CHAR, "toDouble", { a -> a.toDouble() }, emptyUnaryFun), - unaryOperation(CHAR, "toShort", { a -> a.toShort() }, emptyUnaryFun), - unaryOperation(CHAR, "toByte", { a -> a.toByte() }, emptyUnaryFun), - unaryOperation(DOUBLE, "toInt", { a -> a.toInt() }, emptyUnaryFun), - unaryOperation(DOUBLE, "minus", { a -> a.unaryMinus() }, emptyUnaryFun), - unaryOperation(DOUBLE, "toChar", { a -> a.toChar() }, emptyUnaryFun), - unaryOperation(DOUBLE, "toLong", { a -> a.toLong() }, emptyUnaryFun), - unaryOperation(DOUBLE, "plus", { a -> a.unaryPlus() }, emptyUnaryFun), - unaryOperation(DOUBLE, "toFloat", { a -> a.toFloat() }, emptyUnaryFun), - unaryOperation(DOUBLE, "toDouble", { a -> a.toDouble() }, emptyUnaryFun), - unaryOperation(DOUBLE, "toShort", { a -> a.toShort() }, emptyUnaryFun), - unaryOperation(DOUBLE, "toByte", { a -> a.toByte() }, emptyUnaryFun), - unaryOperation(FLOAT, "toInt", { a -> a.toInt() }, emptyUnaryFun), - unaryOperation(FLOAT, "minus", { a -> a.unaryMinus() }, emptyUnaryFun), - unaryOperation(FLOAT, "toChar", { a -> a.toChar() }, emptyUnaryFun), - unaryOperation(FLOAT, "toLong", { a -> a.toLong() }, emptyUnaryFun), - unaryOperation(FLOAT, "plus", { a -> a.unaryPlus() }, emptyUnaryFun), - unaryOperation(FLOAT, "toFloat", { a -> a.toFloat() }, emptyUnaryFun), - unaryOperation(FLOAT, "toDouble", { a -> a.toDouble() }, emptyUnaryFun), - unaryOperation(FLOAT, "toShort", { a -> a.toShort() }, emptyUnaryFun), - unaryOperation(FLOAT, "toByte", { a -> a.toByte() }, emptyUnaryFun), - unaryOperation(INT, "plus", { a -> a.unaryPlus() }, emptyUnaryFun), - unaryOperation(INT, "toShort", { a -> a.toShort() }, emptyUnaryFun), - unaryOperation(INT, "toByte", { a -> a.toByte() }, emptyUnaryFun), - unaryOperation(INT, "inv", { a -> a.inv() }, emptyUnaryFun), - unaryOperation(INT, "toInt", { a -> a.toInt() }, emptyUnaryFun), - unaryOperation(INT, "minus", { a -> a.unaryMinus() }, { a -> a.unaryMinus() }), - unaryOperation(INT, "toChar", { a -> a.toChar() }, emptyUnaryFun), - unaryOperation(INT, "toLong", { a -> a.toLong() }, emptyUnaryFun), - unaryOperation(INT, "toDouble", { a -> a.toDouble() }, emptyUnaryFun), - unaryOperation(INT, "toFloat", { a -> a.toFloat() }, emptyUnaryFun), - unaryOperation(LONG, "plus", { a -> a.unaryPlus() }, emptyUnaryFun), - unaryOperation(LONG, "toShort", { a -> a.toShort() }, emptyUnaryFun), - unaryOperation(LONG, "toByte", { a -> a.toByte() }, emptyUnaryFun), - unaryOperation(LONG, "inv", { a -> a.inv() }, emptyUnaryFun), - unaryOperation(LONG, "toInt", { a -> a.toInt() }, emptyUnaryFun), - unaryOperation(LONG, "minus", { a -> a.unaryMinus() }, { a -> a.unaryMinus() }), - unaryOperation(LONG, "toChar", { a -> a.toChar() }, emptyUnaryFun), - unaryOperation(LONG, "toLong", { a -> a.toLong() }, emptyUnaryFun), - unaryOperation(LONG, "toDouble", { a -> a.toDouble() }, emptyUnaryFun), - unaryOperation(LONG, "toFloat", { a -> a.toFloat() }, emptyUnaryFun), - unaryOperation(SHORT, "toInt", { a -> a.toInt() }, emptyUnaryFun), - unaryOperation(SHORT, "minus", { a -> a.unaryMinus() }, { a -> a.unaryMinus() }), - unaryOperation(SHORT, "toChar", { a -> a.toChar() }, emptyUnaryFun), - unaryOperation(SHORT, "toLong", { a -> a.toLong() }, emptyUnaryFun), - unaryOperation(SHORT, "plus", { a -> a.unaryPlus() }, emptyUnaryFun), - unaryOperation(SHORT, "toFloat", { a -> a.toFloat() }, emptyUnaryFun), - unaryOperation(SHORT, "toDouble", { a -> a.toDouble() }, emptyUnaryFun), - unaryOperation(SHORT, "toShort", { a -> a.toShort() }, emptyUnaryFun), - unaryOperation(SHORT, "toByte", { a -> a.toByte() }, emptyUnaryFun), - unaryOperation(STRING, "toString", { a -> a.toString() }, emptyUnaryFun) -) - -private val binaryOperations: HashMap, Pair, Function2>> - = hashMapOf, Pair, Function2>>( - binaryOperation(BOOLEAN, BOOLEAN, "xor", { a, b -> a.xor(b) }, emptyBinaryFun), - binaryOperation(BOOLEAN, BOOLEAN, "or", { a, b -> a.or(b) }, emptyBinaryFun), - binaryOperation(BOOLEAN, ANY, "equals", { a, b -> a.equals(b) }, emptyBinaryFun), - binaryOperation(BOOLEAN, BOOLEAN, "and", { a, b -> a.and(b) }, emptyBinaryFun), - binaryOperation(BOOLEAN, BOOLEAN, "compareTo", { a, b -> a.compareTo(b) }, emptyBinaryFun), - binaryOperation(BYTE, BYTE, "minus", { a, b -> a.minus(b) }, { a, b -> a.subtract(b) }), - binaryOperation(BYTE, DOUBLE, "minus", { a, b -> a.minus(b) }, emptyBinaryFun), - binaryOperation(BYTE, FLOAT, "minus", { a, b -> a.minus(b) }, emptyBinaryFun), - binaryOperation(BYTE, INT, "minus", { a, b -> a.minus(b) }, { a, b -> a.subtract(b) }), - binaryOperation(BYTE, LONG, "minus", { a, b -> a.minus(b) }, { a, b -> a.subtract(b) }), - binaryOperation(BYTE, SHORT, "minus", { a, b -> a.minus(b) }, { a, b -> a.subtract(b) }), - binaryOperation(BYTE, BYTE, "compareTo", { a, b -> a.compareTo(b) }, emptyBinaryFun), - binaryOperation(BYTE, DOUBLE, "compareTo", { a, b -> a.compareTo(b) }, emptyBinaryFun), - binaryOperation(BYTE, FLOAT, "compareTo", { a, b -> a.compareTo(b) }, emptyBinaryFun), - binaryOperation(BYTE, INT, "compareTo", { a, b -> a.compareTo(b) }, emptyBinaryFun), - binaryOperation(BYTE, LONG, "compareTo", { a, b -> a.compareTo(b) }, emptyBinaryFun), - binaryOperation(BYTE, SHORT, "compareTo", { a, b -> a.compareTo(b) }, emptyBinaryFun), - binaryOperation(BYTE, BYTE, "plus", { a, b -> a.plus(b) }, { a, b -> a.add(b) }), - binaryOperation(BYTE, DOUBLE, "plus", { a, b -> a.plus(b) }, emptyBinaryFun), - binaryOperation(BYTE, FLOAT, "plus", { a, b -> a.plus(b) }, emptyBinaryFun), - binaryOperation(BYTE, INT, "plus", { a, b -> a.plus(b) }, { a, b -> a.add(b) }), - binaryOperation(BYTE, LONG, "plus", { a, b -> a.plus(b) }, { a, b -> a.add(b) }), - binaryOperation(BYTE, SHORT, "plus", { a, b -> a.plus(b) }, { a, b -> a.add(b) }), - binaryOperation(BYTE, BYTE, "div", { a, b -> a.div(b) }, { a, b -> a.divide(b) }), - binaryOperation(BYTE, DOUBLE, "div", { a, b -> a.div(b) }, emptyBinaryFun), - binaryOperation(BYTE, FLOAT, "div", { a, b -> a.div(b) }, emptyBinaryFun), - binaryOperation(BYTE, INT, "div", { a, b -> a.div(b) }, { a, b -> a.divide(b) }), - binaryOperation(BYTE, LONG, "div", { a, b -> a.div(b) }, { a, b -> a.divide(b) }), - binaryOperation(BYTE, SHORT, "div", { a, b -> a.div(b) }, { a, b -> a.divide(b) }), - binaryOperation(BYTE, BYTE, "rem", { a, b -> a.rem(b) }, { a, b -> a.rem(b) }), - binaryOperation(BYTE, DOUBLE, "rem", { a, b -> a.rem(b) }, emptyBinaryFun), - binaryOperation(BYTE, FLOAT, "rem", { a, b -> a.rem(b) }, emptyBinaryFun), - binaryOperation(BYTE, INT, "rem", { a, b -> a.rem(b) }, { a, b -> a.rem(b) }), - binaryOperation(BYTE, LONG, "rem", { a, b -> a.rem(b) }, { a, b -> a.rem(b) }), - binaryOperation(BYTE, SHORT, "rem", { a, b -> a.rem(b) }, { a, b -> a.rem(b) }), - binaryOperation(BYTE, BYTE, "times", { a, b -> a.times(b) }, { a, b -> a.multiply(b) }), - binaryOperation(BYTE, DOUBLE, "times", { a, b -> a.times(b) }, emptyBinaryFun), - binaryOperation(BYTE, FLOAT, "times", { a, b -> a.times(b) }, emptyBinaryFun), - binaryOperation(BYTE, INT, "times", { a, b -> a.times(b) }, { a, b -> a.multiply(b) }), - binaryOperation(BYTE, LONG, "times", { a, b -> a.times(b) }, { a, b -> a.multiply(b) }), - binaryOperation(BYTE, SHORT, "times", { a, b -> a.times(b) }, { a, b -> a.multiply(b) }), - binaryOperation(BYTE, ANY, "equals", { a, b -> a.equals(b) }, emptyBinaryFun), - binaryOperation(CHAR, CHAR, "minus", { a, b -> a.minus(b) }, emptyBinaryFun), - binaryOperation(CHAR, CHAR, "compareTo", { a, b -> a.compareTo(b) }, emptyBinaryFun), - binaryOperation(CHAR, INT, "minus", { a, b -> a.minus(b) }, emptyBinaryFun), - binaryOperation(CHAR, INT, "plus", { a, b -> a.plus(b) }, emptyBinaryFun), - binaryOperation(CHAR, ANY, "equals", { a, b -> a.equals(b) }, emptyBinaryFun), - binaryOperation(DOUBLE, BYTE, "minus", { a, b -> a.minus(b) }, emptyBinaryFun), - binaryOperation(DOUBLE, DOUBLE, "minus", { a, b -> a.minus(b) }, emptyBinaryFun), - binaryOperation(DOUBLE, FLOAT, "minus", { a, b -> a.minus(b) }, emptyBinaryFun), - binaryOperation(DOUBLE, INT, "minus", { a, b -> a.minus(b) }, emptyBinaryFun), - binaryOperation(DOUBLE, LONG, "minus", { a, b -> a.minus(b) }, emptyBinaryFun), - binaryOperation(DOUBLE, SHORT, "minus", { a, b -> a.minus(b) }, emptyBinaryFun), - binaryOperation(DOUBLE, BYTE, "compareTo", { a, b -> a.compareTo(b) }, emptyBinaryFun), - binaryOperation(DOUBLE, DOUBLE, "compareTo", { a, b -> a.compareTo(b) }, emptyBinaryFun), - binaryOperation(DOUBLE, FLOAT, "compareTo", { a, b -> a.compareTo(b) }, emptyBinaryFun), - binaryOperation(DOUBLE, INT, "compareTo", { a, b -> a.compareTo(b) }, emptyBinaryFun), - binaryOperation(DOUBLE, LONG, "compareTo", { a, b -> a.compareTo(b) }, emptyBinaryFun), - binaryOperation(DOUBLE, SHORT, "compareTo", { a, b -> a.compareTo(b) }, emptyBinaryFun), - binaryOperation(DOUBLE, BYTE, "plus", { a, b -> a.plus(b) }, emptyBinaryFun), - binaryOperation(DOUBLE, DOUBLE, "plus", { a, b -> a.plus(b) }, emptyBinaryFun), - binaryOperation(DOUBLE, FLOAT, "plus", { a, b -> a.plus(b) }, emptyBinaryFun), - binaryOperation(DOUBLE, INT, "plus", { a, b -> a.plus(b) }, emptyBinaryFun), - binaryOperation(DOUBLE, LONG, "plus", { a, b -> a.plus(b) }, emptyBinaryFun), - binaryOperation(DOUBLE, SHORT, "plus", { a, b -> a.plus(b) }, emptyBinaryFun), - binaryOperation(DOUBLE, BYTE, "div", { a, b -> a.div(b) }, emptyBinaryFun), - binaryOperation(DOUBLE, DOUBLE, "div", { a, b -> a.div(b) }, emptyBinaryFun), - binaryOperation(DOUBLE, FLOAT, "div", { a, b -> a.div(b) }, emptyBinaryFun), - binaryOperation(DOUBLE, INT, "div", { a, b -> a.div(b) }, emptyBinaryFun), - binaryOperation(DOUBLE, LONG, "div", { a, b -> a.div(b) }, emptyBinaryFun), - binaryOperation(DOUBLE, SHORT, "div", { a, b -> a.div(b) }, emptyBinaryFun), - binaryOperation(DOUBLE, BYTE, "rem", { a, b -> a.rem(b) }, emptyBinaryFun), - binaryOperation(DOUBLE, DOUBLE, "rem", { a, b -> a.rem(b) }, emptyBinaryFun), - binaryOperation(DOUBLE, FLOAT, "rem", { a, b -> a.rem(b) }, emptyBinaryFun), - binaryOperation(DOUBLE, INT, "rem", { a, b -> a.rem(b) }, emptyBinaryFun), - binaryOperation(DOUBLE, LONG, "rem", { a, b -> a.rem(b) }, emptyBinaryFun), - binaryOperation(DOUBLE, SHORT, "rem", { a, b -> a.rem(b) }, emptyBinaryFun), - binaryOperation(DOUBLE, BYTE, "times", { a, b -> a.times(b) }, emptyBinaryFun), - binaryOperation(DOUBLE, DOUBLE, "times", { a, b -> a.times(b) }, emptyBinaryFun), - binaryOperation(DOUBLE, FLOAT, "times", { a, b -> a.times(b) }, emptyBinaryFun), - binaryOperation(DOUBLE, INT, "times", { a, b -> a.times(b) }, emptyBinaryFun), - binaryOperation(DOUBLE, LONG, "times", { a, b -> a.times(b) }, emptyBinaryFun), - binaryOperation(DOUBLE, SHORT, "times", { a, b -> a.times(b) }, emptyBinaryFun), - binaryOperation(DOUBLE, ANY, "equals", { a, b -> a.equals(b) }, emptyBinaryFun), - binaryOperation(FLOAT, BYTE, "minus", { a, b -> a.minus(b) }, emptyBinaryFun), - binaryOperation(FLOAT, DOUBLE, "minus", { a, b -> a.minus(b) }, emptyBinaryFun), - binaryOperation(FLOAT, FLOAT, "minus", { a, b -> a.minus(b) }, emptyBinaryFun), - binaryOperation(FLOAT, INT, "minus", { a, b -> a.minus(b) }, emptyBinaryFun), - binaryOperation(FLOAT, LONG, "minus", { a, b -> a.minus(b) }, emptyBinaryFun), - binaryOperation(FLOAT, SHORT, "minus", { a, b -> a.minus(b) }, emptyBinaryFun), - binaryOperation(FLOAT, BYTE, "compareTo", { a, b -> a.compareTo(b) }, emptyBinaryFun), - binaryOperation(FLOAT, DOUBLE, "compareTo", { a, b -> a.compareTo(b) }, emptyBinaryFun), - binaryOperation(FLOAT, FLOAT, "compareTo", { a, b -> a.compareTo(b) }, emptyBinaryFun), - binaryOperation(FLOAT, INT, "compareTo", { a, b -> a.compareTo(b) }, emptyBinaryFun), - binaryOperation(FLOAT, LONG, "compareTo", { a, b -> a.compareTo(b) }, emptyBinaryFun), - binaryOperation(FLOAT, SHORT, "compareTo", { a, b -> a.compareTo(b) }, emptyBinaryFun), - binaryOperation(FLOAT, BYTE, "plus", { a, b -> a.plus(b) }, emptyBinaryFun), - binaryOperation(FLOAT, DOUBLE, "plus", { a, b -> a.plus(b) }, emptyBinaryFun), - binaryOperation(FLOAT, FLOAT, "plus", { a, b -> a.plus(b) }, emptyBinaryFun), - binaryOperation(FLOAT, INT, "plus", { a, b -> a.plus(b) }, emptyBinaryFun), - binaryOperation(FLOAT, LONG, "plus", { a, b -> a.plus(b) }, emptyBinaryFun), - binaryOperation(FLOAT, SHORT, "plus", { a, b -> a.plus(b) }, emptyBinaryFun), - binaryOperation(FLOAT, BYTE, "div", { a, b -> a.div(b) }, emptyBinaryFun), - binaryOperation(FLOAT, DOUBLE, "div", { a, b -> a.div(b) }, emptyBinaryFun), - binaryOperation(FLOAT, FLOAT, "div", { a, b -> a.div(b) }, emptyBinaryFun), - binaryOperation(FLOAT, INT, "div", { a, b -> a.div(b) }, emptyBinaryFun), - binaryOperation(FLOAT, LONG, "div", { a, b -> a.div(b) }, emptyBinaryFun), - binaryOperation(FLOAT, SHORT, "div", { a, b -> a.div(b) }, emptyBinaryFun), - binaryOperation(FLOAT, BYTE, "rem", { a, b -> a.rem(b) }, emptyBinaryFun), - binaryOperation(FLOAT, DOUBLE, "rem", { a, b -> a.rem(b) }, emptyBinaryFun), - binaryOperation(FLOAT, FLOAT, "rem", { a, b -> a.rem(b) }, emptyBinaryFun), - binaryOperation(FLOAT, INT, "rem", { a, b -> a.rem(b) }, emptyBinaryFun), - binaryOperation(FLOAT, LONG, "rem", { a, b -> a.rem(b) }, emptyBinaryFun), - binaryOperation(FLOAT, SHORT, "rem", { a, b -> a.rem(b) }, emptyBinaryFun), - binaryOperation(FLOAT, BYTE, "times", { a, b -> a.times(b) }, emptyBinaryFun), - binaryOperation(FLOAT, DOUBLE, "times", { a, b -> a.times(b) }, emptyBinaryFun), - binaryOperation(FLOAT, FLOAT, "times", { a, b -> a.times(b) }, emptyBinaryFun), - binaryOperation(FLOAT, INT, "times", { a, b -> a.times(b) }, emptyBinaryFun), - binaryOperation(FLOAT, LONG, "times", { a, b -> a.times(b) }, emptyBinaryFun), - binaryOperation(FLOAT, SHORT, "times", { a, b -> a.times(b) }, emptyBinaryFun), - binaryOperation(FLOAT, ANY, "equals", { a, b -> a.equals(b) }, emptyBinaryFun), - binaryOperation(INT, BYTE, "compareTo", { a, b -> a.compareTo(b) }, emptyBinaryFun), - binaryOperation(INT, DOUBLE, "compareTo", { a, b -> a.compareTo(b) }, emptyBinaryFun), - binaryOperation(INT, FLOAT, "compareTo", { a, b -> a.compareTo(b) }, emptyBinaryFun), - binaryOperation(INT, INT, "compareTo", { a, b -> a.compareTo(b) }, emptyBinaryFun), - binaryOperation(INT, LONG, "compareTo", { a, b -> a.compareTo(b) }, emptyBinaryFun), - binaryOperation(INT, SHORT, "compareTo", { a, b -> a.compareTo(b) }, emptyBinaryFun), - binaryOperation(INT, BYTE, "plus", { a, b -> a.plus(b) }, { a, b -> a.add(b) }), - binaryOperation(INT, DOUBLE, "plus", { a, b -> a.plus(b) }, emptyBinaryFun), - binaryOperation(INT, FLOAT, "plus", { a, b -> a.plus(b) }, emptyBinaryFun), - binaryOperation(INT, INT, "plus", { a, b -> a.plus(b) }, { a, b -> a.add(b) }), - binaryOperation(INT, LONG, "plus", { a, b -> a.plus(b) }, { a, b -> a.add(b) }), - binaryOperation(INT, SHORT, "plus", { a, b -> a.plus(b) }, { a, b -> a.add(b) }), - binaryOperation(INT, INT, "shl", { a, b -> a.shl(b) }, emptyBinaryFun), - binaryOperation(INT, INT, "ushr", { a, b -> a.ushr(b) }, emptyBinaryFun), - binaryOperation(INT, BYTE, "div", { a, b -> a.div(b) }, { a, b -> a.divide(b) }), - binaryOperation(INT, DOUBLE, "div", { a, b -> a.div(b) }, emptyBinaryFun), - binaryOperation(INT, FLOAT, "div", { a, b -> a.div(b) }, emptyBinaryFun), - binaryOperation(INT, INT, "div", { a, b -> a.div(b) }, { a, b -> a.divide(b) }), - binaryOperation(INT, LONG, "div", { a, b -> a.div(b) }, { a, b -> a.divide(b) }), - binaryOperation(INT, SHORT, "div", { a, b -> a.div(b) }, { a, b -> a.divide(b) }), - binaryOperation(INT, INT, "shr", { a, b -> a.shr(b) }, emptyBinaryFun), - binaryOperation(INT, BYTE, "rem", { a, b -> a.rem(b) }, { a, b -> a.rem(b) }), - binaryOperation(INT, DOUBLE, "rem", { a, b -> a.rem(b) }, emptyBinaryFun), - binaryOperation(INT, FLOAT, "rem", { a, b -> a.rem(b) }, emptyBinaryFun), - binaryOperation(INT, INT, "rem", { a, b -> a.rem(b) }, { a, b -> a.rem(b) }), - binaryOperation(INT, LONG, "rem", { a, b -> a.rem(b) }, { a, b -> a.rem(b) }), - binaryOperation(INT, SHORT, "rem", { a, b -> a.rem(b) }, { a, b -> a.rem(b) }), - binaryOperation(INT, BYTE, "times", { a, b -> a.times(b) }, { a, b -> a.multiply(b) }), - binaryOperation(INT, DOUBLE, "times", { a, b -> a.times(b) }, emptyBinaryFun), - binaryOperation(INT, FLOAT, "times", { a, b -> a.times(b) }, emptyBinaryFun), - binaryOperation(INT, INT, "times", { a, b -> a.times(b) }, { a, b -> a.multiply(b) }), - binaryOperation(INT, LONG, "times", { a, b -> a.times(b) }, { a, b -> a.multiply(b) }), - binaryOperation(INT, SHORT, "times", { a, b -> a.times(b) }, { a, b -> a.multiply(b) }), - binaryOperation(INT, INT, "or", { a, b -> a.or(b) }, { a, b -> a.or(b) }), - binaryOperation(INT, BYTE, "minus", { a, b -> a.minus(b) }, { a, b -> a.subtract(b) }), - binaryOperation(INT, DOUBLE, "minus", { a, b -> a.minus(b) }, emptyBinaryFun), - binaryOperation(INT, FLOAT, "minus", { a, b -> a.minus(b) }, emptyBinaryFun), - binaryOperation(INT, INT, "minus", { a, b -> a.minus(b) }, { a, b -> a.subtract(b) }), - binaryOperation(INT, LONG, "minus", { a, b -> a.minus(b) }, { a, b -> a.subtract(b) }), - binaryOperation(INT, SHORT, "minus", { a, b -> a.minus(b) }, { a, b -> a.subtract(b) }), - binaryOperation(INT, INT, "and", { a, b -> a.and(b) }, { a, b -> a.and(b) }), - binaryOperation(INT, INT, "xor", { a, b -> a.xor(b) }, { a, b -> a.xor(b) }), - binaryOperation(INT, ANY, "equals", { a, b -> a.equals(b) }, emptyBinaryFun), - binaryOperation(LONG, BYTE, "compareTo", { a, b -> a.compareTo(b) }, emptyBinaryFun), - binaryOperation(LONG, DOUBLE, "compareTo", { a, b -> a.compareTo(b) }, emptyBinaryFun), - binaryOperation(LONG, FLOAT, "compareTo", { a, b -> a.compareTo(b) }, emptyBinaryFun), - binaryOperation(LONG, INT, "compareTo", { a, b -> a.compareTo(b) }, emptyBinaryFun), - binaryOperation(LONG, LONG, "compareTo", { a, b -> a.compareTo(b) }, emptyBinaryFun), - binaryOperation(LONG, SHORT, "compareTo", { a, b -> a.compareTo(b) }, emptyBinaryFun), - binaryOperation(LONG, BYTE, "plus", { a, b -> a.plus(b) }, { a, b -> a.add(b) }), - binaryOperation(LONG, DOUBLE, "plus", { a, b -> a.plus(b) }, emptyBinaryFun), - binaryOperation(LONG, FLOAT, "plus", { a, b -> a.plus(b) }, emptyBinaryFun), - binaryOperation(LONG, INT, "plus", { a, b -> a.plus(b) }, { a, b -> a.add(b) }), - binaryOperation(LONG, LONG, "plus", { a, b -> a.plus(b) }, { a, b -> a.add(b) }), - binaryOperation(LONG, SHORT, "plus", { a, b -> a.plus(b) }, { a, b -> a.add(b) }), - binaryOperation(LONG, INT, "shl", { a, b -> a.shl(b) }, emptyBinaryFun), - binaryOperation(LONG, INT, "ushr", { a, b -> a.ushr(b) }, emptyBinaryFun), - binaryOperation(LONG, BYTE, "div", { a, b -> a.div(b) }, { a, b -> a.divide(b) }), - binaryOperation(LONG, DOUBLE, "div", { a, b -> a.div(b) }, emptyBinaryFun), - binaryOperation(LONG, FLOAT, "div", { a, b -> a.div(b) }, emptyBinaryFun), - binaryOperation(LONG, INT, "div", { a, b -> a.div(b) }, { a, b -> a.divide(b) }), - binaryOperation(LONG, LONG, "div", { a, b -> a.div(b) }, { a, b -> a.divide(b) }), - binaryOperation(LONG, SHORT, "div", { a, b -> a.div(b) }, { a, b -> a.divide(b) }), - binaryOperation(LONG, INT, "shr", { a, b -> a.shr(b) }, emptyBinaryFun), - binaryOperation(LONG, BYTE, "rem", { a, b -> a.rem(b) }, { a, b -> a.rem(b) }), - binaryOperation(LONG, DOUBLE, "rem", { a, b -> a.rem(b) }, emptyBinaryFun), - binaryOperation(LONG, FLOAT, "rem", { a, b -> a.rem(b) }, emptyBinaryFun), - binaryOperation(LONG, INT, "rem", { a, b -> a.rem(b) }, { a, b -> a.rem(b) }), - binaryOperation(LONG, LONG, "rem", { a, b -> a.rem(b) }, { a, b -> a.rem(b) }), - binaryOperation(LONG, SHORT, "rem", { a, b -> a.rem(b) }, { a, b -> a.rem(b) }), - binaryOperation(LONG, BYTE, "times", { a, b -> a.times(b) }, { a, b -> a.multiply(b) }), - binaryOperation(LONG, DOUBLE, "times", { a, b -> a.times(b) }, emptyBinaryFun), - binaryOperation(LONG, FLOAT, "times", { a, b -> a.times(b) }, emptyBinaryFun), - binaryOperation(LONG, INT, "times", { a, b -> a.times(b) }, { a, b -> a.multiply(b) }), - binaryOperation(LONG, LONG, "times", { a, b -> a.times(b) }, { a, b -> a.multiply(b) }), - binaryOperation(LONG, SHORT, "times", { a, b -> a.times(b) }, { a, b -> a.multiply(b) }), - binaryOperation(LONG, LONG, "or", { a, b -> a.or(b) }, { a, b -> a.or(b) }), - binaryOperation(LONG, BYTE, "minus", { a, b -> a.minus(b) }, { a, b -> a.subtract(b) }), - binaryOperation(LONG, DOUBLE, "minus", { a, b -> a.minus(b) }, emptyBinaryFun), - binaryOperation(LONG, FLOAT, "minus", { a, b -> a.minus(b) }, emptyBinaryFun), - binaryOperation(LONG, INT, "minus", { a, b -> a.minus(b) }, { a, b -> a.subtract(b) }), - binaryOperation(LONG, LONG, "minus", { a, b -> a.minus(b) }, { a, b -> a.subtract(b) }), - binaryOperation(LONG, SHORT, "minus", { a, b -> a.minus(b) }, { a, b -> a.subtract(b) }), - binaryOperation(LONG, LONG, "and", { a, b -> a.and(b) }, { a, b -> a.and(b) }), - binaryOperation(LONG, LONG, "xor", { a, b -> a.xor(b) }, { a, b -> a.xor(b) }), - binaryOperation(LONG, ANY, "equals", { a, b -> a.equals(b) }, emptyBinaryFun), - binaryOperation(SHORT, BYTE, "minus", { a, b -> a.minus(b) }, { a, b -> a.subtract(b) }), - binaryOperation(SHORT, DOUBLE, "minus", { a, b -> a.minus(b) }, emptyBinaryFun), - binaryOperation(SHORT, FLOAT, "minus", { a, b -> a.minus(b) }, emptyBinaryFun), - binaryOperation(SHORT, INT, "minus", { a, b -> a.minus(b) }, { a, b -> a.subtract(b) }), - binaryOperation(SHORT, LONG, "minus", { a, b -> a.minus(b) }, { a, b -> a.subtract(b) }), - binaryOperation(SHORT, SHORT, "minus", { a, b -> a.minus(b) }, { a, b -> a.subtract(b) }), - binaryOperation(SHORT, BYTE, "compareTo", { a, b -> a.compareTo(b) }, emptyBinaryFun), - binaryOperation(SHORT, DOUBLE, "compareTo", { a, b -> a.compareTo(b) }, emptyBinaryFun), - binaryOperation(SHORT, FLOAT, "compareTo", { a, b -> a.compareTo(b) }, emptyBinaryFun), - binaryOperation(SHORT, INT, "compareTo", { a, b -> a.compareTo(b) }, emptyBinaryFun), - binaryOperation(SHORT, LONG, "compareTo", { a, b -> a.compareTo(b) }, emptyBinaryFun), - binaryOperation(SHORT, SHORT, "compareTo", { a, b -> a.compareTo(b) }, emptyBinaryFun), - binaryOperation(SHORT, BYTE, "plus", { a, b -> a.plus(b) }, { a, b -> a.add(b) }), - binaryOperation(SHORT, DOUBLE, "plus", { a, b -> a.plus(b) }, emptyBinaryFun), - binaryOperation(SHORT, FLOAT, "plus", { a, b -> a.plus(b) }, emptyBinaryFun), - binaryOperation(SHORT, INT, "plus", { a, b -> a.plus(b) }, { a, b -> a.add(b) }), - binaryOperation(SHORT, LONG, "plus", { a, b -> a.plus(b) }, { a, b -> a.add(b) }), - binaryOperation(SHORT, SHORT, "plus", { a, b -> a.plus(b) }, { a, b -> a.add(b) }), - binaryOperation(SHORT, BYTE, "div", { a, b -> a.div(b) }, { a, b -> a.divide(b) }), - binaryOperation(SHORT, DOUBLE, "div", { a, b -> a.div(b) }, emptyBinaryFun), - binaryOperation(SHORT, FLOAT, "div", { a, b -> a.div(b) }, emptyBinaryFun), - binaryOperation(SHORT, INT, "div", { a, b -> a.div(b) }, { a, b -> a.divide(b) }), - binaryOperation(SHORT, LONG, "div", { a, b -> a.div(b) }, { a, b -> a.divide(b) }), - binaryOperation(SHORT, SHORT, "div", { a, b -> a.div(b) }, { a, b -> a.divide(b) }), - binaryOperation(SHORT, BYTE, "rem", { a, b -> a.rem(b) }, { a, b -> a.rem(b) }), - binaryOperation(SHORT, DOUBLE, "rem", { a, b -> a.rem(b) }, emptyBinaryFun), - binaryOperation(SHORT, FLOAT, "rem", { a, b -> a.rem(b) }, emptyBinaryFun), - binaryOperation(SHORT, INT, "rem", { a, b -> a.rem(b) }, { a, b -> a.rem(b) }), - binaryOperation(SHORT, LONG, "rem", { a, b -> a.rem(b) }, { a, b -> a.rem(b) }), - binaryOperation(SHORT, SHORT, "rem", { a, b -> a.rem(b) }, { a, b -> a.rem(b) }), - binaryOperation(SHORT, BYTE, "times", { a, b -> a.times(b) }, { a, b -> a.multiply(b) }), - binaryOperation(SHORT, DOUBLE, "times", { a, b -> a.times(b) }, emptyBinaryFun), - binaryOperation(SHORT, FLOAT, "times", { a, b -> a.times(b) }, emptyBinaryFun), - binaryOperation(SHORT, INT, "times", { a, b -> a.times(b) }, { a, b -> a.multiply(b) }), - binaryOperation(SHORT, LONG, "times", { a, b -> a.times(b) }, { a, b -> a.multiply(b) }), - binaryOperation(SHORT, SHORT, "times", { a, b -> a.times(b) }, { a, b -> a.multiply(b) }), - binaryOperation(SHORT, ANY, "equals", { a, b -> a.equals(b) }, emptyBinaryFun), - binaryOperation(STRING, ANY, "plus", { a, b -> a.plus(b) }, emptyBinaryFun), - binaryOperation(STRING, INT, "get", { a, b -> a.get(b) }, emptyBinaryFun), - binaryOperation(STRING, ANY, "equals", { a, b -> a.equals(b) }, emptyBinaryFun), - binaryOperation(STRING, STRING, "compareTo", { a, b -> a.compareTo(b) }, emptyBinaryFun) -) - -//from library -class BigInteger(val value: String) { - fun add(o: BigInteger): BigInteger = o - fun divide(o: BigInteger): BigInteger = o - fun rem(o: BigInteger): BigInteger = o - fun multiply(o: BigInteger): BigInteger = o - fun subtract(o: BigInteger): BigInteger = o - fun or(o: BigInteger): BigInteger = o - fun and(o: BigInteger): BigInteger = o - fun xor(o: BigInteger): BigInteger = o -} diff --git a/compiler/testData/diagnostics/testsWithStdLib/functionLiterals/pseudocodeMemoryOverhead.kt b/compiler/testData/diagnostics/testsWithStdLib/functionLiterals/pseudocodeMemoryOverhead.kt index 689fab0b6ff..560003b73ff 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/functionLiterals/pseudocodeMemoryOverhead.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/functionLiterals/pseudocodeMemoryOverhead.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL import java.util.HashMap private fun unaryOperation( diff --git a/compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/p-2/pos/1.1.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/p-2/pos/1.1.fir.kt index 65a3877b202..a6cacdf2b94 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/p-2/pos/1.1.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/p-2/pos/1.1.fir.kt @@ -140,8 +140,8 @@ fun case_12(value_1: Int, value_2: Collection, value_3: Collection?) { when { value_1 == 1 -> value_2 as List value_1 == 2 -> value_2 as? List - value_1 == 3 -> value_3 as? MutableMap - value_1 == 4 -> (value_2 as? Map) as MutableMap + value_1 == 3 -> value_3 as? MutableMap + value_1 == 4 -> (value_2 as? Map) as MutableMap } } diff --git a/compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/p-5/pos/1.1.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/p-5/pos/1.1.fir.kt index 800e156eb4d..f399bcd7ed2 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/p-5/pos/1.1.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/p-5/pos/1.1.fir.kt @@ -143,8 +143,8 @@ fun case_12(value_1: Int, value_2: Collection, value_3: Collection?) { when (value_1) { 1 -> value_2 as List 2 -> value_2 as? List - 3 -> value_3 as? MutableMap - 4 -> (value_2 as? Map) as MutableMap + 3 -> value_3 as? MutableMap + 4 -> (value_2 as? Map) as MutableMap } } diff --git a/compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/p-6/pos/5.1.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/p-6/pos/5.1.fir.kt index 694ef40ed35..bbadedcf70f 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/p-6/pos/5.1.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/p-6/pos/5.1.fir.kt @@ -105,8 +105,8 @@ fun case_10(value_1: Collection, value_2: Collection, value_3: Collect when (value_1) { value_2 as List -> {} value_2 as? List -> {} - value_3 as? MutableMap -> {} - (value_2 as? Map) as MutableMap -> {} + value_3 as? MutableMap -> {} + (value_2 as? Map) as MutableMap -> {} } } diff --git a/compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/p-6/pos/5.2.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/p-6/pos/5.2.fir.kt index 96026587a6e..db522d9ec8b 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/p-6/pos/5.2.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/p-6/pos/5.2.fir.kt @@ -81,7 +81,7 @@ fun case_9(value_1: Any) { fun case_10(value_1: Collection, value_2: Collection, value_3: Collection?) { when (value_1) { value_2 as List, value_2 as? List -> {} - value_3 as? MutableMap, (value_2 as? Map) as MutableMap -> {} + value_3 as? MutableMap, (value_2 as? Map) as MutableMap -> {} } } diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/9.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/9.fir.kt index 6e518b89218..52d4a1dabef 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/9.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/9.fir.kt @@ -4,8 +4,8 @@ // TESTCASE NUMBER: 1 fun case_1(x: T?, y: K?) { - x as T - y as K + x as T + y as K val z = x ?: y x.equals(10) diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/24.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/24.fir.kt index b01f2236ef5..9b9fe2e4215 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/24.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/24.fir.kt @@ -4,7 +4,7 @@ // TESTCASE NUMBER: 1 fun case_1(x: Any?) where T: CharSequence { - x as T + x as T class Case1 where K : T { inline fun case_1() { if (x is T) { diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/25.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/25.fir.kt index d43aeb5a12a..4c2ecd3ba1c 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/25.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/25.fir.kt @@ -10,9 +10,9 @@ open class Case1 { open inner class Case1_1: Case1() where L : CharSequence { inner class Case1_2: Case1.Case1_1<M>() where M : Map { inline fun case_1(x: Any?) { - x as M - x as L - x as K + x as M + x as L + x as K if (x is T) { x x.toByte() diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/26.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/26.fir.kt index d43aeb5a12a..4c2ecd3ba1c 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/26.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/26.fir.kt @@ -10,9 +10,9 @@ open class Case1 { open inner class Case1_1: Case1() where L : CharSequence { inner class Case1_2: Case1.Case1_1<M>() where M : Map { inline fun case_1(x: Any?) { - x as M - x as L - x as K + x as M + x as L + x as K if (x is T) { x x.toByte() diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/27.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/27.fir.kt index d43aeb5a12a..4c2ecd3ba1c 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/27.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/27.fir.kt @@ -10,9 +10,9 @@ open class Case1 { open inner class Case1_1: Case1() where L : CharSequence { inner class Case1_2: Case1.Case1_1<M>() where M : Map { inline fun case_1(x: Any?) { - x as M - x as L - x as K + x as M + x as L + x as K if (x is T) { x x.toByte() diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/50.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/50.fir.kt index d7a2dde3c16..aaaaf891562 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/50.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/50.fir.kt @@ -85,7 +85,7 @@ fun Inv.case_7() { // TESTCASE NUMBER: 8 fun T.case_8() { - this as MutableList + this as MutableList ")!>this::equals this.equals(10) ")!>::equals diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/72.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/72.fir.kt index a0db9d3fed5..f774d904393 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/72.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/72.fir.kt @@ -9,7 +9,7 @@ */ fun case_1() { val list = mutableListOf() - val ints = list as MutableList + val ints = list as MutableList val strs = list as MutableList strs.add("two") & kotlin.collections.MutableList & kotlin.collections.MutableList")!>list