From c5626fd0275175d62aa28d7ffe501ec0a7b240f8 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=A9mie=20Astor?= Date: Mon, 13 Apr 2020 18:47:39 +0200 Subject: [PATCH] :bug: Fix prim_str --- src/parse/check.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/parse/check.c b/src/parse/check.c index 9f7d1f53..18362f99 100644 --- a/src/parse/check.c +++ b/src/parse/check.c @@ -270,13 +270,17 @@ ANN static Type check_dot(const Env env, const Exp_Dot *member) { return op_check(env, &opi); } +static inline Nspc value_owner(const Value v) { + return v ? v->from->owner : NULL; +} + ANN static Type prim_id_non_res(const Env env, const Symbol *data) { const Symbol var = *data; const Value v = check_non_res_value(env, data); if(!v || !GET_FLAG(v, checked) || (v->from->ctx && v->from->ctx->error)) { env_err(env, prim_pos(data), _("variable %s not legit at this point."), s_name(var)); - did_you_mean_nspc(v ? v->from->owner : env->curr, s_name(var)); + did_you_mean_nspc(value_owner(v) ?: env->curr, s_name(var)); return NULL; } if(env->func && !GET_FLAG(v, const) && v->from->owner) -- 2.43.0