aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/compile.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/compile.c b/src/compile.c
index bd963951..89cb667b 100644
--- a/src/compile.c
+++ b/src/compile.c
@@ -4383,7 +4383,10 @@ CORD compile_top_level_code(env_t *env, ast_t *ast)
}
case Extend: {
DeclareMatch(extend, ast, Extend);
- env_t *ns_env = namespace_env(env, extend->name);
+ binding_t *b = get_binding(env, extend->name);
+ if (!b)
+ code_err(ast, "'", extend->name, "' is not the name of any type I recognize.");
+ env_t *ns_env = Match(b->type, TypeInfoType)->env;
env_t *extended = new(env_t);
*extended = *ns_env;
extended->locals = new(Table_t, .fallback=env->locals);