Commit f580ef438079dc7f682ab8fcaecb6ca7e66f62fa

Thomas de Grivel 2024-03-24T11:10:46

add missing eval

diff --git a/.ic3_history b/.ic3_history
index a110ecd..d29979a 100644
--- a/.ic3_history
+++ b/.ic3_history
@@ -1,45 +1,3 @@
--15 mod 6
-3 mod sqrt(2)
-4 mod sqrt(2)
-2 mod sqrt(2)
-10 mod sqrt(2)
-1/2 + 2/3
-1/2 * 2/3
-1/2 / 2/3
-1/2 - 2/3
-1 +i 2
-(1 +i 2) + (2 +i 3)
-(1 +i 2) * (2 +i 3)
-ic3> (1 +i 2) + (2 +i 3)
-(1 +i 2) / (2 +i 3)
-(1/1 +i 2/1) / (2 +i 3)
-(Ratio) 0
-(Ratio) 1
-(Ratio) 1.2
-(Ratio) 42
-(Ratio) 42 / 3
-((Ratio) 42) / 3
-((Ratio) 42) / 5
-(Ratio) 42 / 5
-(Ratio) 42
-((Ratio) 42) / 5
-(Ratio) 42
-(Ratio) 42 / 5
-(Ratio) 42 / 6
-license()
-license(à
-)
-license()
-hash
-hash(1)
-hash(2)
-license()
-defmodule Plop do
-  1 + 1
-  2 + 2
-end
-defmodule Plop
-do
   1 + 1
   2 + 2
 end
@@ -97,3 +55,45 @@ def dt = macro (x) do
   end
 end
 dt(a)
+1 + 10000000000000000000000000000000000000000000
+def beaucoup = 1 + 10000000000000000000000000000000000000000000
+type(beaucoup)
+def beaucoup = 1 + 10000000000000000000000000000000000000000000
+type(beaucoup)
+beaucoup
+def beaucoup = (U8) beaucoup
+type(beaucoup)
+beacoup
+beaucoup
+1 / 4
+(Ratio) 1 / 4
+(Ratio) 1 / 4 * 2
+1/4 * 2
+type(1/4)
+1/4 / 13/12
+1/4 / 13/12 * 2
+(Complex) 1
+1 +i 2
+type(1 +i 2)
+1 +i 2 +i 3
+(1 +i 2) * (2 +i 3)
+sqrt(-1)
+sqrt(-1) * sqrt(-1)
+sqrt(-2) * sqrt(-2)
+def dt = macro (x) do
+  quote do
+    x = ^ unquote(x)
+    {x, x}
+  end
+end
+dt(200)
+dt(200 * 200)
+dt(sqrt(-1))
+def double = fn (x) { x * 2 }
+double(200)
+double(beaucoup)
+def beaucoup = 1 + 10000000000000000000000000000000000000000000
+double(beaucoup)
+dt
+double(3/4)
+1 / double(3/4)
diff --git a/libc3/env.c b/libc3/env.c
index 09aa836..f21586c 100644
--- a/libc3/env.c
+++ b/libc3/env.c
@@ -75,7 +75,7 @@ s_tag * env_def (s_env *env, const s_call *call, s_tag *dest)
   s_tag tag_module;
   s_tag tag_symbol;
   s_tag tag_symbol_value;
-  s_tag *tag_value;
+  s_tag tag_value;
   (void) env;
   assert(env);
   assert(call);
@@ -94,12 +94,12 @@ s_tag * env_def (s_env *env, const s_call *call, s_tag *dest)
   tag_init_sym(&tag_module, tag_ident.data.ident.module);
   tag_init_sym(&tag_symbol, &g_sym_symbol);
   tag_init_sym(&tag_symbol_value, &g_sym_symbol_value);
-  tag_value = &list_next(call->arguments)->tag;
+  env_eval_tag(env, &list_next(call->arguments)->tag, &tag_value);
   if (! facts_add_tags(&env->facts, &tag_module, &tag_symbol,
                        &tag_ident))
     return NULL;
   if (! facts_replace_tags(&env->facts, &tag_ident, &tag_symbol_value,
-                           tag_value))
+                           &tag_value))
     return NULL;
   tag_init_ident(dest, &tag_ident.data.ident);
   return dest;