diff --git a/source/interpreter.c b/source/interpreter.c index ace9ab7..06d4ad5 100644 --- a/source/interpreter.c +++ b/source/interpreter.c @@ -527,6 +527,14 @@ static Literal parseTypeToValue(Interpreter* interpreter, Literal type) { } } + //BUGFIX: make sure it actually is a type + if (!IS_TYPE(type)) { + interpreter->errorOutput("Bad type encountered: "); + printLiteralCustom(type, interpreter->errorOutput); + interpreter->errorOutput("\n"); + //TODO: would be better to return an int here... + } + return type; } diff --git a/source/scope.c b/source/scope.c index 745c1e2..eefb266 100644 --- a/source/scope.c +++ b/source/scope.c @@ -239,6 +239,10 @@ bool declareScopeVariable(Scope* scope, Literal key, Literal type) { return false; } + if (!IS_TYPE(type)) { + return false; + } + //store the type, for later checking on assignment setLiteralDictionary(&scope->types, key, type);