INVISIBLE_MEMBER_FROM_INLINE renamed to NON_PUBLIC_CALL_FROM_PUBLIC_INLINE

This commit is contained in:
Michael Bogdanov
2016-02-02 14:36:35 +03:00
parent d1db404959
commit 4b203de608
18 changed files with 86 additions and 87 deletions
@@ -772,7 +772,7 @@ public interface Errors {
DiagnosticFactory0<KtClass> NESTED_CLASS_NOT_ALLOWED = DiagnosticFactory0.create(ERROR, DECLARATION_NAME);
//Inline and inlinable parameters
DiagnosticFactory2<KtElement, DeclarationDescriptor, DeclarationDescriptor> INVISIBLE_MEMBER_FROM_INLINE = DiagnosticFactory2.create(ERROR, CALL_ELEMENT);
DiagnosticFactory2<KtElement, DeclarationDescriptor, DeclarationDescriptor> NON_PUBLIC_CALL_FROM_PUBLIC_INLINE = DiagnosticFactory2.create(ERROR, CALL_ELEMENT);
DiagnosticFactory2<KtElement, DeclarationDescriptor, DeclarationDescriptor> PRIVATE_CLASS_MEMBER_FROM_INLINE = DiagnosticFactory2.create(ERROR, CALL_ELEMENT);
DiagnosticFactory1<KtElement, KtElement> NON_LOCAL_RETURN_NOT_ALLOWED = DiagnosticFactory1.create(ERROR, CALL_ELEMENT);
DiagnosticFactory2<KtElement, KtNamedDeclaration, DeclarationDescriptor> NOT_YET_SUPPORTED_IN_INLINE = DiagnosticFactory2.create(ERROR);
@@ -789,7 +789,7 @@ public interface Errors {
ImmutableSet<? extends DiagnosticFactory<?>> UNRESOLVED_REFERENCE_DIAGNOSTICS = ImmutableSet.of(
UNRESOLVED_REFERENCE, NAMED_PARAMETER_NOT_FOUND, UNRESOLVED_REFERENCE_WRONG_RECEIVER);
ImmutableSet<? extends DiagnosticFactory<?>> INVISIBLE_REFERENCE_DIAGNOSTICS = ImmutableSet.of(
INVISIBLE_MEMBER, INVISIBLE_MEMBER_FROM_INLINE, INVISIBLE_REFERENCE, INVISIBLE_SETTER);
INVISIBLE_MEMBER, NON_PUBLIC_CALL_FROM_PUBLIC_INLINE, INVISIBLE_REFERENCE, INVISIBLE_SETTER);
ImmutableSet<? extends DiagnosticFactory<?>> UNUSED_ELEMENT_DIAGNOSTICS = ImmutableSet.of(
UNUSED_VARIABLE, UNUSED_PARAMETER, ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE, VARIABLE_WITH_REDUNDANT_INITIALIZER,
UNUSED_LAMBDA_EXPRESSION, USELESS_CAST, UNUSED_VALUE, USELESS_ELVIS);
@@ -732,9 +732,8 @@ public class DefaultErrorMessages {
MAP.put(ARRAY_CLASS_LITERAL_REQUIRES_ARGUMENT, "kotlin.Array class literal requires a type argument, please specify one in angle brackets");
//Inline
MAP.put(INVISIBLE_MEMBER_FROM_INLINE, "Public-API inline function cannot access non-public-API ''{0}''", SHORT_NAMES_IN_TYPES, SHORT_NAMES_IN_TYPES);
MAP.put(NON_PUBLIC_CALL_FROM_PUBLIC_INLINE, "Public-API inline function cannot access non-public-API ''{0}''", SHORT_NAMES_IN_TYPES, SHORT_NAMES_IN_TYPES);
MAP.put(PRIVATE_CLASS_MEMBER_FROM_INLINE, "Non-private inline function cannot access members of private classes: ''{0}''", SHORT_NAMES_IN_TYPES, SHORT_NAMES_IN_TYPES);
MAP.put(NOT_YET_SUPPORTED_IN_INLINE, "''{0}'' construction is not yet supported in inline functions", ELEMENT_TEXT, SHORT_NAMES_IN_TYPES);
MAP.put(DECLARATION_CANT_BE_INLINED, "''inline'' modifier is not allowed on virtual members. Only private or final members can be inlined");
MAP.put(NOTHING_TO_INLINE, "Expected performance impact of inlining ''{0}'' can be insignificant. Inlining works best for functions with lambda parameters", SHORT_NAMES_IN_TYPES);
@@ -241,7 +241,7 @@ class InlineChecker implements CallChecker {
private void checkVisibilityAndAccess(@NotNull CallableDescriptor declarationDescriptor, @NotNull KtElement expression, @NotNull BasicCallResolutionContext context){
boolean declarationDescriptorIsPublicApi = DescriptorUtilsKt.isEffectivelyPublicApi(declarationDescriptor) || isDefinedInInlineFunction(declarationDescriptor);
if (isEffectivelyPublicApiFunction && !declarationDescriptorIsPublicApi && declarationDescriptor.getVisibility() != Visibilities.LOCAL) {
context.trace.report(Errors.INVISIBLE_MEMBER_FROM_INLINE.on(expression, declarationDescriptor, descriptor));
context.trace.report(Errors.NON_PUBLIC_CALL_FROM_PUBLIC_INLINE.on(expression, declarationDescriptor, descriptor));
}
else {
checkPrivateClassMemberAccess(declarationDescriptor, expression, context);
@@ -5,8 +5,8 @@ private class Z public constructor(){
}
public inline fun test() {
<!INVISIBLE_MEMBER_FROM_INLINE!>Z<!>().<!INVISIBLE_MEMBER_FROM_INLINE!>publicProperty<!>
<!INVISIBLE_MEMBER_FROM_INLINE!>Z<!>().<!INVISIBLE_MEMBER_FROM_INLINE!>publicFun<!>()
<!NON_PUBLIC_CALL_FROM_PUBLIC_INLINE!>Z<!>().<!NON_PUBLIC_CALL_FROM_PUBLIC_INLINE!>publicProperty<!>
<!NON_PUBLIC_CALL_FROM_PUBLIC_INLINE!>Z<!>().<!NON_PUBLIC_CALL_FROM_PUBLIC_INLINE!>publicFun<!>()
}
internal inline fun testInternal() {
@@ -7,13 +7,13 @@ internal val internalProperty = 11;
internal fun internalFun() {}
public inline fun test() {
<!INVISIBLE_MEMBER_FROM_INLINE!>privateFun<!>()
<!INVISIBLE_MEMBER_FROM_INLINE!>privateProperty<!>
<!NON_PUBLIC_CALL_FROM_PUBLIC_INLINE!>privateFun<!>()
<!NON_PUBLIC_CALL_FROM_PUBLIC_INLINE!>privateProperty<!>
}
public inline fun test2() {
<!INVISIBLE_MEMBER_FROM_INLINE!>internalFun<!>()
<!INVISIBLE_MEMBER_FROM_INLINE!>internalProperty<!>
<!NON_PUBLIC_CALL_FROM_PUBLIC_INLINE!>internalFun<!>()
<!NON_PUBLIC_CALL_FROM_PUBLIC_INLINE!>internalProperty<!>
}
internal inline fun testInternal() {
@@ -8,8 +8,8 @@ public class Z {
}
public inline fun test() {
Z().<!INVISIBLE_MEMBER_FROM_INLINE!>privateProperty<!>
Z().<!INVISIBLE_MEMBER_FROM_INLINE!>privateFun<!>()
Z().<!NON_PUBLIC_CALL_FROM_PUBLIC_INLINE!>privateProperty<!>
Z().<!NON_PUBLIC_CALL_FROM_PUBLIC_INLINE!>privateFun<!>()
}
internal inline fun testInternal() {
@@ -26,8 +26,8 @@ public class Z2 {
}
public inline fun test() {
<!INVISIBLE_MEMBER_FROM_INLINE!>privateProperty<!>
<!INVISIBLE_MEMBER_FROM_INLINE!>privateFun<!>()
<!NON_PUBLIC_CALL_FROM_PUBLIC_INLINE!>privateProperty<!>
<!NON_PUBLIC_CALL_FROM_PUBLIC_INLINE!>privateFun<!>()
}
internal inline fun testInternal() {