]> Nishi Git Mirror - gwion.git/commitdiff
:art: More testing
authorfennecdjay <astor.jeremie@wanadoo.fr>
Tue, 8 Oct 2019 15:41:58 +0000 (17:41 +0200)
committerfennecdjay <astor.jeremie@wanadoo.fr>
Tue, 8 Oct 2019 15:41:58 +0000 (17:41 +0200)
src/lib/object.c
src/parse/check.c
src/parse/did_you_mean.c
tests/nonnull/cast_non_null.gw [new file with mode: 0644]
tests/nonnull/cast_non_null2.gw [new file with mode: 0644]
tests/tree/did_you_mean_type.gw

index ac7995a2837b11913bcb173777b799f677d89312..b1151291dcc06b3bd829c29e5e49437f4d885924 100644 (file)
@@ -120,8 +120,8 @@ static inline Type check_nonnull(const Env env, const Type l, const Type r,
       ERR_N(pos, _("can't %s '%s' to '%s'"), action, l->name, r->name);
     return r->e->parent;
   }
-  if(nonnull_check(l, r))
-    ERR_N(pos, _("can't %s '%s' to '%s'"), action, l->name, r->name);
+/*  if(nonnull_check(l, r))
+    ERR_N(pos, _("can't %s '%s' to '%s'"), action, l->name, r->name); */
   if(l != env->gwion->type[et_null] && isa(l, r) < 0)
     ERR_N(pos, _("can't %s '%s' to '%s'"), action, l->name, r->name);
   return r;
index 81b3eb28a422e67a20c9418ea1efedeb12890fa7..3e6fa6f031f68fd0d7ef21ad47d4c5ef9ee723f8 100644 (file)
@@ -925,7 +925,7 @@ ANN static Type check_exp_dot(const Env env, Exp_Dot* member) {
     env_err(env, exp_self(member)->pos,
           _("class '%s' has no member '%s'"), the_base->name, str);
     if(member->t_base->nspc)
-      did_you_mean_type(member->t_base, str);
+      did_you_mean_type(the_base, str);
     return NULL;
   }
   CHECK_BO(not_from_owner_class(env, the_base, value, exp_self(member)->pos))
index d46dcd778c995dfb14ad793578643632e2633099..e06b7a812db5cf8b7349a06c55f5ae70d025d375 100644 (file)
@@ -43,7 +43,7 @@ ANN static void ressembles(const Vector v, const Nspc nspc, const char* name) {
   struct scope_iter iter = { nspc->info->value, 0, 0 };
   Value value;
   while(scope_iter(&iter, &value) > 0) {
-    if(strcmp(name, value->name))
+    if(!strcmp(name, value->name))
       continue;
     if(wagner_fisher(name, value->name))
       vector_add(v, (vtype)value->name);
diff --git a/tests/nonnull/cast_non_null.gw b/tests/nonnull/cast_non_null.gw
new file mode 100644 (file)
index 0000000..63d002e
--- /dev/null
@@ -0,0 +1,2 @@
+Object @o;
+o $ Event!;
diff --git a/tests/nonnull/cast_non_null2.gw b/tests/nonnull/cast_non_null2.gw
new file mode 100644 (file)
index 0000000..8d104b1
--- /dev/null
@@ -0,0 +1,2 @@
+Object @o;
+o $ Object;
index 73b0459730d410f59d636fb7d06edb32be2ae50a..b55d867dec724aaf7fbdba588b5a5e508f872eee 100644 (file)
@@ -1,4 +1,4 @@
 class C {
-  <<<this.aa>>>;
-  int a;
+  int iiii;
+  <<< this.iii >>>;
 }