]> gitweb.factorcode.org Git - factor.git/blobdiff - basis/compiler/tree/propagation/propagation-tests.factor
compiler.tree.propagation: Propagate length slot of primitive resize calls
[factor.git] / basis / compiler / tree / propagation / propagation-tests.factor
index 33321734c3d851a7c9114475e6368f30c6a15964..5a4b3dffc81d4ef5bc008f706291a706b194ceaa 100644 (file)
@@ -35,6 +35,15 @@ IN: compiler.tree.propagation.tests
     [ dup "foo" <array> drop ] final-info first
 ] unit-test
 
+{ t } [
+    [ resize-array length ] final-info first
+    array-capacity <class-info> =
+] unit-test
+
+{ 42 } [
+    [ 42 swap resize-array length ] final-literals first
+] unit-test
+
 ! Byte arrays
 { V{ 3 } } [
     [ 3 <byte-array> length ] final-literals
@@ -46,8 +55,12 @@ IN: compiler.tree.propagation.tests
 ] unit-test
 
 { t } [
-    [ dupd resize-byte-array drop ] final-info first
-    integer-array-capacity <class-info> =
+    [ resize-byte-array length ] final-info first
+    array-capacity <class-info> =
+] unit-test
+
+{ 43 } [
+    [ 43 swap resize-byte-array length ] final-literals first
 ] unit-test
 
 ! Strings
@@ -55,6 +68,15 @@ IN: compiler.tree.propagation.tests
     [ 3 f <string> length ] final-literals
 ] unit-test
 
+{ t } [
+    [ resize-string length ] final-info first
+    array-capacity <class-info> =
+] unit-test
+
+{ V{ 44 } } [
+    [ 44 swap resize-string length ] final-literals
+] unit-test
+
 { V{ t } } [
     [ { string } declare string? ] final-classes
 ] unit-test