You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@royale.apache.org by jo...@apache.org on 2022/11/30 00:02:03 UTC

[royale-compiler] 02/02: Tests: more tests for nullish coalescing

This is an automated email from the ASF dual-hosted git repository.

joshtynjala pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/royale-compiler.git

commit 0de1e9248dd3c30de7b66e18ee84f192a8184bae
Author: Josh Tynjala <jo...@apache.org>
AuthorDate: Tue Nov 29 15:55:59 2022 -0800

    Tests: more tests for nullish coalescing
---
 .../java/as/ASNullishCoalescingOperatorTests.java  | 83 ++++++++++++++++++++--
 ...scingOperatorTests_testEmptyString_swfdump.xml} | 35 +++++----
 ...hCoalescingOperatorTests_testFalse_swfdump.xml} | 36 +++++-----
 ...ishCoalescingOperatorTests_testNaN_swfdump.xml} | 38 +++++-----
 ...eratorTests_testNonNullMemberAccess_swfdump.xml | 72 +++++++++----------
 ...CoalescingOperatorTests_testNonNull_swfdump.xml | 18 ++---
 ...gOperatorTests_testNullMemberAccess_swfdump.xml | 72 +++++++++----------
 ...ishCoalescingOperatorTests_testNull_swfdump.xml | 48 ++++++-------
 ...lescingOperatorTests_testUndefined_swfdump.xml} | 40 +++++------
 ...shCoalescingOperatorTests_testZero_swfdump.xml} | 40 +++++------
 10 files changed, 275 insertions(+), 207 deletions(-)

diff --git a/compiler/src/test/java/as/ASNullishCoalescingOperatorTests.java b/compiler/src/test/java/as/ASNullishCoalescingOperatorTests.java
index 5e593120d..ae5d6d862 100644
--- a/compiler/src/test/java/as/ASNullishCoalescingOperatorTests.java
+++ b/compiler/src/test/java/as/ASNullishCoalescingOperatorTests.java
@@ -33,7 +33,7 @@ public class ASNullishCoalescingOperatorTests extends ASFeatureTestsBase
         {
             "var s:String = 'foo';",
 			"var result:Object = s ?? 'bar';",
-			"assertEqual('non-null nullish coalescing', result, 'foo');",
+			"assertEqual('nullish coalescing', result, 'foo');",
         };
         String source = getAS(new String[0], new String[0], testCode, new String[0]);
 
