From e39af4583eb4324b5497e2021fb47c2273f8a114 Mon Sep 17 00:00:00 2001 From: Kirill Rakhman Date: Tue, 13 Feb 2024 18:07:46 +0100 Subject: [PATCH] [FIR] Report deprecation on synthetic property calls on super receivers #KT-65438 Fixed --- .../kotlin/fir/resolve/calls/Synthetics.kt | 7 +++- .../fir/resolve/calls/ResolutionStages.kt | 7 ++-- .../fir/resolve/calls/tower/TowerLevels.kt | 6 ++- .../testsWithJava21/newListMethods.diag.txt | 38 +++++++++++-------- .../newListMethods.fir.diag.txt | 36 ++++++++++-------- .../testsWithJava21/newListMethods.fir.kt | 5 +++ .../tests/testsWithJava21/newListMethods.kt | 5 +++ 7 files changed, 64 insertions(+), 40 deletions(-) diff --git a/compiler/fir/providers/src/org/jetbrains/kotlin/fir/resolve/calls/Synthetics.kt b/compiler/fir/providers/src/org/jetbrains/kotlin/fir/resolve/calls/Synthetics.kt index df79ac8646b..28aae1566fe 100644 --- a/compiler/fir/providers/src/org/jetbrains/kotlin/fir/resolve/calls/Synthetics.kt +++ b/compiler/fir/providers/src/org/jetbrains/kotlin/fir/resolve/calls/Synthetics.kt @@ -46,6 +46,7 @@ class FirSyntheticPropertiesScope private constructor( private val dispatchReceiverType: ConeKotlinType, private val syntheticNamesProvider: FirSyntheticNamesProvider, private val returnTypeCalculator: ReturnTypeCalculator?, + private val isSuperCall: Boolean, ) : FirContainingNamesAwareScope() { companion object { fun createIfSyntheticNamesProviderIsDefined( @@ -53,6 +54,7 @@ class FirSyntheticPropertiesScope private constructor( dispatchReceiverType: ConeKotlinType, baseScope: FirTypeScope, returnTypeCalculator: ReturnTypeCalculator? = null, + isSuperCall: Boolean = false, ): FirSyntheticPropertiesScope? { val syntheticNamesProvider = session.syntheticNamesProvider ?: return null return FirSyntheticPropertiesScope( @@ -61,6 +63,7 @@ class FirSyntheticPropertiesScope private constructor( dispatchReceiverType, syntheticNamesProvider, returnTypeCalculator, + isSuperCall, ) } } @@ -229,7 +232,7 @@ class FirSyntheticPropertiesScope private constructor( baseScope.processDirectOverriddenFunctionsWithBaseScope(symbolToStart) l@{ symbol, scope -> if (hasMatchingSetter) return@l ProcessorAction.STOP val baseDispatchReceiverType = symbol.dispatchReceiverType ?: return@l ProcessorAction.NEXT - val syntheticScope = FirSyntheticPropertiesScope(session, scope, baseDispatchReceiverType, syntheticNamesProvider, returnTypeCalculator) + val syntheticScope = FirSyntheticPropertiesScope(session, scope, baseDispatchReceiverType, syntheticNamesProvider, returnTypeCalculator, isSuperCall) val baseProperties = syntheticScope.getProperties(propertyName) val propertyFound = baseProperties.any { val baseProperty = it.fir @@ -272,7 +275,7 @@ class FirSyntheticPropertiesScope private constructor( val visited = mutableSetOf>() fun checkJavaOrigin(symbol: FirNamedFunctionSymbol, scope: FirTypeScope, isOverridden: Boolean) { - val hidden = symbol.hiddenStatusOfCall(isSuperCall = false, isCallToOverride = isOverridden) + val hidden = symbol.hiddenStatusOfCall(isSuperCall = isSuperCall, isCallToOverride = isOverridden) when (hidden) { CallToPotentiallyHiddenSymbolResult.Hidden -> isHiddenEverywhereBesideSuperCalls = true CallToPotentiallyHiddenSymbolResult.VisibleWithDeprecation -> isDeprecatedOverrideOfHidden = true diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/calls/ResolutionStages.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/calls/ResolutionStages.kt index e0b1e5cba04..1df518a25d2 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/calls/ResolutionStages.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/calls/ResolutionStages.kt @@ -802,12 +802,11 @@ internal object CheckHiddenDeclaration : ResolutionStage() { return hidden } - - private fun FirElement.isSuperCall(session: FirSession): Boolean = - this is FirQualifiedAccessExpression && explicitReceiver?.toReference(session) is FirSuperReference - } +internal fun FirElement.isSuperCall(session: FirSession): Boolean = + this is FirQualifiedAccessExpression && explicitReceiver?.toReference(session) is FirSuperReference + private val DYNAMIC_EXTENSION_ANNOTATION_CLASS_ID: ClassId = ClassId.topLevel(DYNAMIC_EXTENSION_FQ_NAME) internal object ProcessDynamicExtensionAnnotation : ResolutionStage() { diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/calls/tower/TowerLevels.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/calls/tower/TowerLevels.kt index 7b36f5c9fa5..f2e84293b5d 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/calls/tower/TowerLevels.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/calls/tower/TowerLevels.kt @@ -81,6 +81,7 @@ class MemberScopeTowerLevel( private val session: FirSession get() = bodyResolveComponents.session private fun > processMembers( + info: CallInfo, output: TowerScopeLevelProcessor, processScopeMembers: FirScope.(processor: (T) -> Unit) -> Unit ): ProcessResult { @@ -165,6 +166,7 @@ class MemberScopeTowerLevel( typeForSyntheticScope, useSiteForSyntheticScope, bodyResolveComponents.returnTypeCalculator, + isSuperCall = info.callSite.isSuperCall(session), ) withSynthetic?.processScopeMembers { symbol -> @@ -274,7 +276,7 @@ class MemberScopeTowerLevel( processor: TowerScopeLevelProcessor> ): ProcessResult { val lookupTracker = session.lookupTracker - return processMembers(processor) { consumer -> + return processMembers(info, processor) { consumer -> withMemberCallLookup(lookupTracker, info) { lookupCtx -> this.processFunctionsAndConstructorsByName( info, session, bodyResolveComponents, @@ -294,7 +296,7 @@ class MemberScopeTowerLevel( processor: TowerScopeLevelProcessor> ): ProcessResult { val lookupTracker = session.lookupTracker - return processMembers(processor) { consumer -> + return processMembers(info, processor) { consumer -> withMemberCallLookup(lookupTracker, info) { lookupCtx -> lookupTracker?.recordCallLookup(info, dispatchReceiverValue.type) this.processPropertiesByName(info.name) { diff --git a/compiler/testData/diagnostics/tests/testsWithJava21/newListMethods.diag.txt b/compiler/testData/diagnostics/tests/testsWithJava21/newListMethods.diag.txt index 29066f282ec..d4c99d6a917 100644 --- a/compiler/testData/diagnostics/tests/testsWithJava21/newListMethods.diag.txt +++ b/compiler/testData/diagnostics/tests/testsWithJava21/newListMethods.diag.txt @@ -1,49 +1,55 @@ -/newListMethods.kt:13:18: warning: this declaration overrides deprecated member but not marked as deprecated itself. Please add @Deprecated annotation or suppress. See https://youtrack.jetbrains.com/issue/KT-47902 for details +/newListMethods.kt:15:18: warning: this declaration overrides deprecated member but not marked as deprecated itself. Please add @Deprecated annotation or suppress. See https://youtrack.jetbrains.com/issue/KT-47902 for details override fun getFirst(): T = super.getFirst() ^^^^^^^^ -/newListMethods.kt:13:40: warning: 'getFirst(): E!' is deprecated. Overrides deprecated member in 'java.util.AbstractList'. 'getFirst()' member of List is redundant in Kotlin and might be removed soon. Please use 'first()' stdlib extension instead +/newListMethods.kt:15:40: warning: 'getFirst(): E!' is deprecated. Overrides deprecated member in 'java.util.AbstractList'. 'getFirst()' member of List is redundant in Kotlin and might be removed soon. Please use 'first()' stdlib extension instead override fun getFirst(): T = super.getFirst() ^^^^^^^^ -/newListMethods.kt:14:18: warning: this declaration overrides deprecated member but not marked as deprecated itself. Please add @Deprecated annotation or suppress. See https://youtrack.jetbrains.com/issue/KT-47902 for details +/newListMethods.kt:16:18: warning: this declaration overrides deprecated member but not marked as deprecated itself. Please add @Deprecated annotation or suppress. See https://youtrack.jetbrains.com/issue/KT-47902 for details override fun getLast(): T = super.getLast() ^^^^^^^ -/newListMethods.kt:14:39: warning: 'getLast(): E!' is deprecated. Overrides deprecated member in 'java.util.AbstractList'. 'getLast()' member of List is redundant in Kotlin and might be removed soon. Please use 'last()' stdlib extension instead +/newListMethods.kt:16:39: warning: 'getLast(): E!' is deprecated. Overrides deprecated member in 'java.util.AbstractList'. 'getLast()' member of List is redundant in Kotlin and might be removed soon. Please use 'last()' stdlib extension instead override fun getLast(): T = super.getLast() ^^^^^^^ -/newListMethods.kt:25:7: warning: 'getFirst(): E!' is deprecated. 'getFirst()' member of List is redundant in Kotlin and might be removed soon. Please use 'first()' stdlib extension instead +/newListMethods.kt:18:34: warning: 'getFirst(): E!' is deprecated. Overrides deprecated member in 'java.util.AbstractList'. 'getFirst()' member of List is redundant in Kotlin and might be removed soon. Please use 'first()' stdlib extension instead + fun superFirst2(): T = super.first + ^^^^^ +/newListMethods.kt:19:33: warning: 'getLast(): E!' is deprecated. Overrides deprecated member in 'java.util.AbstractList'. 'getLast()' member of List is redundant in Kotlin and might be removed soon. Please use 'last()' stdlib extension instead + fun superLast2(): T = super.last + ^^^^ +/newListMethods.kt:30:7: warning: 'getFirst(): E!' is deprecated. 'getFirst()' member of List is redundant in Kotlin and might be removed soon. Please use 'first()' stdlib extension instead x.getFirst() ^^^^^^^^ -/newListMethods.kt:26:7: warning: 'getter for first: E!' is deprecated. 'getFirst()' member of List is redundant in Kotlin and might be removed soon. Please use 'first()' stdlib extension instead +/newListMethods.kt:31:7: warning: 'getter for first: E!' is deprecated. 'getFirst()' member of List is redundant in Kotlin and might be removed soon. Please use 'first()' stdlib extension instead x.first // synthetic property for getFirst() ^^^^^ -/newListMethods.kt:28:7: warning: 'getLast(): E!' is deprecated. 'getLast()' member of List is redundant in Kotlin and might be removed soon. Please use 'last()' stdlib extension instead +/newListMethods.kt:33:7: warning: 'getLast(): E!' is deprecated. 'getLast()' member of List is redundant in Kotlin and might be removed soon. Please use 'last()' stdlib extension instead x.getLast() ^^^^^^^ -/newListMethods.kt:29:7: warning: 'getter for last: E!' is deprecated. 'getLast()' member of List is redundant in Kotlin and might be removed soon. Please use 'last()' stdlib extension instead +/newListMethods.kt:34:7: warning: 'getter for last: E!' is deprecated. 'getLast()' member of List is redundant in Kotlin and might be removed soon. Please use 'last()' stdlib extension instead x.last ^^^^ -/newListMethods.kt:37:7: warning: 'getFirst(): E!' is deprecated. Overrides deprecated member in 'java.util.AbstractList'. 'getFirst()' member of List is redundant in Kotlin and might be removed soon. Please use 'first()' stdlib extension instead +/newListMethods.kt:42:7: warning: 'getFirst(): E!' is deprecated. Overrides deprecated member in 'java.util.AbstractList'. 'getFirst()' member of List is redundant in Kotlin and might be removed soon. Please use 'first()' stdlib extension instead y.getFirst() ^^^^^^^^ -/newListMethods.kt:38:7: warning: 'getFirst(): E!' is deprecated. Overrides deprecated member in 'java.util.AbstractList'. 'getFirst()' member of List is redundant in Kotlin and might be removed soon. Please use 'first()' stdlib extension instead +/newListMethods.kt:43:7: warning: 'getFirst(): E!' is deprecated. Overrides deprecated member in 'java.util.AbstractList'. 'getFirst()' member of List is redundant in Kotlin and might be removed soon. Please use 'first()' stdlib extension instead y.first ^^^^^ -/newListMethods.kt:40:7: warning: 'getLast(): E!' is deprecated. Overrides deprecated member in 'java.util.AbstractList'. 'getLast()' member of List is redundant in Kotlin and might be removed soon. Please use 'last()' stdlib extension instead +/newListMethods.kt:45:7: warning: 'getLast(): E!' is deprecated. Overrides deprecated member in 'java.util.AbstractList'. 'getLast()' member of List is redundant in Kotlin and might be removed soon. Please use 'last()' stdlib extension instead y.getLast() ^^^^^^^ -/newListMethods.kt:41:7: warning: 'getLast(): E!' is deprecated. Overrides deprecated member in 'java.util.AbstractList'. 'getLast()' member of List is redundant in Kotlin and might be removed soon. Please use 'last()' stdlib extension instead +/newListMethods.kt:46:7: warning: 'getLast(): E!' is deprecated. Overrides deprecated member in 'java.util.AbstractList'. 'getLast()' member of List is redundant in Kotlin and might be removed soon. Please use 'last()' stdlib extension instead y.last ^^^^ -/newListMethods.kt:49:7: warning: 'getFirst(): E!' is deprecated. Overrides deprecated member in 'java.util.AbstractList'. 'getFirst()' member of List is redundant in Kotlin and might be removed soon. Please use 'first()' stdlib extension instead +/newListMethods.kt:54:7: warning: 'getFirst(): E!' is deprecated. Overrides deprecated member in 'java.util.AbstractList'. 'getFirst()' member of List is redundant in Kotlin and might be removed soon. Please use 'first()' stdlib extension instead z.getFirst() ^^^^^^^^ -/newListMethods.kt:50:7: warning: 'getFirst(): E!' is deprecated. Overrides deprecated member in 'java.util.AbstractList'. 'getFirst()' member of List is redundant in Kotlin and might be removed soon. Please use 'first()' stdlib extension instead +/newListMethods.kt:55:7: warning: 'getFirst(): E!' is deprecated. Overrides deprecated member in 'java.util.AbstractList'. 'getFirst()' member of List is redundant in Kotlin and might be removed soon. Please use 'first()' stdlib extension instead z.first ^^^^^ -/newListMethods.kt:52:7: warning: 'getLast(): E!' is deprecated. Overrides deprecated member in 'java.util.AbstractList'. 'getLast()' member of List is redundant in Kotlin and might be removed soon. Please use 'last()' stdlib extension instead +/newListMethods.kt:57:7: warning: 'getLast(): E!' is deprecated. Overrides deprecated member in 'java.util.AbstractList'. 'getLast()' member of List is redundant in Kotlin and might be removed soon. Please use 'last()' stdlib extension instead z.getLast() ^^^^^^^ -/newListMethods.kt:53:7: warning: 'getLast(): E!' is deprecated. Overrides deprecated member in 'java.util.AbstractList'. 'getLast()' member of List is redundant in Kotlin and might be removed soon. Please use 'last()' stdlib extension instead +/newListMethods.kt:58:7: warning: 'getLast(): E!' is deprecated. Overrides deprecated member in 'java.util.AbstractList'. 'getLast()' member of List is redundant in Kotlin and might be removed soon. Please use 'last()' stdlib extension instead z.last ^^^^ diff --git a/compiler/testData/diagnostics/tests/testsWithJava21/newListMethods.fir.diag.txt b/compiler/testData/diagnostics/tests/testsWithJava21/newListMethods.fir.diag.txt index db91fb1a339..e6a34ffd2a0 100644 --- a/compiler/testData/diagnostics/tests/testsWithJava21/newListMethods.fir.diag.txt +++ b/compiler/testData/diagnostics/tests/testsWithJava21/newListMethods.fir.diag.txt @@ -1,31 +1,35 @@ -/newListMethods.fir.kt:(231,239): warning: This declaration overrides a deprecated member but is not marked as deprecated itself. Please add the '@Deprecated' annotation or suppress the diagnostic. +/newListMethods.fir.kt:(337,345): warning: This declaration overrides a deprecated member but is not marked as deprecated itself. Please add the '@Deprecated' annotation or suppress the diagnostic. -/newListMethods.fir.kt:(253,261): warning: 'fun getFirst(): T!' is deprecated. This declaration will be renamed in a future version of Kotlin. Please consider using the 'first()' stdlib extension if the collection supports fast random access. +/newListMethods.fir.kt:(359,367): warning: 'fun getFirst(): T!' is deprecated. This declaration will be renamed in a future version of Kotlin. Please consider using the 'first()' stdlib extension if the collection supports fast random access. -/newListMethods.fir.kt:(281,288): warning: This declaration overrides a deprecated member but is not marked as deprecated itself. Please add the '@Deprecated' annotation or suppress the diagnostic. +/newListMethods.fir.kt:(387,394): warning: This declaration overrides a deprecated member but is not marked as deprecated itself. Please add the '@Deprecated' annotation or suppress the diagnostic. -/newListMethods.fir.kt:(302,309): warning: 'fun getLast(): T!' is deprecated. This declaration will be renamed in a future version of Kotlin. Please consider using the 'last()' stdlib extension if the collection supports fast random access. +/newListMethods.fir.kt:(408,415): warning: 'fun getLast(): T!' is deprecated. This declaration will be renamed in a future version of Kotlin. Please consider using the 'last()' stdlib extension if the collection supports fast random access. -/newListMethods.fir.kt:(596,604): error: Unresolved reference 'getFirst'. +/newListMethods.fir.kt:(452,457): warning: 'val first: T!' is deprecated. This declaration will be renamed in a future version of Kotlin. Please consider using the 'first()' stdlib extension if the collection supports fast random access. -/newListMethods.fir.kt:(613,618): error: Function invocation 'first()' expected. +/newListMethods.fir.kt:(490,494): warning: 'val last: T!' is deprecated. This declaration will be renamed in a future version of Kotlin. Please consider using the 'last()' stdlib extension if the collection supports fast random access. -/newListMethods.fir.kt:(704,711): error: Unresolved reference 'getLast'. +/newListMethods.fir.kt:(779,787): error: Unresolved reference 'getFirst'. -/newListMethods.fir.kt:(720,724): error: Function invocation 'last()' expected. +/newListMethods.fir.kt:(796,801): error: Function invocation 'first()' expected. -/newListMethods.fir.kt:(838,846): warning: 'fun getFirst(): String!' is deprecated. This declaration will be renamed in a future version of Kotlin. Please consider using the 'first()' stdlib extension if the collection supports fast random access. +/newListMethods.fir.kt:(887,894): error: Unresolved reference 'getLast'. -/newListMethods.fir.kt:(855,860): warning: 'val first: String!' is deprecated. This declaration will be renamed in a future version of Kotlin. Please consider using the 'first()' stdlib extension if the collection supports fast random access. +/newListMethods.fir.kt:(903,907): error: Function invocation 'last()' expected. -/newListMethods.fir.kt:(881,888): warning: 'fun getLast(): String!' is deprecated. This declaration will be renamed in a future version of Kotlin. Please consider using the 'last()' stdlib extension if the collection supports fast random access. +/newListMethods.fir.kt:(1021,1029): warning: 'fun getFirst(): String!' is deprecated. This declaration will be renamed in a future version of Kotlin. Please consider using the 'first()' stdlib extension if the collection supports fast random access. -/newListMethods.fir.kt:(897,901): warning: 'val last: String!' is deprecated. This declaration will be renamed in a future version of Kotlin. Please consider using the 'last()' stdlib extension if the collection supports fast random access. +/newListMethods.fir.kt:(1038,1043): warning: 'val first: String!' is deprecated. This declaration will be renamed in a future version of Kotlin. Please consider using the 'first()' stdlib extension if the collection supports fast random access. -/newListMethods.fir.kt:(1015,1023): warning: 'fun getFirst(): String' is deprecated. This declaration will be renamed in a future version of Kotlin. Please consider using the 'first()' stdlib extension if the collection supports fast random access. +/newListMethods.fir.kt:(1064,1071): warning: 'fun getLast(): String!' is deprecated. This declaration will be renamed in a future version of Kotlin. Please consider using the 'last()' stdlib extension if the collection supports fast random access. -/newListMethods.fir.kt:(1032,1037): warning: 'val first: String' is deprecated. This declaration will be renamed in a future version of Kotlin. Please consider using the 'first()' stdlib extension if the collection supports fast random access. +/newListMethods.fir.kt:(1080,1084): warning: 'val last: String!' is deprecated. This declaration will be renamed in a future version of Kotlin. Please consider using the 'last()' stdlib extension if the collection supports fast random access. -/newListMethods.fir.kt:(1058,1065): warning: 'fun getLast(): String' is deprecated. This declaration will be renamed in a future version of Kotlin. Please consider using the 'last()' stdlib extension if the collection supports fast random access. +/newListMethods.fir.kt:(1198,1206): warning: 'fun getFirst(): String' is deprecated. This declaration will be renamed in a future version of Kotlin. Please consider using the 'first()' stdlib extension if the collection supports fast random access. -/newListMethods.fir.kt:(1074,1078): warning: 'val last: String' is deprecated. This declaration will be renamed in a future version of Kotlin. Please consider using the 'last()' stdlib extension if the collection supports fast random access. +/newListMethods.fir.kt:(1215,1220): warning: 'val first: String' is deprecated. This declaration will be renamed in a future version of Kotlin. Please consider using the 'first()' stdlib extension if the collection supports fast random access. + +/newListMethods.fir.kt:(1241,1248): warning: 'fun getLast(): String' is deprecated. This declaration will be renamed in a future version of Kotlin. Please consider using the 'last()' stdlib extension if the collection supports fast random access. + +/newListMethods.fir.kt:(1257,1261): warning: 'val last: String' is deprecated. This declaration will be renamed in a future version of Kotlin. Please consider using the 'last()' stdlib extension if the collection supports fast random access. diff --git a/compiler/testData/diagnostics/tests/testsWithJava21/newListMethods.fir.kt b/compiler/testData/diagnostics/tests/testsWithJava21/newListMethods.fir.kt index e4106a05399..9278ea545bc 100644 --- a/compiler/testData/diagnostics/tests/testsWithJava21/newListMethods.fir.kt +++ b/compiler/testData/diagnostics/tests/testsWithJava21/newListMethods.fir.kt @@ -1,5 +1,7 @@ // ISSUE: KT-58371 // RENDER_DIAGNOSTICS_FULL_TEXT +// DIAGNOSTICS: -SUPER_CANT_BE_EXTENSION_RECEIVER +// ^Otherwise only K1 errors are written to .diag file. class A : ArrayList() { override fun addFirst(t: T) { @@ -13,6 +15,9 @@ class A : ArrayList() { override fun getFirst(): T = super.getFirst() override fun getLast(): T = super.getLast() + fun superFirst2(): T = super.first + fun superLast2(): T = super.last + override fun removeFirst(): T = super.removeFirst() override fun removeLast(): T = super.removeLast() diff --git a/compiler/testData/diagnostics/tests/testsWithJava21/newListMethods.kt b/compiler/testData/diagnostics/tests/testsWithJava21/newListMethods.kt index ddacc375494..decd9f2d7ff 100644 --- a/compiler/testData/diagnostics/tests/testsWithJava21/newListMethods.kt +++ b/compiler/testData/diagnostics/tests/testsWithJava21/newListMethods.kt @@ -1,5 +1,7 @@ // ISSUE: KT-58371 // RENDER_DIAGNOSTICS_FULL_TEXT +// DIAGNOSTICS: -SUPER_CANT_BE_EXTENSION_RECEIVER +// ^Otherwise only K1 errors are written to .diag file. class A : ArrayList() { override fun addFirst(t: T) { @@ -13,6 +15,9 @@ class A : ArrayList() { override fun getFirst(): T = super.getFirst() override fun getLast(): T = super.getLast() + fun superFirst2(): T = super.first + fun superLast2(): T = super.last + override fun removeFirst(): T = super.removeFirst() override fun removeLast(): T = super.removeLast()