W3C home > Mailing lists > Public > public-script-coord@w3.org > April to June 2012

Distinguishability checking for nullable unions is not correct

From: Boris Zbarsky <bzbarsky@MIT.EDU>
Date: Mon, 18 Jun 2012 13:06:13 -0400
Message-ID: <4FDF6005.8090201@mit.edu>
To: public-script-coord@w3.org
Consider these two types:

   (Document or long?)
   (HTMLDivElement or HTMLInputElement)?

Consider applying the rules of 
http://dev.w3.org/2006/webapi/WebIDL/#dfn-distinguishable to them.  The 
two types are not both nullable, so we actually try the three conditions:

1)  Does not apply, since union types are not in the table.
2)  Does not apply, since both types are union or nullable union types.
3)  Applies, since 'Document' is distinguishable from 'HTMLDivElement'
     and 'HTMLInputElement', and so is 'long?'.

I believe this last is a bug, since passing null obviously runs into 
problems here.  I believe the simplest way to fix is to say that the "at 
most one of the two is a nullable type" check should also check for 
nullable member types of unions.  Or something.

-Boris
Received on Monday, 18 June 2012 17:06:46 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 8 May 2013 19:30:06 UTC