From 1b850dd4ffabfda367acab23f8ead25ecbdfd41e Mon Sep 17 00:00:00 2001 From: "gbracha@google.com" Date: Wed, 16 Oct 2013 00:54:58 +0000 Subject: [PATCH] It's an error if to instantiate a subclass of a malbounded type,or a type variable. R=regis@google.com Review URL: https://codereview.chromium.org//26990005 git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@28701 260f80e4-7a28-3924-810f-c04153c831b5 --- docs/language/dartLangSpec.tex | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/docs/language/dartLangSpec.tex b/docs/language/dartLangSpec.tex index e03626945f1..f477b94ed11 100644 --- a/docs/language/dartLangSpec.tex +++ b/docs/language/dartLangSpec.tex @@ -511,6 +511,8 @@ The former section on variables in interfaces (now removed): Added specification \subsubsection{Changes Since Version 0.7} +\ref{new}: Instantiating subclasses of malbounded types is a dynamic error. + \ref{leastUpperBounds}: Extended LUBs to all types. @@ -3170,7 +3172,7 @@ First, the argument list $(a_1, \ldots , a_n, x_{n+1}: a_{n+1}, \ldots , x_{n+k} Then, if $q$ is a non-factory constructor of an abstract class then an \code{AbstractClassInstantiationError} is thrown. -If $T$ is malformed a dynamic error occurs. In checked mode, if $T$ is malbounded a dynamic error occurs. +If $T$ is malformed or if $T$ is a type variable a dynamic error occurs. In checked mode, if $T$ or any of its superclasses is malbounded a dynamic error occurs. Otherwise, if $q$ is not defined or not accessible, a \code{NoSuchMethodError} is thrown. If $q$ has less than $n$ positional parameters or more than $n$ required parameters, or if $q$ lacks any of the keyword parameters $\{ x_{n+1}, \ldots, x_{n+k}\}$ a \code{NoSuchMethodError} is thrown. Otherwise, if $q$ is a generative constructor (\ref{generativeConstructors}), then: @@ -5619,8 +5621,8 @@ Here is an example involving malbounded types: } \begin{dartCode} -\INTERFACE{} I$<$T \EXTENDS{} num$>$ \{\} -\INTERFACE{} J \{\} +\CLASS{} I$<$T \EXTENDS{} num$>$ \{\} +\CLASS{} J \{\} \CLASS{} A$<$T$>$ \IMPLEMENTS{} J, I$<$T$>$ // type warning: T is not a subtype of num \{ ...