Skip to content

Commit

Permalink
Fix 1.0-compatibility mode for JDK dependendent built-ins
Browse files Browse the repository at this point in the history
Do not report UNSUPPORTED_FEATURE if there is no overridden descriptors
E.g. in case of property accessors
  • Loading branch information
dzharkov committed Jan 19, 2017
1 parent 160d5e7 commit 89893d2
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@ object AdditionalBuiltInsMemberOverrideDeclarationChecker : DeclarationChecker {
val resultingDescriptor = descriptor as? CallableMemberDescriptor ?: return
val overrideKeyword = declaration.modifierList?.getModifier(KtTokens.OVERRIDE_KEYWORD) ?: return

if (resultingDescriptor.original.overriddenDescriptors.all { it.isAdditionalBuiltInMember() }) {
val overriddenDescriptors = resultingDescriptor.original.overriddenDescriptors
if (overriddenDescriptors.isNotEmpty() && overriddenDescriptors.all { it.isAdditionalBuiltInMember() }) {
diagnosticHolder.report(Errors.UNSUPPORTED_FEATURE.on(overrideKeyword, LanguageFeature.AdditionalBuiltInsMembers))
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,14 @@ fun foo(x: List<String>, y: Throwable) {
// Falls back to extension in stdlib
y.printStackTrace()
}

interface X {
fun foo(): Int = 1
val hidden: Boolean
}

class Y : X {
// There should not be UNSUPPORTED_FEATURE diagnostic
override fun foo() = 1
override var hidden: Boolean = true
}

0 comments on commit 89893d2

Please sign in to comment.