1aaff769a058 — Leonard Ritter tip an hour ago
* fixed constant folding expression
1 files changed, 7 insertions(+), 2 deletions(-)

M lib/tukan/FIR.sc
M lib/tukan/FIR.sc +7 -2
@@ 1617,10 1617,15 @@ fn fold-constant-expression (self handle
         let typeid sz ptr = (unpack ('handleof module self.value))
         switch typeid
         pass TypeId.typeid_fconst
+        pass TypeId.typeid_uconst
+        do
+            if (self.index == 0)
+                return (copy self.value)
+            else
+                report "index out of vector size"
         pass TypeId.typeid_fvec2
         pass TypeId.typeid_fvec3
         pass TypeId.typeid_fvec4
-        pass TypeId.typeid_uconst
         pass TypeId.typeid_uvec2
         pass TypeId.typeid_uvec3
         pass TypeId.typeid_uvec4

          
@@ 1628,7 1633,7 @@ fn fold-constant-expression (self handle
             if (self.index < sz)
                 return (bitcast (copy (ptr @ self.index)) AnyId)
             else
-                report "index out of scope"
+                report "index out of vector size"
         default;
     case uconst (self)
     case fconst (self)