Report error on non-top-level type aliases (unsupported in 1.1).
Get rid of nested type aliases in project.
This commit is contained in:
@@ -130,6 +130,7 @@ public interface Errors {
|
||||
DiagnosticFactory0<KtParameter> REIFIED_TYPE_IN_CATCH_CLAUSE = DiagnosticFactory0.create(ERROR);
|
||||
DiagnosticFactory0<KtTypeParameterList> GENERIC_THROWABLE_SUBCLASS = DiagnosticFactory0.create(ERROR);
|
||||
|
||||
DiagnosticFactory0<KtTypeAlias> TOPLEVEL_TYPEALIASES_ONLY = DiagnosticFactory0.create(ERROR);
|
||||
DiagnosticFactory1<KtElement, ClassifierDescriptor> RECURSIVE_TYPEALIAS_EXPANSION = DiagnosticFactory1.create(ERROR);
|
||||
DiagnosticFactory3<KtElement, KotlinType, KotlinType, ClassifierDescriptor> UPPER_BOUND_VIOLATED_IN_TYPEALIAS_EXPANSION =
|
||||
DiagnosticFactory3.create(ERROR);
|
||||
|
||||
+1
@@ -434,6 +434,7 @@ public class DefaultErrorMessages {
|
||||
MAP.put(USELESS_ELVIS_RIGHT_IS_NULL, "Right operand of elvis operator (?:) is useless if it is null");
|
||||
MAP.put(CONFLICTING_UPPER_BOUNDS, "Upper bounds of {0} have empty intersection", NAME);
|
||||
|
||||
MAP.put(TOPLEVEL_TYPEALIASES_ONLY, "Nested and local type aliases are not supported");
|
||||
MAP.put(RECURSIVE_TYPEALIAS_EXPANSION, "Recursive type alias in expansion: {0}", NAME);
|
||||
MAP.put(UPPER_BOUND_VIOLATED_IN_TYPEALIAS_EXPANSION,
|
||||
"Type argument resulting from type alias expansion is not within required bounds for ''{2}'': " +
|
||||
|
||||
@@ -661,6 +661,10 @@ public class DescriptorResolver {
|
||||
@NotNull KtTypeAlias typeAlias,
|
||||
@NotNull final BindingTrace trace
|
||||
) {
|
||||
if (!(containingDeclaration instanceof PackageFragmentDescriptor)) {
|
||||
trace.report(TOPLEVEL_TYPEALIASES_ONLY.on(typeAlias));
|
||||
}
|
||||
|
||||
KtModifierList modifierList = typeAlias.getModifierList();
|
||||
Visibility visibility = resolveVisibilityFromModifiers(typeAlias, getDefaultVisibility(typeAlias, containingDeclaration));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user