From 76cdfc0b5fd0b692aaf18274a016f3d2c0674a34 Mon Sep 17 00:00:00 2001 From: Antoine Viallon Date: Wed, 10 Jan 2024 23:58:29 +0100 Subject: [PATCH] semantic: make unused variables print a warning instead of raising an error --- compiler/semantic.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/compiler/semantic.py b/compiler/semantic.py index db0ccbe..4135cc4 100644 --- a/compiler/semantic.py +++ b/compiler/semantic.py @@ -229,8 +229,8 @@ class Context: # Check for unused variables if len(variable.reads) == 0 and variable.definition is not None: - raise SemanticAnalysisError(variable.definition.location(), - message=f"Variable '{variable.name}' is unused") + CompilationWarning(variable.definition.location(), + message=f"Variable '{variable.name}' is unused").raise_warning() for context in self.child_contexts.values(): context.check()