<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>145954</bug_id>
          
          <creation_ts>2015-06-12 19:33:07 -0700</creation_ts>
          <short_desc>Web Inspector: Improve some cases of &quot;Object?&quot; Type Annotations</short_desc>
          <delta_ts>2015-06-15 12:17:35 -0700</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>Web Inspector</component>
          <version>528+ (Nightly build)</version>
          <rep_platform>All</rep_platform>
          <op_sys>All</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords>DoNotImportToRadar</keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Joseph Pecoraro">joepeck</reporter>
          <assigned_to name="Joseph Pecoraro">joepeck</assigned_to>
          <cc>commit-queue</cc>
    
    <cc>graouts</cc>
    
    <cc>joepeck</cc>
    
    <cc>jonowells</cc>
    
    <cc>mattbaker</cc>
    
    <cc>nvasilyev</cc>
    
    <cc>saam</cc>
    
    <cc>timothy</cc>
    
    <cc>webkit-bug-importer</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1101783</commentid>
    <comment_count>0</comment_count>
    <who name="Joseph Pecoraro">joepeck</who>
    <bug_when>2015-06-12 19:33:07 -0700</bug_when>
    <thetext>* SUMMARY
Improve some cases of &quot;Object?&quot; Type Annotations.

If a type is (Object | NullOrUndefined) and no other primitives just show an &quot;Object?&quot; annotation instead of a nice &quot;LeastCommonAncestor?&quot; annotation.

* TEST
&lt;script&gt;
class Person {};

function personOrNullAndUndefined(person) {} // Person?
personOrNullAndUndefined(new Person);
personOrNullAndUndefined(null);
personOrNullAndUndefined(undefined);

function personOrStringOrNullAndUndefined(thing) {} // Object?
personOrStringOrNullAndUndefined(new Person);
personOrStringOrNullAndUndefined(null);
personOrStringOrNullAndUndefined(undefined);
personOrStringOrNullAndUndefined(&quot;string&quot;);

function personOrBooleanOrNullAndUndefined(thing) {} // (many)
personOrStringOrNullAndUndefined(new Person);
personOrStringOrNullAndUndefined(null);
personOrStringOrNullAndUndefined(undefined);
personOrStringOrNullAndUndefined(false);
&lt;/script&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1101784</commentid>
    <comment_count>1</comment_count>
    <who name="Joseph Pecoraro">joepeck</who>
    <bug_when>2015-06-12 19:35:45 -0700</bug_when>
    <thetext>&gt; function personOrBooleanOrNullAndUndefined(thing) {} // (many)
&gt; personOrStringOrNullAndUndefined(new Person);
&gt; personOrStringOrNullAndUndefined(null);
&gt; personOrStringOrNullAndUndefined(undefined);
&gt; personOrStringOrNullAndUndefined(false);

Err, these should obviously be calling the right function. heh</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1101785</commentid>
    <comment_count>2</comment_count>
      <attachid>254848</attachid>
    <who name="Joseph Pecoraro">joepeck</who>
    <bug_when>2015-06-12 19:38:08 -0700</bug_when>
    <thetext>Created attachment 254848
[PATCH] Proposed Fix</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1101786</commentid>
    <comment_count>3</comment_count>
    <who name="Joseph Pecoraro">joepeck</who>
    <bug_when>2015-06-12 19:39:57 -0700</bug_when>
    <thetext>Noticed this by looking at PropertyPath&apos;s constructor. Parameters with:

    &quot;PropertyPath | Undefined&quot; showed &quot;Object?&quot; expected &quot;PropertyPath?&quot;
    &quot;RemoteObject | Null&quot;      showed &quot;Object?&quot; expected &quot;RemoteObject?&quot;

After the path this looks as expected.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1101797</commentid>
    <comment_count>4</comment_count>
    <who name="Saam Barati">saam</who>
    <bug_when>2015-06-12 23:12:16 -0700</bug_when>
    <thetext>Looks good to me. 
I&apos;d r+ if I could.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1101798</commentid>
    <comment_count>5</comment_count>
      <attachid>254848</attachid>
    <who name="Saam Barati">saam</who>
    <bug_when>2015-06-12 23:13:56 -0700</bug_when>
    <thetext>Comment on attachment 254848
[PATCH] Proposed Fix

View in context: https://bugs.webkit.org/attachment.cgi?id=254848&amp;action=review

