From: fennecdjay Date: Tue, 8 Oct 2019 15:41:58 +0000 (+0200) Subject: :art: More testing X-Git-Tag: nightly~2198^2~91 X-Git-Url: http://10.10.0.4:5575/?a=commitdiff_plain;h=616e21495c9e61dad443d515a94088d2071cb72a;p=gwion.git :art: More testing --- diff --git a/src/lib/object.c b/src/lib/object.c index ac7995a2..b1151291 100644 --- a/src/lib/object.c +++ b/src/lib/object.c @@ -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; diff --git a/src/parse/check.c b/src/parse/check.c index 81b3eb28..3e6fa6f0 100644 --- a/src/parse/check.c +++ b/src/parse/check.c @@ -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)) diff --git a/src/parse/did_you_mean.c b/src/parse/did_you_mean.c index d46dcd77..e06b7a81 100644 --- a/src/parse/did_you_mean.c +++ b/src/parse/did_you_mean.c @@ -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 index 00000000..63d002e5 --- /dev/null +++ b/tests/nonnull/cast_non_null.gw @@ -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 index 00000000..8d104b15 --- /dev/null +++ b/tests/nonnull/cast_non_null2.gw @@ -0,0 +1,2 @@ +Object @o; +o $ Object; diff --git a/tests/tree/did_you_mean_type.gw b/tests/tree/did_you_mean_type.gw index 73b04597..b55d867d 100644 --- a/tests/tree/did_you_mean_type.gw +++ b/tests/tree/did_you_mean_type.gw @@ -1,4 +1,4 @@ class C { - <<>>; - int a; + int iiii; + <<< this.iii >>>; }