From e2ed9d7f55f23be178d2a0500c26b6f1e5806834 Mon Sep 17 00:00:00 2001 From: Vic Nightfall Date: Wed, 6 Dec 2023 16:24:50 +0100 Subject: [PATCH] Defensive programming --- src/typechecking.pr | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/typechecking.pr b/src/typechecking.pr index f6a04e1a..81fa64df 100644 --- a/src/typechecking.pr +++ b/src/typechecking.pr @@ -5654,9 +5654,9 @@ def lookup_stub_types(state: &State) { let scpe = state.scope for var key in @state.scope.fields.keys() { let value = state.scope.fields[key] - if value.tpe.kind == TypeKind::TYPE { + if value.tpe and value.tpe.kind == TypeKind::TYPE { let tpe = value.value.value_tpe - if tpe.kind == TypeKind::STUB and util::find_substr(tpe.type_name, "::", 0) == -1 { + if tpe and tpe.kind == TypeKind::STUB and util::find_substr(tpe.type_name, "::", 0) == -1 { state.scope.fields.remove(key) var new_value = scope::get(scpe, parser::make_identifier(key), dry_run = true) if new_value and new_value.tpe.kind == TypeKind::TYPE {