Made super mandatory. Everything extends Object

This commit is contained in:
macocianradu
2022-02-17 13:13:55 +01:00
parent 07d4cc73e0
commit 6005594afb
11 changed files with 149 additions and 81 deletions

View File

@@ -7,11 +7,11 @@ import Semantic.TypeChecker
import Data.Either
import Data.Char
-- |Checks if all the inputs and the out of a function call have valid types, and then checks that the assign-output expression is valid
-- |Checks if all the inputs and the output of a function call have valid types, and then checks that the assign-output expression is valid
checkFunction :: ([Type], [Symbol]) -> Function -> Either [TypeCheckError] Function
checkFunction (definedTypes, symbols) (MakeFunction name desc inp out ex)
| isRight checkedEx && isRight checkedOut && null (lefts checkedIn) =
case typeMatch (attributeType $ fromRightUnsafe checkedOut, Model.Type.cardinality out) (fromRightUnsafe checkedEx) of
case typeIncluded (attributeType $ fromRightUnsafe checkedOut, Model.Type.cardinality out) (fromRightUnsafe checkedEx) of
Right _ -> Right $ MakeFunction (toLower (head name) : tail name) desc (rights checkedIn) (fromRightUnsafe checkedOut) ex
Left err -> Left [err]
| otherwise = Left $ lefts [checkedOut] ++ lefts checkedIn ++ lefts [checkedEx]