<?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>219275</bug_id>
          
          <creation_ts>2020-11-24 07:25:21 -0800</creation_ts>
          <short_desc>block scope + const + hoisted function using the const = ReferenceError</short_desc>
          <delta_ts>2020-12-01 17:21:12 -0800</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>JavaScriptCore</component>
          <version>Safari 14</version>
          <rep_platform>All</rep_platform>
          <op_sys>iOS 12</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>DUPLICATE</resolution>
          <dup_id>163209</dup_id>
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords>InRadar</keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Jakub G (dailymotion)">jakub.g.opensource</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>ashvayka</cc>
    
    <cc>fpizlo</cc>
    
    <cc>ross.kirsling</cc>
    
    <cc>webkit-bug-importer</cc>
    
    <cc>ysuzuki</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1710002</commentid>
    <comment_count>0</comment_count>
    <who name="Jakub G (dailymotion)">jakub.g.opensource</who>
    <bug_when>2020-11-24 07:25:21 -0800</bug_when>
    <thetext>Open the following test page:
&gt; https://jg-testpage.netlify.app/safari/const-inside-if.html

Its contents for reference:
```
  &lt;script&gt;
    if (true) {
      const MY_CONST = &apos;MY_CONST&apos;;
      function myFunction() {
        console.log(MY_CONST);
      }
      myFunction();
    }
  &lt;/script&gt;
```

Expected:
&gt; see &quot;MY_CONST&quot; logged

Actual:
&gt; ReferenceError

Other browsers&apos; behavior:
&gt; &quot;MY_CONST&quot; is logged in latest Chrome, Firefox, EdgeLegacy 18</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1710003</commentid>
    <comment_count>1</comment_count>
    <who name="Jakub G (dailymotion)">jakub.g.opensource</who>
    <bug_when>2020-11-24 07:26:18 -0800</bug_when>
    <thetext>I repro the issue on all stable versions of Safari from 14.0 down to 10.1 (didn&apos;t test more)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1710325</commentid>
    <comment_count>2</comment_count>
    <who name="Jakub G (dailymotion)">jakub.g.opensource</who>
    <bug_when>2020-11-27 09:35:44 -0800</bug_when>
    <thetext>Just a small update: it seems to work fine in Safari in strict mode, but not in sloppy mode.

https://jg-testpage.netlify.app/safari/const-inside-if.html
https://jg-testpage.netlify.app/safari/const-inside-if-strict.html

Chrome 50+: OK both strict/sloppy mode
Firefox 50+: OK both strict/sloppy mode
Safari: OK strict mode, KO in sloppy mode</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1711032</commentid>
    <comment_count>3</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2020-12-01 07:26:14 -0800</bug_when>
    <thetext>&lt;rdar://problem/71849401&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1711228</commentid>
    <comment_count>4</comment_count>
    <who name="Ross Kirsling">ross.kirsling</who>
    <bug_when>2020-12-01 17:21:12 -0800</bug_when>
    <thetext>Thanks for the report -- Annex B.3.3 non-conformance has been deprioritized for a long time, but I think there is intention to correct this in the near future.

*** This bug has been marked as a duplicate of bug 163209 ***</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>