Skip to content

Commit

Permalink
[FE 1.0] Don't report OVERRIDE_DEPRECATION on default accessors of de…
Browse files Browse the repository at this point in the history
…precated properties

^KT-51893 Fixed
  • Loading branch information
demiurg906 authored and Space committed Apr 18, 2022
1 parent a3ed332 commit 5584a50
Show file tree
Hide file tree
Showing 7 changed files with 100 additions and 0 deletions.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Expand Up @@ -7,13 +7,18 @@ package org.jetbrains.kotlin.resolve.checkers

import org.jetbrains.kotlin.config.LanguageFeature.StopPropagatingDeprecationThroughOverrides
import org.jetbrains.kotlin.descriptors.DeclarationDescriptor
import org.jetbrains.kotlin.descriptors.PropertyAccessorDescriptor
import org.jetbrains.kotlin.diagnostics.Errors
import org.jetbrains.kotlin.psi.KtDeclaration
import org.jetbrains.kotlin.psi.KtNamedDeclaration
import org.jetbrains.kotlin.psi.KtProperty

object DeprecationInheritanceChecker : DeclarationChecker {
override fun check(declaration: KtDeclaration, descriptor: DeclarationDescriptor, context: DeclarationCheckerContext) {
if (declaration !is KtNamedDeclaration) return
if (declaration is KtProperty && descriptor is PropertyAccessorDescriptor && descriptor.isDefault) {
return
}
val deprecationResolver = context.deprecationResolver
if (!deprecationResolver.areDeprecationsInheritedFromOverriden(descriptor)) return
val (deprecations, message) = if (context.languageVersionSettings.supportsFeature(StopPropagatingDeprecationThroughOverrides)) {
Expand Down
@@ -0,0 +1,45 @@
// FIR_IDENTICAL
// ISSUE: KT-51893

interface A {
@Deprecated("")
val a: String

@Deprecated("")
val b: String

@Deprecated("")
var c: String

@Deprecated("")
var d: String

@Deprecated("")
var e: String

@Deprecated("")
var h: String
}

object B : A {
override val <!OVERRIDE_DEPRECATION!>a<!>: String = ""

override val <!OVERRIDE_DEPRECATION!>b<!>: String
get() = ""

override var <!OVERRIDE_DEPRECATION!>c<!>: String = ""

override var <!OVERRIDE_DEPRECATION!>d<!>: String = ""
get() = field

override var <!OVERRIDE_DEPRECATION!>e<!>: String = ""
set(value) {
field = value
}

override var <!OVERRIDE_DEPRECATION!>h<!>: String = ""
get() = field
set(value) {
field = value
}
}
@@ -0,0 +1,26 @@
package

public interface A {
@kotlin.Deprecated(message = "") public abstract val a: kotlin.String
@kotlin.Deprecated(message = "") public abstract val b: kotlin.String
@kotlin.Deprecated(message = "") public abstract var c: kotlin.String
@kotlin.Deprecated(message = "") public abstract var d: kotlin.String
@kotlin.Deprecated(message = "") public abstract var e: kotlin.String
@kotlin.Deprecated(message = "") public abstract var h: kotlin.String
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}

public object B : A {
private constructor B()
public open override /*1*/ val a: kotlin.String = ""
public open override /*1*/ val b: kotlin.String
public open override /*1*/ var c: kotlin.String
public open override /*1*/ var d: kotlin.String
public open override /*1*/ var e: kotlin.String
public open override /*1*/ var h: kotlin.String
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 5584a50

Please sign in to comment.