Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(238)

Unified Diff: docs/language/dartLangSpec.tex

Issue 818463002: Change static typing so that inherited noSuchMethod silences errors, (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: docs/language/dartLangSpec.tex
===================================================================
--- docs/language/dartLangSpec.tex (revision 42464)
+++ docs/language/dartLangSpec.tex (working copy)
@@ -1106,7 +1106,11 @@
%always results in a run-time error. This must be \code{NoSuchMethodError} or an instance of a subclass of \code{NoSuchMethodError}, such as \code{AbstractMethodError}.
\LMHash{}
-It is a static warning if an abstract member is declared or inherited in a concrete class unless that member overrides a concrete one.
+It is a static warning if an abstract member $m$ is declared or inherited in a concrete class $C$ unless:
+\begin{itemize}
+\item $m$ overrides a concrete member, or
+\item $C$ has a \cd{noSuchMethod()} method distinct from the one declared in class \cd{Object}.
+\end{itemize}
\rationale {
We wish to warn if one declares a concrete class with abstract members. However, code like the following should work without warnings:
@@ -1813,7 +1817,7 @@
\item If possible the interface gets a member named $m$ that has the minimum number of required parameters among all the members in the superinterfaces, the maximal number of positionals, and the superset of named parameters. The types of these are all \DYNAMIC{}. If this is impossible then no member $m$ appears in the interface.
\end{itemize} (\ref{interfaceInheritanceAndOverriding})
\item Rule \ref{typeSigAssignable} applies to interfaces as well as classes (\ref{interfaceInheritanceAndOverriding}).
-\item It is a static warning if a concrete class does not have an implementation for a method in any of its superinterfaces unless it declares its own \cd{noSuchMethod} method (\ref{superinterfaces}).
+\item It is a static warning if a concrete class does not have an implementation for a method in any of its superinterfaces unless it has a \cd{noSuchMethod} method (\ref{superinterfaces}).
\item The identifier of a named constructor cannot be the same as the name of a member declared (as opposed to inherited) in the same class (\ref{constructors}).
\end{enumerate}
}
@@ -1847,7 +1851,7 @@
It is a compile-time error if the interface of a class $C$ is a superinterface of itself.
\LMHash{}
-Let $C$ be a concrete class that does not declare its own \code{noSuchMethod()} method.
+Let $C$ be a concrete class that does not have a \code{noSuchMethod()} method distinct from the one declared in class \cd{Object}.
It is a static warning if the implicit interface of $C$ includes an instance member $m$ of type $F$ and $C$ does not declare or inherit a corresponding non-abstract instance member $m$ of type $F'$ such that $F' <: F$.
\commentary{A class does not inherit members from its superinterfaces. However, its implicit interface does.
@@ -1856,14 +1860,9 @@
\rationale {
We choose to issue these warnings only for concrete classes; an abstract class might legitimately be designed with the expectation that concrete subclasses will implement part of the interface.
-We also disable these warnings if a \code{noSuchMethod()} declaration is present. In such cases, the supported interface is going to be implemented via \code{noSuchMethod()} and no actual declarations of the implemented interface's members are needed. This allows proxy classes for specific types to be implemented without provoking type warnings.
-
-In addition, it may be useful to suppress these warnings if \code{noSuchMethod} is inherited, However, this may suppress meaningful warnings and so we choose not to do so. If one does want to suppress the warnings in a subclass, one can define a simple implementation of \code{noSuchMethod} in the subclass:
+We also disable these warnings if a \code{noSuchMethod()} declaration is present or inherited from any class other than \cd{Object}. In such cases, the supported interface is going to be implemented via \code{noSuchMethod()} and no actual declarations of the implemented interface's members are needed. This allows proxy classes for specific types to be implemented without provoking type warnings.
}
-\begin{dartCode}
-noSuchMethod(inv) =$>$ \SUPER.noSuchMethod(inv);
-\end{dartCode}
\LMHash{}
It is a static warning if the implicit interface of a class $C$ includes an instance member $m$ of type $F$ and $C$ declares or inherits a corresponding instance member $m$ of type $F'$ if $F'$ is not a subtype of $F$.
@@ -6827,7 +6826,7 @@
\LMHash{}
% ensure that Object and dynamic may be assign dot a function type
A function is always an instance of some class that implements the class \code{Function} and implements a \CALL{} method with the same signature as the function. All function types are subtypes of \code{Function}.
-If a type $I$ includes an instance method named \CALL{}, and the type of \CALL{} is the function type $F$, then $I$ is considered to be more specific than $F$. It is a static warning if a concrete class implements \cd{Function} and does not have a concrete method named \CALL{} unless that class declares its own implementation of \cd{noSuchMethod()}.
+If a type $I$ includes an instance method named \CALL{}, and the type of \CALL{} is the function type $F$, then $I$ is considered to be more specific than $F$. It is a static warning if a concrete class implements \cd{Function} and does not have a concrete method named \CALL{} unless that class has an implementation of \cd{noSuchMethod()} distinct from the one declared in class \cd{Object}.
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698