From ccb2e6e02f39f6cf5f7beb4aa64bec948a8c7edf Mon Sep 17 00:00:00 2001 From: "Juan J. Martinez" Date: Sun, 21 Aug 2022 08:07:52 +0100 Subject: Qualified undefined variable error, added test --- src/Error.hs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/Error.hs') diff --git a/src/Error.hs b/src/Error.hs index 724f57c..40bb046 100644 --- a/src/Error.hs +++ b/src/Error.hs @@ -4,7 +4,7 @@ import Data.List (sort) import Text.Parsec (SourcePos, errorPos) import Text.Parsec.Error (ParseError, errorMessages, showErrorMessages) -data ErrorType = GenericError | TypeError | UnexpectedReturn | AlreadyDefined | NonCallable deriving (Show) +data ErrorType = GenericError | TypeError | UnexpectedReturn | AlreadyDefined | NonCallable | Undefined deriving (Show) instance Enum ErrorType where fromEnum GenericError = 0 @@ -12,6 +12,7 @@ instance Enum ErrorType where fromEnum UnexpectedReturn = 2 fromEnum AlreadyDefined = 3 fromEnum NonCallable = 4 + fromEnum Undefined = 5 toEnum _ = error "toEnum is undefined for Error" data Error = Error ErrorType String SourcePos -- cgit v1.2.3