&gt; Source/WebInspectorUI/UserInterface/Views/TypeTokenView.js:135
&gt; +        if (this._typeDescription.leastCommonAncestor) {

This is a good catch.

&gt; Source/WebInspectorUI/UserInterface/Views/TypeTokenView.js:138
&gt;              if (typeSet.isContainedIn(WebInspector.TypeSet.TypeBit.Object | WebInspector.TypeSet.NullOrUndefinedTypeBits))

This branch doesn&apos;t even make sense given the above branch above will preclude things that primitive types from coming through.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1101799</commentid>
    <comment_count>6</comment_count>
    <who name="Saam Barati">saam</who>
    <bug_when>2015-06-12 23:14:37 -0700</bug_when>
    <thetext>(In reply to comment #5)
&gt; Comment on attachment 254848 [details]
&gt; [PATCH] Proposed Fix
&gt; 
&gt; View in context:
&gt; https://bugs.webkit.org/attachment.cgi?id=254848&amp;action=review
&gt; 
&gt; &gt; Source/WebInspectorUI/UserInterface/Views/TypeTokenView.js:135
&gt; &gt; +        if (this._typeDescription.leastCommonAncestor) {
&gt; 
&gt; This is a good catch.
&gt; 
&gt; &gt; Source/WebInspectorUI/UserInterface/Views/TypeTokenView.js:138
&gt; &gt;              if (typeSet.isContainedIn(WebInspector.TypeSet.TypeBit.Object | WebInspector.TypeSet.NullOrUndefinedTypeBits))
&gt; 
&gt; This branch doesn&apos;t even make sense given the above branch above will
&gt; preclude things that primitive types from coming through.
Err: This should be past tense. It didn&apos;t make sense before. It makes sense now.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1101995</commentid>
    <comment_count>7</comment_count>
      <attachid>254848</attachid>
    <who name="WebKit Commit Bot">commit-queue</who>
    <bug_when>2015-06-15 12:17:30 -0700</bug_when>
    <thetext>Comment on attachment 254848
[PATCH] Proposed Fix

Clearing flags on attachment: 254848

Committed r185562: &lt;http://trac.webkit.org/changeset/185562&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1101996</commentid>
    <comment_count>8</comment_count>
    <who name="WebKit Commit Bot">commit-queue</who>
    <bug_when>2015-06-15 12:17:35 -0700</bug_when>
    <thetext>All reviewed patches have been landed.  Closing bug.</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>254848</attachid>
            <date>2015-06-12 19:38:08 -0700</date>
            <delta_ts>2015-06-15 12:17:30 -0700</delta_ts>
            <desc>[PATCH] Proposed Fix</desc>
            <filename>types.patch</filename>
            <type>text/plain</type>
            <size>1935</size>
            <attacher name="Joseph Pecoraro">joepeck</attacher>
            
              <data encoding="base64">ZGlmZiAtLWdpdCBhL1NvdXJjZS9XZWJJbnNwZWN0b3JVSS9DaGFuZ2VMb2cgYi9Tb3VyY2UvV2Vi
SW5zcGVjdG9yVUkvQ2hhbmdlTG9nCmluZGV4IDY2MDk4YTcuLmY0YmRmMzEgMTAwNjQ0Ci0tLSBh
L1NvdXJjZS9XZWJJbnNwZWN0b3JVSS9DaGFuZ2VMb2cKKysrIGIvU291cmNlL1dlYkluc3BlY3Rv
clVJL0NoYW5nZUxvZwpAQCAtMSw1ICsxLDE5IEBACiAyMDE1LTA2LTEyICBKb3NlcGggUGVjb3Jh
cm8gIDxwZWNvcmFyb0BhcHBsZS5jb20+CiAKKyAgICAgICAgV2ViIEluc3BlY3RvcjogSW1wcm92
ZSBzb21lIGNhc2VzIG9mICJPYmplY3Q/IiBUeXBlIEFubm90YXRpb25zCisgICAgICAgIGh0dHBz
Oi8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pZXdzL1R5cGVUb2tlblZpZXcuanMKaW5kZXggNzRjNzQyZS4uYmEzYjFi
NyAxMDA2NDQKLS0tIGEvU291cmNlL1dlYkluc3BlY3RvclVJL1VzZXJJbnRlcmZhY2UvVmlld3Mv
VHlwZVRva2VuVmlldy5qcworKysgYi9Tb3VyY2UvV2ViSW5zcGVjdG9yVUkvVXNlckludGVyZmFj
ZS9WaWV3cy9UeXBlVG9rZW5WaWV3LmpzCkBAIC0xMzIsNyArMTMyLDcgQEAgV2ViSW5zcGVjdG9y
LlR5cGVUb2tlblZpZXcgPSBjbGFzcyBUeXBlVG9rZW5WaWV3IGV4dGVuZHMgV2ViSW5zcGVjdG9y
Lk9iamVjdAogCiAgICAgICAgIHZhciB0eXBlU2V0ID0gdGhpcy5fdHlwZURlc2NyaXB0aW9uLnR5
cGVTZXQ7CiAKLSAgICAgICAgaWYgKHRoaXMuX3R5cGVEZXNjcmlwdGlvbi5sZWFzdENvbW1vbkFu
Y2VzdG9yICYmICF0aGlzLl90eXBlRGVzY3JpcHRpb24udHlwZVNldC5wcmltaXRpdmVUeXBlTmFt
ZXMubGVuZ3RoKSB7CisgICAgICAgIGlmICh0aGlzLl90eXBlRGVzY3JpcHRpb24ubGVhc3RDb21t
b25BbmNlc3RvcikgewogICAgICAgICAgICAgaWYgKHR5cGVTZXQuaXNDb250YWluZWRJbihXZWJJ
bnNwZWN0b3IuVHlwZVNldC5UeXBlQml0Lk9iamVjdCkpCiAgICAgICAgICAgICAgICAgcmV0dXJu
IHRoaXMuX3R5cGVEZXNjcmlwdGlvbi5sZWFzdENvbW1vbkFuY2VzdG9yOwogICAgICAgICAgICAg
aWYgKHR5cGVTZXQuaXNDb250YWluZWRJbihXZWJJbnNwZWN0b3IuVHlwZVNldC5UeXBlQml0Lk9i
amVjdCB8IFdlYkluc3BlY3Rvci5UeXBlU2V0Lk51bGxPclVuZGVmaW5lZFR5cGVCaXRzKSkK
</data>

          </attachment>
      

    </bug>

</bugzilla>