Added compile-time errors for supertypes: Type alias missing, and more.
R=lrn@google.com Review-Url: https://codereview.chromium.org/2585723002 .
This commit is contained in:
@@ -1781,9 +1781,8 @@ It is a compile-time error to specify an \EXTENDS{} clause for class \code{Objec
|
||||
The scope of the \EXTENDS{} and \WITH{} clauses of a class $C$ is the type-parameter scope of $C$.
|
||||
|
||||
\LMHash{}
|
||||
%It is a compile-time error if the \EXTENDS{} clause of a class $C$ includes a type expression that does not denote a class available in the lexical scope of $C$.
|
||||
It is a compile-time error if the \EXTENDS{} clause of a class $C$ specifies an enumerated type (\ref{enums}), a malformed type or a deferred type (\ref{staticTypes}) as a superclass.
|
||||
% too strict? Do we e want extends List<Undeclared> to work as List<dynamic>?
|
||||
It is a compile-time error if the \EXTENDS{} clause of a class $C$ specifies a type variable (\ref{generics}), a type alias (\ref{typedef}), an enumerated type (\ref{enums}), a malformed type, or a deferred type (\ref{staticTypes}) as a superclass.
|
||||
It is a compile-time error if the \EXTENDS{} clause of a class $C$ specifies type \DYNAMIC{} as a superinterface.
|
||||
|
||||
\commentary{ The type parameters of a generic class are available in the lexical scope of the superclass clause, potentially shadowing classes in the surrounding scope. The following code is therefore illegal and should cause a compile-time error:
|
||||
}
|
||||
@@ -1917,7 +1916,9 @@ A class has a set of direct superinterfaces. This set includes the interface of
|
||||
The scope of the \IMPLEMENTS{} clause of a class $C$ is the type-parameter scope of $C$.
|
||||
|
||||
\LMHash{}
|
||||
It is a compile-time error if the \IMPLEMENTS{} clause of a class $C$ specifies a type variable as a superinterface. It is a compile-time error if the \IMPLEMENTS{} clause of a class $C$ specifies an enumerated type (\ref{enums}), a malformed type or deferred type (\ref{staticTypes}) as a superinterface. It is a compile-time error if the \IMPLEMENTS{} clause of a class $C$ specifies type \DYNAMIC{} as a superinterface. It is a compile-time error if the \IMPLEMENTS{} clause of a class $C$ specifies a type $T$ as a superinterface more than once.
|
||||
It is a compile-time error if the \IMPLEMENTS{} clause of a class $C$ specifies a type variable (\ref{generics}), a type alias (\ref{typedef}), an enumerated type (\ref{enums}), a malformed type, or a deferred type (\ref{staticTypes}) as a superinterface.
|
||||
It is a compile-time error if the \IMPLEMENTS{} clause of a class $C$ specifies type \DYNAMIC{} as a superinterface.
|
||||
It is a compile-time error if the \IMPLEMENTS{} clause of a class $C$ specifies a type $T$ as a superinterface more than once.
|
||||
It is a compile-time error if the superclass of a class $C$ is specified as a superinterface of $C$.
|
||||
|
||||
\rationale{
|
||||
@@ -2090,8 +2091,10 @@ The restriction on constructors simplifies the construction of mixin application
|
||||
\LMLabel{mixinApplication}
|
||||
|
||||
\LMHash{}
|
||||
A mixin may be applied to a superclass, yielding a new class. Mixin application occurs when a mixin is mixed into a class declaration via its \WITH{} clause. The mixin application may be used to extend a class per section (\ref{classes}); alternately, a class may be defined as a mixin application as described in this section. It is a compile-time error if the \WITH{} clause of a mixin application $C$ includes a deferred type expression.
|
||||
|
||||
A mixin may be applied to a superclass, yielding a new class.
|
||||
Mixin application occurs when a mixin is mixed into a class declaration via its \WITH{} clause.
|
||||
The mixin application may be used to extend a class per section (\ref{classes}); alternately, a class may be defined as a mixin application as described in this section.
|
||||
It is a compile-time error if the \WITH{} clause of a mixin application $C$ includes a type variable (\ref{generics}), a type alias (\ref{typedef}), an enumerated type (\ref{enums}), a malformed type, or a deferred type (\ref{staticTypes}).
|
||||
|
||||
\begin{grammar}
|
||||
{\bf mixinApplicationClass:}
|
||||
|
||||
Reference in New Issue
Block a user