@@ -47,7 +47,82 @@ public class ASNullishCoalescingOperatorTests extends ASFeatureTestsBase
         {
             "var s:String = null;",
 			"var result:Object = s ?? 'bar';",
-			"assertEqual('non-null nullish coalescing', result, 'bar');",
+			"assertEqual('nullish coalescing', result, 'bar');",
+        };
+        String source = getAS(new String[0], new String[0], testCode, new String[0]);
+
+        compileAndRun(source);
+    }
+
+	// undefined is considered nullish
+	@Test
+    public void testUndefined()
+    {
+        String[] testCode = new String[]
+        {
+            "var o:* = undefined;",
+			"var result:* = o ?? 'bar';",
+			"assertEqual('nullish coalescing', result, 'bar');",
+        };
+        String source = getAS(new String[0], new String[0], testCode, new String[0]);
+
+        compileAndRun(source);
+    }
+
+	// 0 is considered falsy, but not nullish
+	@Test
+    public void testZero()
+    {
+        String[] testCode = new String[]
+        {
+            "var o:Number = 0;",
+			"var result:* = o ?? 'bar';",
+			"assertEqual('nullish coalescing', result, 0);",
+        };
+        String source = getAS(new String[0], new String[0], testCode, new String[0]);
+
+        compileAndRun(source);
+    }
+
+	// NaN is considered falsy, but not nullish
+	@Test
+    public void testNaN()
+    {
+        String[] testCode = new String[]
+        {
+            "var o:Number = NaN;",
+			"var result:String = (o ?? 'bar').toString();",
+			"assertEqual('nullish coalescing', result, 'NaN');",
+        };
+        String source = getAS(new String[0], new String[0], testCode, new String[0]);
+
+        compileAndRun(source);
+    }
+
+	// false is considered falsy, but not nullish
+	@Test
+    public void testFalse()
+    {
+        String[] testCode = new String[]
+        {
+            "var o:Boolean = false;",
+			"var result:* = o ?? 'bar';",
+			"assertEqual('nullish coalescing', result, false);",
+        };
+        String source = getAS(new String[0], new String[0], testCode, new String[0]);
+
+        compileAndRun(source);
+    }
+
+	// empty string is considered falsy, but not nullish
+	@Test
+    public void testEmptyString()
+    {
+        String[] testCode = new String[]
+        {
+            "var o:String = '';",
+			"var result:* = o ?? 'bar';",
+			"assertEqual('nullish coalescing', result, '');",
         };
         String source = getAS(new String[0], new String[0], testCode, new String[0]);
 
@@ -61,7 +136,7 @@ public class ASNullishCoalescingOperatorTests extends ASFeatureTestsBase
         {
             "var o:Object = {field: 'foo'};",
 			"var result:Object = o.field ?? 'bar';",
-			"assertEqual('non-null nullish coalescing', result, 'foo');",
+			"assertEqual('nullish coalescing', result, 'foo');",
         };
         String source = getAS(new String[0], new String[0], testCode, new String[0]);
 
@@ -75,7 +150,7 @@ public class ASNullishCoalescingOperatorTests extends ASFeatureTestsBase
         {
             "var o:Object = {field: null};",
 			"var result:Object = o.field ?? 'bar';",
-			"assertEqual('non-null nullish coalescing', result, 'bar');",
+			"assertEqual('nullish coalescing', result, 'bar');",
         };
         String source = getAS(new String[0], new String[0], testCode, new String[0]);
 
diff --git a/compiler/src/test/resources/swfdumps/as_ASNullishCoalescingOperatorTests_testNonNull_swfdump.xml b/compiler/src/test/resources/swfdumps/as_ASNullishCoalescingOperatorTests_testEmptyString_swfdump.xml
similarity index 84%
copy from compiler/src/test/resources/swfdumps/as_ASNullishCoalescingOperatorTests_testNonNull_swfdump.xml
copy to compiler/src/test/resources/swfdumps/as_ASNullishCoalescingOperatorTests_testEmptyString_swfdump.xml
index 61cb64e35..8aec7685b 100644
--- a/compiler/src/test/resources/swfdumps/as_ASNullishCoalescingOperatorTests_testNonNull_swfdump.xml
+++ b/compiler/src/test/resources/swfdumps/as_ASNullishCoalescingOperatorTests_testEmptyString_swfdump.xml
@@ -19,7 +19,7 @@
 -->
 <!-- Parsing swf file:/Users/joshtynjala/Development/apache/royale-compiler/compiler/target/junit-temp/%0.swf -->
 <swf xmlns="http://macromedia/2003/swfx" version="14" framerate="24.0" size="10000x7500" compressed="true" >
-  <!-- framecount=1 length=845 -->
+  <!-- framecount=1 length=830 -->
   <FileAttributes useDirectBlit="false" useGPU="false" hasMetadata="true" actionScript3="true" suppressCrossDomainCaching="false" swfRelativeUrls="false" useNetwork="true"/>
   <Metadata>
         <![CDATA[<?xml version="1.0" ?>
@@ -67,17 +67,17 @@ public class %0 extends Object
     //  max_regs     4            
     //  scope_depth  0            
     //  max_scope    1            
-    //  code_length  33           
+    //  code_length  31           
     bb0
       succs=[bb1,bb2]
-      0      getlocal0            
-      1      pushscope            
-      2      pushstring  "foo"    
-      3      coerce_s             
-      4      setlocal2            
-      5      getlocal2            
-      6      pushnull             
-      7      ifeq        bb2      
+      0      getlocal0          
+      1      pushscope          
+      2      pushstring  ""     
+      3      coerce_s           
+      4      setlocal2          
+      5      getlocal2          
+      6      pushnull           
+      7      ifeq        bb2    
     bb1
       succs=[bb3]
       8      getlocal2         
@@ -87,14 +87,13 @@ public class %0 extends Object
       10      pushstring  "bar"    
     bb3
       succs=[]
-      11      coerce          Object                           
-      12      setlocal3                                        
-      13      findpropstrict  assertEqual                      
-      14      pushstring      "non-null nullish coalescing"    
-      15      getlocal3                                        
-      16      pushstring      "foo"                            
-      17      callpropvoid                                     
-      18      returnvoid                                       
+      11      setlocal3                               
+      12      findpropstrict  assertEqual             
+      13      pushstring      "nullish coalescing"    
+      14      getlocal3                               
+      15      pushstring      ""                      
+      16      callpropvoid                            
+      17      returnvoid                              
   }
 
   private function assertEqual(String,*,*):void
diff --git a/compiler/src/test/resources/swfdumps/as_ASNullishCoalescingOperatorTests_testNull_swfdump.xml b/compiler/src/test/resources/swfdumps/as_ASNullishCoalescingOperatorTests_testFalse_swfdump.xml
similarity index 84%
copy from compiler/src/test/resources/swfdumps/as_ASNullishCoalescingOperatorTests_testNull_swfdump.xml
copy to compiler/src/test/resources/swfdumps/as_ASNullishCoalescingOperatorTests_testFalse_swfdump.xml
index ddda76026..2bfcef8b3 100644
--- a/compiler/src/test/resources/swfdumps/as_ASNullishCoalescingOperatorTests_testNull_swfdump.xml
+++ b/compiler/src/test/resources/swfdumps/as_ASNullishCoalescingOperatorTests_testFalse_swfdump.xml
@@ -19,7 +19,7 @@
 -->
 <!-- Parsing swf file:/Users/joshtynjala/Development/apache/royale-compiler/compiler/target/junit-temp/%0.swf -->
 <swf xmlns="http://macromedia/2003/swfx" version="14" framerate="24.0" size="10000x7500" compressed="true" >
-  <!-- framecount=1 length=842 -->
+  <!-- framecount=1 length=829 -->
   <FileAttributes useDirectBlit="false" useGPU="false" hasMetadata="true" actionScript3="true" suppressCrossDomainCaching="false" swfRelativeUrls="false" useNetwork="true"/>
   <Metadata>
         <![CDATA[<?xml version="1.0" ?>
@@ -67,34 +67,32 @@ public class %0 extends Object
     //  max_regs     4            
     //  scope_depth  0            
     //  max_scope    1            
-    //  code_length  32           
+    //  code_length  28           
     bb0
       succs=[bb1,bb2]
       0      getlocal0         
       1      pushscope         
-      2      pushnull          
-      3      coerce_s          
-      4      setlocal2         
-      5      getlocal2         
-      6      pushnull          
-      7      ifeq       bb2    
+      2      pushfalse         
+      3      setlocal2         
+      4      getlocal2         
+      5      pushnull          
+      6      ifeq       bb2    
     bb1
       succs=[bb3]
-      8      getlocal2         
-      9      jump       bb3    
+      7      getlocal2         
+      8      jump       bb3    
     bb2
       succs=[bb3]
-      10      pushstring  "bar"    
+      9      pushstring  "bar"    
     bb3
       succs=[]
-      11      coerce          Object                           
-      12      setlocal3                                        
-      13      findpropstrict  assertEqual                      
-      14      pushstring      "non-null nullish coalescing"    
-      15      getlocal3                                        
-      16      pushstring      "bar"                            
-      17      callpropvoid                                     
-      18      returnvoid                                       
+      10      setlocal3                               
+      11      findpropstrict  assertEqual             
+      12      pushstring      "nullish coalescing"    
+      13      getlocal3                               
+      14      pushfalse                               
+      15      callpropvoid                            
+      16      returnvoid                              
   }
 
   private function assertEqual(String,*,*):void
diff --git a/compiler/src/test/resources/swfdumps/as_ASNullishCoalescingOperatorTests_testNull_swfdump.xml b/compiler/src/test/resources/swfdumps/as_ASNullishCoalescingOperatorTests_testNaN_swfdump.xml
similarity index 84%
copy from compiler/src/test/resources/swfdumps/as_ASNullishCoalescingOperatorTests_testNull_swfdump.xml
copy to compiler/src/test/resources/swfdumps/as_ASNullishCoalescingOperatorTests_testNaN_swfdump.xml
index ddda76026..fe2a172f7 100644
--- a/compiler/src/test/resources/swfdumps/as_ASNullishCoalescingOperatorTests_testNull_swfdump.xml
+++ b/compiler/src/test/resources/swfdumps/as_ASNullishCoalescingOperatorTests_testNaN_swfdump.xml
@@ -19,7 +19,7 @@
 -->
 <!-- Parsing swf file:/Users/joshtynjala/Development/apache/royale-compiler/compiler/target/junit-temp/%0.swf -->
 <swf xmlns="http://macromedia/2003/swfx" version="14" framerate="24.0" size="10000x7500" compressed="true" >
-  <!-- framecount=1 length=842 -->
+  <!-- framecount=1 length=972 -->
   <FileAttributes useDirectBlit="false" useGPU="false" hasMetadata="true" actionScript3="true" suppressCrossDomainCaching="false" swfRelativeUrls="false" useNetwork="true"/>
   <Metadata>
         <![CDATA[<?xml version="1.0" ?>
@@ -67,34 +67,34 @@ public class %0 extends Object
     //  max_regs     4            
     //  scope_depth  0            
     //  max_scope    1            
-    //  code_length  32           
+    //  code_length  33           
     bb0
       succs=[bb1,bb2]
       0      getlocal0         
       1      pushscope         
-      2      pushnull          
-      3      coerce_s          
-      4      setlocal2         
-      5      getlocal2         
-      6      pushnull          
-      7      ifeq       bb2    
+      2      pushnan           
+      3      setlocal2         
+      4      getlocal2         
+      5      pushnull          
+      6      ifeq       bb2    
     bb1
       succs=[bb3]
-      8      getlocal2         
-      9      jump       bb3    
+      7      getlocal2         
+      8      jump       bb3    
     bb2
       succs=[bb3]
-      10      pushstring  "bar"    
+      9      pushstring  "bar"    
     bb3
       succs=[]
-      11      coerce          Object                           
-      12      setlocal3                                        
-      13      findpropstrict  assertEqual                      
-      14      pushstring      "non-null nullish coalescing"    
-      15      getlocal3                                        
-      16      pushstring      "bar"                            
-      17      callpropvoid                                     
-      18      returnvoid                                       
+      10      callproperty                            
+      11      coerce_s                                
+      12      setlocal3                               
+      13      findpropstrict  assertEqual             
+      14      pushstring      "nullish coalescing"    
+      15      getlocal3                               
+      16      pushstring      "NaN"                   
+      17      callpropvoid                            
+      18      returnvoid                              
   }
 
   private function assertEqual(String,*,*):void
diff --git a/compiler/src/test/resources/swfdumps/as_ASNullishCoalescingOperatorTests_testNonNullMemberAccess_swfdump.xml b/compiler/src/test/resources/swfdumps/as_ASNullishCoalescingOperatorTests_testNonNullMemberAccess_swfdump.xml
index fd988c26e..df294073a 100644
--- a/compiler/src/test/resources/swfdumps/as_ASNullishCoalescingOperatorTests_testNonNullMemberAccess_swfdump.xml
+++ b/compiler/src/test/resources/swfdumps/as_ASNullishCoalescingOperatorTests_testNonNullMemberAccess_swfdump.xml
@@ -19,7 +19,7 @@
 -->
 <!-- Parsing swf file:/Users/joshtynjala/Development/apache/royale-compiler/compiler/target/junit-temp/%0.swf -->
 <swf xmlns="http://macromedia/2003/swfx" version="14" framerate="24.0" size="10000x7500" compressed="true" >
-  <!-- framecount=1 length=987 -->
+  <!-- framecount=1 length=975 -->
   <FileAttributes useDirectBlit="false" useGPU="false" hasMetadata="true" actionScript3="true" suppressCrossDomainCaching="false" swfRelativeUrls="false" useNetwork="true"/>
   <Metadata>
         <![CDATA[<?xml version="1.0" ?>
@@ -44,12 +44,12 @@ public class %0 extends Object
   public function %0():*
   {
     //  derivedName  %0  
-    //  method_info  3                                                     
-    //  max_stack    1                                                     
-    //  max_regs     1                                                     
-    //  scope_depth  0                                                     
-    //  max_scope    1                                                     
-    //  code_length  6                                                     
+    //  method_info  3                                                    
+    //  max_stack    1                                                    
+    //  max_regs     1                                                    
+    //  scope_depth  0                                                    
+    //  max_scope    1                                                    
+    //  code_length  6                                                    
     bb0
       succs=[]
       0      getlocal0            
@@ -70,35 +70,35 @@ public class %0 extends Object
     //  code_length  42           
     bb0
       succs=[bb1,bb2]
-      0       getlocal0                                                                                                                                                                                               
-      1       pushscope                                                                                                                                                                                               
-      2       pushstring   "field"                                                                                                                                                                                    
-      3       pushstring   "foo"                                                                                                                                                                                      
-      4       newobject                                                                                                                                                                                            1  
-      5       coerce       Object                                                                                                                                                                                     
-      6       setlocal2                                                                                                                                                                                               
-      7       getlocal2                                                                                                                                                                                               
+      0       getlocal0                                                                                                                                                                                             
+      1       pushscope                                                                                                                                                                                             
+      2       pushstring   "field"                                                                                                                                                                                  
+      3       pushstring   "foo"                                                                                                                                                                                    
+      4       newobject                                                                                                                                                                                          1  
+      5       coerce       Object                                                                                                                                                                                   
+      6       setlocal2                                                                                                                                                                                             
+      7       getlocal2                                                                                                                                                                                             
       8       getproperty  {private, %0, %0, Object, , , private, http://adobe.com/AS3/2006/builtin, }::field     
-      9       pushnull                                                                                                                                                                                                
-      10      ifeq         bb2                                                                                                                                                                                        
+      9       pushnull                                                                                                                                                                                              
+      10      ifeq         bb2                                                                                                                                                                                      
     bb1
       succs=[bb3]
-      11      getlocal2                                                                                                                                                                                              
+      11      getlocal2                                                                                                                                                                                            
       12      getproperty  {private, %0, %0, Object, , , private, http://adobe.com/AS3/2006/builtin, }::field    
-      13      jump         bb3                                                                                                                                                                                       
+      13      jump         bb3                                                                                                                                                                                     
     bb2
       succs=[bb3]
       14      pushstring  "bar"    
     bb3
       succs=[]
-      15      coerce          Object                           
-      16      setlocal3                                        
-      17      findpropstrict  assertEqual                      
-      18      pushstring      "non-null nullish coalescing"    
-      19      getlocal3                                        
-      20      pushstring      "foo"                            
-      21      callpropvoid                                     
-      22      returnvoid                                       
+      15      coerce          Object                  
+      16      setlocal3                               
+      17      findpropstrict  assertEqual             
+      18      pushstring      "nullish coalescing"    
+      19      getlocal3                               
+      20      pushstring      "foo"                   
+      21      callpropvoid                            
+      22      returnvoid                              
   }
 
   private function assertEqual(String,*,*):void
@@ -141,16 +141,16 @@ function script0$init():*
   //  code_length  14    
   bb0
     succs=[]
-    0      getlocal0                                                                
-    1      pushscope                                                                
-    2      getscopeobject                                                        0  
-    3      getlex          Object                                                   
-    4      dup                                                                      
-    5      pushscope                                                                
-    6      newclass                                                                 
-    7      popscope                                                                 
+    0      getlocal0                                                               
+    1      pushscope                                                               
+    2      getscopeobject                                                       0  
+    3      getlex          Object                                                  
+    4      dup                                                                     
+    5      pushscope                                                               
+    6      newclass                                                                
+    7      popscope                                                                
     8      initproperty    %0     
-    9      returnvoid                                                               
+    9      returnvoid                                                              
 }
 
   </DoABC>
diff --git a/compiler/src/test/resources/swfdumps/as_ASNullishCoalescingOperatorTests_testNonNull_swfdump.xml b/compiler/src/test/resources/swfdumps/as_ASNullishCoalescingOperatorTests_testNonNull_swfdump.xml
index 61cb64e35..ed487a820 100644
--- a/compiler/src/test/resources/swfdumps/as_ASNullishCoalescingOperatorTests_testNonNull_swfdump.xml
+++ b/compiler/src/test/resources/swfdumps/as_ASNullishCoalescingOperatorTests_testNonNull_swfdump.xml
@@ -19,7 +19,7 @@
 -->
 <!-- Parsing swf file:/Users/joshtynjala/Development/apache/royale-compiler/compiler/target/junit-temp/%0.swf -->
 <swf xmlns="http://macromedia/2003/swfx" version="14" framerate="24.0" size="10000x7500" compressed="true" >
-  <!-- framecount=1 length=845 -->
+  <!-- framecount=1 length=836 -->
   <FileAttributes useDirectBlit="false" useGPU="false" hasMetadata="true" actionScript3="true" suppressCrossDomainCaching="false" swfRelativeUrls="false" useNetwork="true"/>
   <Metadata>
         <![CDATA[<?xml version="1.0" ?>
@@ -87,14 +87,14 @@ public class %0 extends Object
       10      pushstring  "bar"    
     bb3
       succs=[]
-      11      coerce          Object                           
-      12      setlocal3                                        
-      13      findpropstrict  assertEqual                      
-      14      pushstring      "non-null nullish coalescing"    
-      15      getlocal3                                        
-      16      pushstring      "foo"                            
-      17      callpropvoid                                     
-      18      returnvoid                                       
+      11      coerce          Object                  
+      12      setlocal3                               
+      13      findpropstrict  assertEqual             
+      14      pushstring      "nullish coalescing"    
+      15      getlocal3                               
+      16      pushstring      "foo"                   
+      17      callpropvoid                            
+      18      returnvoid                              
   }
 
   private function assertEqual(String,*,*):void
diff --git a/compiler/src/test/resources/swfdumps/as_ASNullishCoalescingOperatorTests_testNullMemberAccess_swfdump.xml b/compiler/src/test/resources/swfdumps/as_ASNullishCoalescingOperatorTests_testNullMemberAccess_swfdump.xml
index 77c07c277..43432ef85 100644
--- a/compiler/src/test/resources/swfdumps/as_ASNullishCoalescingOperatorTests_testNullMemberAccess_swfdump.xml
+++ b/compiler/src/test/resources/swfdumps/as_ASNullishCoalescingOperatorTests_testNullMemberAccess_swfdump.xml
@@ -19,7 +19,7 @@
 -->
 <!-- Parsing swf file:/Users/joshtynjala/Development/apache/royale-compiler/compiler/target/junit-temp/%0.swf -->
 <swf xmlns="http://macromedia/2003/swfx" version="14" framerate="24.0" size="10000x7500" compressed="true" >
-  <!-- framecount=1 length=979 -->
+  <!-- framecount=1 length=973 -->
   <FileAttributes useDirectBlit="false" useGPU="false" hasMetadata="true" actionScript3="true" suppressCrossDomainCaching="false" swfRelativeUrls="false" useNetwork="true"/>
   <Metadata>
         <![CDATA[<?xml version="1.0" ?>
@@ -44,12 +44,12 @@ public class %0 extends Object
   public function %0():*
   {
     //  derivedName  %0  
-    //  method_info  3                                                    
-    //  max_stack    1                                                    
-    //  max_regs     1                                                    
-    //  scope_depth  0                                                    
-    //  max_scope    1                                                    
-    //  code_length  6                                                    
+    //  method_info  3                                                     
+    //  max_stack    1                                                     
+    //  max_regs     1                                                     
+    //  scope_depth  0                                                     
+    //  max_scope    1                                                     
+    //  code_length  6                                                     
     bb0
       succs=[]
       0      getlocal0            
@@ -70,35 +70,35 @@ public class %0 extends Object
     //  code_length  41           
     bb0
       succs=[bb1,bb2]
-      0       getlocal0                                                                                                                                                                                             
-      1       pushscope                                                                                                                                                                                             
-      2       pushstring   "field"                                                                                                                                                                                  
-      3       pushnull                                                                                                                                                                                              
-      4       newobject                                                                                                                                                                                          1  
-      5       coerce       Object                                                                                                                                                                                   
-      6       setlocal2                                                                                                                                                                                             
-      7       getlocal2                                                                                                                                                                                             
+      0       getlocal0                                                                                                                                                                                               
+      1       pushscope                                                                                                                                                                                               
+      2       pushstring   "field"                                                                                                                                                                                    
+      3       pushnull                                                                                                                                                                                                
+      4       newobject                                                                                                                                                                                            1  
+      5       coerce       Object                                                                                                                                                                                     
+      6       setlocal2                                                                                                                                                                                               
+      7       getlocal2                                                                                                                                                                                               
       8       getproperty  {private, %0, %0, Object, , , private, http://adobe.com/AS3/2006/builtin, }::field     
-      9       pushnull                                                                                                                                                                                              
-      10      ifeq         bb2                                                                                                                                                                                      
+      9       pushnull                                                                                                                                                                                                
+      10      ifeq         bb2                                                                                                                                                                                        
     bb1
       succs=[bb3]
-      11      getlocal2                                                                                                                                                                                            
+      11      getlocal2                                                                                                                                                                                              
       12      getproperty  {private, %0, %0, Object, , , private, http://adobe.com/AS3/2006/builtin, }::field    
-      13      jump         bb3                                                                                                                                                                                     
+      13      jump         bb3                                                                                                                                                                                       
     bb2
       succs=[bb3]
       14      pushstring  "bar"    
     bb3
       succs=[]
-      15      coerce          Object                           
-      16      setlocal3                                        
-      17      findpropstrict  assertEqual                      
-      18      pushstring      "non-null nullish coalescing"    
-      19      getlocal3                                        
-      20      pushstring      "bar"                            
-      21      callpropvoid                                     
-      22      returnvoid                                       
+      15      coerce          Object                  
+      16      setlocal3                               
+      17      findpropstrict  assertEqual             
+      18      pushstring      "nullish coalescing"    
+      19      getlocal3                               
+      20      pushstring      "bar"                   
+      21      callpropvoid                            
+      22      returnvoid                              
   }
 
   private function assertEqual(String,*,*):void
@@ -141,16 +141,16 @@ function script0$init():*
   //  code_length  14    
   bb0
     succs=[]
-    0      getlocal0                                                               
-    1      pushscope                                                               
-    2      getscopeobject                                                       0  
-    3      getlex          Object                                                  
-    4      dup                                                                     
-    5      pushscope                                                               
-    6      newclass                                                                
-    7      popscope                                                                
+    0      getlocal0                                                                
+    1      pushscope                                                                
+    2      getscopeobject                                                        0  
+    3      getlex          Object                                                   
+    4      dup                                                                      
+    5      pushscope                                                                
+    6      newclass                                                                 
+    7      popscope                                                                 
     8      initproperty    %0     
-    9      returnvoid                                                              
+    9      returnvoid                                                               
 }
 
   </DoABC>
diff --git a/compiler/src/test/resources/swfdumps/as_ASNullishCoalescingOperatorTests_testNull_swfdump.xml b/compiler/src/test/resources/swfdumps/as_ASNullishCoalescingOperatorTests_testNull_swfdump.xml
index ddda76026..0f2b971d3 100644
--- a/compiler/src/test/resources/swfdumps/as_ASNullishCoalescingOperatorTests_testNull_swfdump.xml
+++ b/compiler/src/test/resources/swfdumps/as_ASNullishCoalescingOperatorTests_testNull_swfdump.xml
@@ -19,7 +19,7 @@
 -->
 <!-- Parsing swf file:/Users/joshtynjala/Development/apache/royale-compiler/compiler/target/junit-temp/%0.swf -->
 <swf xmlns="http://macromedia/2003/swfx" version="14" framerate="24.0" size="10000x7500" compressed="true" >
-  <!-- framecount=1 length=842 -->
+  <!-- framecount=1 length=829 -->
   <FileAttributes useDirectBlit="false" useGPU="false" hasMetadata="true" actionScript3="true" suppressCrossDomainCaching="false" swfRelativeUrls="false" useNetwork="true"/>
   <Metadata>
         <![CDATA[<?xml version="1.0" ?>
@@ -44,12 +44,12 @@ public class %0 extends Object
   public function %0():*
   {
     //  derivedName  %0  
-    //  method_info  3                                                     
-    //  max_stack    1                                                     
-    //  max_regs     1                                                     
-    //  scope_depth  0                                                     
-    //  max_scope    1                                                     
-    //  code_length  6                                                     
+    //  method_info  3                                                   
+    //  max_stack    1                                                   
+    //  max_regs     1                                                   
+    //  scope_depth  0                                                   
+    //  max_scope    1                                                   
+    //  code_length  6                                                   
     bb0
       succs=[]
       0      getlocal0            
@@ -87,14 +87,14 @@ public class %0 extends Object
       10      pushstring  "bar"    
     bb3
       succs=[]
-      11      coerce          Object                           
-      12      setlocal3                                        
-      13      findpropstrict  assertEqual                      
-      14      pushstring      "non-null nullish coalescing"    
-      15      getlocal3                                        
-      16      pushstring      "bar"                            
-      17      callpropvoid                                     
-      18      returnvoid                                       
+      11      coerce          Object                  
+      12      setlocal3                               
+      13      findpropstrict  assertEqual             
+      14      pushstring      "nullish coalescing"    
+      15      getlocal3                               
+      16      pushstring      "bar"                   
+      17      callpropvoid                            
+      18      returnvoid                              
   }
 
   private function assertEqual(String,*,*):void
@@ -137,16 +137,16 @@ function script0$init():*
   //  code_length  14    
   bb0
     succs=[]
-    0      getlocal0                                                                
-    1      pushscope                                                                
-    2      getscopeobject                                                        0  
-    3      getlex          Object                                                   
-    4      dup                                                                      
-    5      pushscope                                                                
-    6      newclass                                                                 
-    7      popscope                                                                 
+    0      getlocal0                                                              
+    1      pushscope                                                              
+    2      getscopeobject                                                      0  
+    3      getlex          Object                                                 
+    4      dup                                                                    
+    5      pushscope                                                              
+    6      newclass                                                               
+    7      popscope                                                               
     8      initproperty    %0     
-    9      returnvoid                                                               
+    9      returnvoid                                                             
 }
 
   </DoABC>
diff --git a/compiler/src/test/resources/swfdumps/as_ASNullishCoalescingOperatorTests_testNull_swfdump.xml b/compiler/src/test/resources/swfdumps/as_ASNullishCoalescingOperatorTests_testUndefined_swfdump.xml
similarity index 83%
copy from compiler/src/test/resources/swfdumps/as_ASNullishCoalescingOperatorTests_testNull_swfdump.xml
copy to compiler/src/test/resources/swfdumps/as_ASNullishCoalescingOperatorTests_testUndefined_swfdump.xml
index ddda76026..4503515e9 100644
--- a/compiler/src/test/resources/swfdumps/as_ASNullishCoalescingOperatorTests_testNull_swfdump.xml
+++ b/compiler/src/test/resources/swfdumps/as_ASNullishCoalescingOperatorTests_testUndefined_swfdump.xml
@@ -19,7 +19,7 @@
 -->
 <!-- Parsing swf file:/Users/joshtynjala/Development/apache/royale-compiler/compiler/target/junit-temp/%0.swf -->
 <swf xmlns="http://macromedia/2003/swfx" version="14" framerate="24.0" size="10000x7500" compressed="true" >
-  <!-- framecount=1 length=842 -->
+  <!-- framecount=1 length=830 -->
   <FileAttributes useDirectBlit="false" useGPU="false" hasMetadata="true" actionScript3="true" suppressCrossDomainCaching="false" swfRelativeUrls="false" useNetwork="true"/>
   <Metadata>
         <![CDATA[<?xml version="1.0" ?>
@@ -67,34 +67,32 @@ public class %0 extends Object
     //  max_regs     4            
     //  scope_depth  0            
     //  max_scope    1            
-    //  code_length  32           
+    //  code_length  29           
     bb0
       succs=[bb1,bb2]
-      0      getlocal0         
-      1      pushscope         
-      2      pushnull          
-      3      coerce_s          
-      4      setlocal2         
-      5      getlocal2         
-      6      pushnull          
-      7      ifeq       bb2    
+      0      getlocal0             
+      1      pushscope             
+      2      pushundefined         
+      3      setlocal2             
+      4      getlocal2             
+      5      pushnull              
+      6      ifeq           bb2    
     bb1
       succs=[bb3]
-      8      getlocal2         
-      9      jump       bb3    
+      7      getlocal2         
+      8      jump       bb3    
     bb2
       succs=[bb3]
-      10      pushstring  "bar"    
+      9      pushstring  "bar"    
     bb3
       succs=[]
-      11      coerce          Object                           
-      12      setlocal3                                        
-      13      findpropstrict  assertEqual                      
-      14      pushstring      "non-null nullish coalescing"    
-      15      getlocal3                                        
-      16      pushstring      "bar"                            
-      17      callpropvoid                                     
-      18      returnvoid                                       
+      10      setlocal3                               
+      11      findpropstrict  assertEqual             
+      12      pushstring      "nullish coalescing"    
+      13      getlocal3                               
+      14      pushstring      "bar"                   
+      15      callpropvoid                            
+      16      returnvoid                              
   }
 
   private function assertEqual(String,*,*):void
diff --git a/compiler/src/test/resources/swfdumps/as_ASNullishCoalescingOperatorTests_testNonNull_swfdump.xml b/compiler/src/test/resources/swfdumps/as_ASNullishCoalescingOperatorTests_testZero_swfdump.xml
similarity index 83%
copy from compiler/src/test/resources/swfdumps/as_ASNullishCoalescingOperatorTests_testNonNull_swfdump.xml
copy to compiler/src/test/resources/swfdumps/as_ASNullishCoalescingOperatorTests_testZero_swfdump.xml
index 61cb64e35..d99e2537e 100644
--- a/compiler/src/test/resources/swfdumps/as_ASNullishCoalescingOperatorTests_testNonNull_swfdump.xml
+++ b/compiler/src/test/resources/swfdumps/as_ASNullishCoalescingOperatorTests_testZero_swfdump.xml
@@ -19,7 +19,7 @@
 -->
 <!-- Parsing swf file:/Users/joshtynjala/Development/apache/royale-compiler/compiler/target/junit-temp/%0.swf -->
 <swf xmlns="http://macromedia/2003/swfx" version="14" framerate="24.0" size="10000x7500" compressed="true" >
-  <!-- framecount=1 length=845 -->
+  <!-- framecount=1 length=837 -->
   <FileAttributes useDirectBlit="false" useGPU="false" hasMetadata="true" actionScript3="true" suppressCrossDomainCaching="false" swfRelativeUrls="false" useNetwork="true"/>
   <Metadata>
         <![CDATA[<?xml version="1.0" ?>
@@ -67,34 +67,32 @@ public class %0 extends Object
     //  max_regs     4            
     //  scope_depth  0            
     //  max_scope    1            
-    //  code_length  33           
+    //  code_length  30           
     bb0
       succs=[bb1,bb2]
-      0      getlocal0            
-      1      pushscope            
-      2      pushstring  "foo"    
-      3      coerce_s             
-      4      setlocal2            
-      5      getlocal2            
-      6      pushnull             
-      7      ifeq        bb2      
+      0      getlocal0          
+      1      pushscope          
+      2      pushdouble         
+      3      setlocal2          
+      4      getlocal2          
+      5      pushnull           
+      6      ifeq        bb2    
     bb1
       succs=[bb3]
-      8      getlocal2         
-      9      jump       bb3    
+      7      getlocal2         
+      8      jump       bb3    
     bb2
       succs=[bb3]
-      10      pushstring  "bar"    
+      9      pushstring  "bar"    
     bb3
       succs=[]
-      11      coerce          Object                           
-      12      setlocal3                                        
-      13      findpropstrict  assertEqual                      
-      14      pushstring      "non-null nullish coalescing"    
-      15      getlocal3                                        
-      16      pushstring      "foo"                            
-      17      callpropvoid                                     
-      18      returnvoid                                       
+      10      setlocal3                                
+      11      findpropstrict  assertEqual              
+      12      pushstring      "nullish coalescing"     
+      13      getlocal3                                
+      14      pushbyte                              0  
+      15      callpropvoid                             
+      16      returnvoid                               
   }
 
   private function assertEqual(String,*,*):void